diff --git a/src/app/features/room-nav/RoomNavItem.tsx b/src/app/features/room-nav/RoomNavItem.tsx index 1c83cab58..45d1122ad 100644 --- a/src/app/features/room-nav/RoomNavItem.tsx +++ b/src/app/features/room-nav/RoomNavItem.tsx @@ -260,7 +260,7 @@ const RoomNavItemMenu = forwardRef( const space = useSpaceOptionally(); const [invitePrompt, setInvitePrompt] = useState(false); - const [copiedLink, setCopiedLink] = useState(false); + const [muteMenuAnchor, setMuteMenuAnchor] = useState(); const isServerNotice = room.getType() === 'm.server_notice'; const isFavorite = !!room.tags?.['m.favourite']; @@ -279,14 +279,6 @@ const RoomNavItemMenu = forwardRef( requestClose(); }; - const handleCopyRoomLink = () => { - const roomAlias = room.getCanonicalAlias() ?? room.roomId; - const link = `https://matrix.to/#/${encodeURIComponent(roomAlias)}`; - navigator.clipboard.writeText(link).catch(() => {}); - setCopiedLink(true); - setTimeout(() => setCopiedLink(false), 1500); - }; - const handleMuteFor = useCallback( async (durationMs: number | null) => { const { setRoomNotificationPreference } = @@ -348,16 +340,6 @@ const RoomNavItemMenu = forwardRef( Mark as Read - } - radii="300" - > - - {copiedLink ? 'Copied!' : 'Copy Link'} - - {(handleOpen, opened, changing) => ( ( <> - } - radii="300" - onClick={() => handleMuteFor(15 * 60 * 1000)} + setMuteMenuAnchor(undefined), + clickOutsideDeactivates: true, + escapeDeactivates: stopPropagation, + }} + > + + + {[ + { label: '15 minutes', ms: 15 * 60 * 1000 }, + { label: '1 hour', ms: 60 * 60 * 1000 }, + { label: '8 hours', ms: 8 * 60 * 60 * 1000 }, + { label: '24 hours', ms: 24 * 60 * 60 * 1000 }, + { label: 'Indefinitely', ms: null }, + ].map(({ label, ms }) => ( + handleMuteFor(ms)} + > + + {label} + + + ))} + + + + } > - - Mute for 15m - - - } - radii="300" - onClick={() => handleMuteFor(60 * 60 * 1000)} - > - - Mute for 1h - - - } - radii="300" - onClick={() => handleMuteFor(8 * 60 * 60 * 1000)} - > - - Mute for 8h - - - } - radii="300" - onClick={() => handleMuteFor(24 * 60 * 60 * 1000)} - > - - Mute for 24h - - - } - radii="300" - onClick={() => handleMuteFor(null)} - > - - Mute indefinitely - - + } + radii="300" + aria-pressed={!!muteMenuAnchor} + onClick={(e) => setMuteMenuAnchor(e.currentTarget.getBoundingClientRect())} + > + + + Mute + + + )}