diff --git a/src/app/components/RouteTransition.tsx b/src/app/components/RouteTransition.tsx index d4fd0da1..2ed46b76 100644 --- a/src/app/components/RouteTransition.tsx +++ b/src/app/components/RouteTransition.tsx @@ -88,12 +88,12 @@ export function RouteTransition({ children }: RouteTransitionProps) { }; }, [location, displayLocation]); - const className = - transitionStage === 'entering' - ? `${transitionContent} ${animateIn}` - : transitionStage === 'exiting' - ? `${transitionContent} ${animateOut}` - : transitionContent; + let className = transitionContent; + if (transitionStage === 'entering') { + className = `${transitionContent} ${animateIn}`; + } else if (transitionStage === 'exiting') { + className = `${transitionContent} ${animateOut}`; + } return (
diff --git a/src/app/components/editor/autocomplete/RoomMentionAutocomplete.tsx b/src/app/components/editor/autocomplete/RoomMentionAutocomplete.tsx index ea22da76..92e5ea28 100644 --- a/src/app/components/editor/autocomplete/RoomMentionAutocomplete.tsx +++ b/src/app/components/editor/autocomplete/RoomMentionAutocomplete.tsx @@ -119,16 +119,17 @@ export function RoomMentionAutocomplete({ } const parentsList = Array.from(parents); + const [firstParent] = parentsList; let chosenParent: string; if (parentsList.length === 1) { - chosenParent = parentsList[0]; + chosenParent = firstParent; } else { const orphanParents = parentsList.filter((p) => !roomToParents.has(p)); if (orphanParents.length > 0) { chosenParent = guessPerfectParent(mx, currentRoomId, orphanParents) ?? orphanParents[0]; } else { - chosenParent = parentsList[0]; + chosenParent = firstParent; } } diff --git a/src/app/components/icons/Icon.tsx b/src/app/components/icons/Icon.tsx index 61a73e5e..070085f0 100644 --- a/src/app/components/icons/Icon.tsx +++ b/src/app/components/icons/Icon.tsx @@ -21,17 +21,18 @@ export const Icon = forwardRef( ) => { const pixelSize = ICON_PIXEL_SIZES[size]; + let iconStyle = style; + if (size === 'Inherit') { + iconStyle = { width: '1em', height: '1em', ...style }; + } else if (pixelSize) { + iconStyle = { width: pixelSize, height: pixelSize, ...style }; + } + return ( eps ? px + (py * uy) / ux : px, 0, w); diff --git a/src/app/components/message/Time.tsx b/src/app/components/message/Time.tsx index 29716c58..e540513c 100644 --- a/src/app/components/message/Time.tsx +++ b/src/app/components/message/Time.tsx @@ -25,7 +25,7 @@ export const Time = as<'span', TimeProps & ComponentProps>( ({ compact, hour24Clock, dateFormatString, ts, ...props }, ref) => { const formattedTime = timeHourMinute(ts, hour24Clock); - let time = ''; + let time; if (compact) { time = formattedTime; } else if (today(ts)) { diff --git a/src/app/components/speech-bubble/SpeechBubble.tsx b/src/app/components/speech-bubble/SpeechBubble.tsx index b0316280..60b97d49 100644 --- a/src/app/components/speech-bubble/SpeechBubble.tsx +++ b/src/app/components/speech-bubble/SpeechBubble.tsx @@ -24,17 +24,14 @@ export function SpeechBubble({ }: SpeechBubbleProps) { const isMenu = variant === 'menu'; + let tailClass: string | undefined; + if (tail === 'top') { + tailClass = isMenu ? css.SpeechBubbleMenuTailTop : css.SpeechBubbleTailTop; + } + return (
{ - void this.applyAudioCaptureSettings(); + this.applyAudioCaptureSettings(); }; /** diff --git a/src/app/features/call/useRtcConfig.ts b/src/app/features/call/useRtcConfig.ts index 865156ba..7782d87b 100644 --- a/src/app/features/call/useRtcConfig.ts +++ b/src/app/features/call/useRtcConfig.ts @@ -67,41 +67,39 @@ export function getLiveKitHomeserverPriority( } } } - } else { + } else if (isDM) { // Starting new call - use original priority logic - if (isDM) { - console.log(`[getLiveKitHomeserverPriority] DM path - user homeserver first`); - // For DMs: user's homeserver first, then other member's homeserver - servers.push(userHomeserver); + console.log(`[getLiveKitHomeserverPriority] DM path - user homeserver first`); + // For DMs: user's homeserver first, then other member's homeserver + servers.push(userHomeserver); - const otherUserId = guessDmRoomUserId(room, myUserId); - console.log(`[getLiveKitHomeserverPriority] Other user ID: ${otherUserId}`); - if (otherUserId && otherUserId !== myUserId) { - const otherServer = getMxIdServer(otherUserId); - console.log(`[getLiveKitHomeserverPriority] Other user server: ${otherServer}`); - const userDomain = userHomeserver.replace('https://', '').replace('http://', ''); - if (otherServer && otherServer !== userDomain) { - servers.push(`https://${otherServer}`); - } - } - } else { - console.log(`[getLiveKitHomeserverPriority] Channel path - room homeserver first`); - // For channels: room's homeserver first, then user's homeserver - const roomServer = getRoomServer(room.roomId); - console.log(`[getLiveKitHomeserverPriority] Room server from ID: ${roomServer}`); - if (roomServer) { - servers.push(`https://${roomServer}`); - } - - // Fallback to user's homeserver if different + const otherUserId = guessDmRoomUserId(room, myUserId); + console.log(`[getLiveKitHomeserverPriority] Other user ID: ${otherUserId}`); + if (otherUserId && otherUserId !== myUserId) { + const otherServer = getMxIdServer(otherUserId); + console.log(`[getLiveKitHomeserverPriority] Other user server: ${otherServer}`); const userDomain = userHomeserver.replace('https://', '').replace('http://', ''); - console.log( - `[getLiveKitHomeserverPriority] User domain: ${userDomain}, room server: ${roomServer}`, - ); - if (!roomServer || roomServer !== userDomain) { - servers.push(userHomeserver); + if (otherServer && otherServer !== userDomain) { + servers.push(`https://${otherServer}`); } } + } else { + console.log(`[getLiveKitHomeserverPriority] Channel path - room homeserver first`); + // For channels: room's homeserver first, then user's homeserver + const roomServer = getRoomServer(room.roomId); + console.log(`[getLiveKitHomeserverPriority] Room server from ID: ${roomServer}`); + if (roomServer) { + servers.push(`https://${roomServer}`); + } + + // Fallback to user's homeserver if different + const userDomain = userHomeserver.replace('https://', '').replace('http://', ''); + console.log( + `[getLiveKitHomeserverPriority] User domain: ${userDomain}, room server: ${roomServer}`, + ); + if (!roomServer || roomServer !== userDomain) { + servers.push(userHomeserver); + } } console.log(`[getLiveKitHomeserverPriority] Final server list:`, servers); diff --git a/src/app/features/forum/ForumThreadDetail.tsx b/src/app/features/forum/ForumThreadDetail.tsx index 4a69de6a..cdc0f315 100644 --- a/src/app/features/forum/ForumThreadDetail.tsx +++ b/src/app/features/forum/ForumThreadDetail.tsx @@ -385,19 +385,19 @@ function ForumThreadDetailBody({ // Local echo can land slightly after send; refresh once more. window.setTimeout(() => { - void reloadThread().then(applyLoaded); + reloadThread().then(applyLoaded); }, 400); }, [onReplySent, reloadThread]); const handleDeleted = useCallback(() => { - void handleComposerSent(); + handleComposerSent(); }, [handleComposerSent]); useForumRoomLiveUpdates( [room], () => { setContentRevision((revision) => revision + 1); - void reloadThread(); + reloadThread(); }, { threadRootId: rootEventId, wait: 150 }, ); @@ -418,14 +418,14 @@ function ForumThreadDetailBody({ const eventId = rootEvent.getId(); if (!eventId) return; mx.redactEvent(roomId, eventId).then(() => { - void handleComposerSent(); + handleComposerSent(); }); }, [handleComposerSent, mx, rootEvent, roomId]); const handleEditRootClose = useCallback(() => { setEditEventId(undefined); setContentRevision((revision) => revision + 1); - void handleComposerSent(); + handleComposerSent(); }, [handleComposerSent]); const toggleBranch = useCallback((branchKey: string) => { @@ -585,7 +585,7 @@ function ForumThreadDetailBody({ editEventId={editEventId} onEditEventId={setEditEventId} onComposerSent={() => { - void handleComposerSent(); + handleComposerSent(); }} onDeleted={handleDeleted} onReplyTo={handleReplyTo} @@ -607,7 +607,7 @@ function ForumThreadDetailBody({ replyToEventId={replyToEventId} fileDropContainerRef={dropRef} onSent={() => { - void handleComposerSent(); + handleComposerSent(); }} />
diff --git a/src/app/features/forum/ForumTopicSearchInput.tsx b/src/app/features/forum/ForumTopicSearchInput.tsx index e0f6a868..a4d3d9bd 100644 --- a/src/app/features/forum/ForumTopicSearchInput.tsx +++ b/src/app/features/forum/ForumTopicSearchInput.tsx @@ -91,14 +91,14 @@ export function ForumTopicSearchInput({ qualifierMatches.length, ]); - const suggestionCount = - suggestionMode === 'author' - ? authorMatches.length - : suggestionMode === 'title' - ? titleMatches.length - : suggestionMode === 'qualifier' - ? qualifierMatches.length - : 0; + let suggestionCount = 0; + if (suggestionMode === 'author') { + suggestionCount = authorMatches.length; + } else if (suggestionMode === 'title') { + suggestionCount = titleMatches.length; + } else if (suggestionMode === 'qualifier') { + suggestionCount = qualifierMatches.length; + } const showPills = suggestionMode !== null && suggestionCount > 0; const parsed = parseTopicSearchQuery(value); @@ -261,12 +261,12 @@ export function ForumTopicSearchInput({ event.preventDefault(); - const tabKey = - suggestionMode === 'author' - ? `author:${valueContext?.partial ?? ''}` - : suggestionMode === 'title' - ? `title:${valueContext?.partial ?? ''}` - : `qualifier:${qualifierPartial}`; + let tabKey = `qualifier:${qualifierPartial}`; + if (suggestionMode === 'author') { + tabKey = `author:${valueContext?.partial ?? ''}`; + } else if (suggestionMode === 'title') { + tabKey = `title:${valueContext?.partial ?? ''}`; + } const nextIndex = tabKey === tabPartial ? (highlightIndex + 1) % suggestionCount : 0; setTabPartial(tabKey); @@ -280,12 +280,12 @@ export function ForumTopicSearchInput({ setCaret(input.selectionStart ?? input.value.length); }; - const pillsLabel = - suggestionMode === 'author' - ? 'Author suggestions' - : suggestionMode === 'title' - ? 'Title suggestions' - : 'Search qualifiers'; + let pillsLabel = 'Search qualifiers'; + if (suggestionMode === 'author') { + pillsLabel = 'Author suggestions'; + } else if (suggestionMode === 'title') { + pillsLabel = 'Title suggestions'; + } const matchKeys = new Set(qualifierMatches.map((item) => item.key)); diff --git a/src/app/features/forum/useForumBoard.ts b/src/app/features/forum/useForumBoard.ts index a8fe47e7..58c4e7a7 100644 --- a/src/app/features/forum/useForumBoard.ts +++ b/src/app/features/forum/useForumBoard.ts @@ -236,7 +236,7 @@ export function useForumBoard(scope: ForumBoardScope, forumSpace: Room) { useEffect(() => { if (loadingSections) return; - void refreshThreads(); + refreshThreads(); }, [ loadingSections, refreshThreads, @@ -251,12 +251,12 @@ export function useForumBoard(scope: ForumBoardScope, forumSpace: Room) { if (loadingSections) return []; const roomScopes = scopesFromSelection(sections, filterQuery.category, filterQuery.topic); return roomScopes - .map((scope) => mx.getRoom(scope.roomId)) + .map((roomScope) => mx.getRoom(roomScope.roomId)) .filter((room): room is Room => room !== null); }, [loadingSections, sections, filterQuery.category, filterQuery.topic, mx]); useForumRoomLiveUpdates(scopedRooms, () => { - void refreshThreads({ silent: true }); + refreshThreads({ silent: true }); }); const selectedPostId = query.post ?? null; diff --git a/src/app/features/lobby/Lobby.tsx b/src/app/features/lobby/Lobby.tsx index d1a1a78a..9038969c 100644 --- a/src/app/features/lobby/Lobby.tsx +++ b/src/app/features/lobby/Lobby.tsx @@ -190,7 +190,7 @@ function SpaceCardLobby() { useEffect(() => { let cancelled = false; - void (async () => { + (async () => { try { const all = await fetchAllHierarchyRooms(mx, space.roomId, 3); if (cancelled) return; diff --git a/src/app/features/room-nav/CallParticipantsIndicator.tsx b/src/app/features/room-nav/CallParticipantsIndicator.tsx index b45a6a1c..97e96018 100644 --- a/src/app/features/room-nav/CallParticipantsIndicator.tsx +++ b/src/app/features/room-nav/CallParticipantsIndicator.tsx @@ -152,11 +152,7 @@ export function CallParticipantsIndicator({ roomId }: CallParticipantsIndicatorP size="50" style={{ opacity: config.opacity.P500, - color: isDeafened - ? 'var(--color-Critical-Main)' - : isMuted - ? 'var(--color-Critical-Main)' - : undefined, + color: isDeafened || isMuted ? 'var(--color-Critical-Main)' : undefined, }} /> diff --git a/src/app/features/room-nav/RoomNavItem.tsx b/src/app/features/room-nav/RoomNavItem.tsx index eb768326..9f907e45 100644 --- a/src/app/features/room-nav/RoomNavItem.tsx +++ b/src/app/features/room-nav/RoomNavItem.tsx @@ -365,13 +365,13 @@ export function RoomNavItem({ const avatarContent = avatarEvent?.getContent(); const avatarMxc = avatarContent && typeof avatarContent.url === 'string' ? avatarContent.url : undefined; - const avatarUrl = avatarMxc + const parentAvatarUrl = avatarMxc ? (mxcUrlToHttp(mx, avatarMxc, useAuthentication, 96, 96, 'crop') ?? undefined) : undefined; return { name: parentSpace.name, - avatarUrl, + avatarUrl: parentAvatarUrl, roomId: parentSpace.roomId, }; })(); diff --git a/src/app/features/room/Room.tsx b/src/app/features/room/Room.tsx index 2fae5ed5..c8a86ad5 100644 --- a/src/app/features/room/Room.tsx +++ b/src/app/features/room/Room.tsx @@ -71,43 +71,44 @@ export function Room() { ), ); + let mainView: React.ReactNode; + if (!showMediaSolo) { + if (showAppView) { + mainView = setPreferChat(true)} />; + } else if (forumRoom) { + mainView = ; + } else { + mainView = ( + + {hasAppUi && preferChat && ( + + Room app available + + + )} + + + + + ); + } + } + return ( - {!showMediaSolo && - (showAppView ? ( - setPreferChat(true)} /> - ) : forumRoom ? ( - - ) : ( - - {hasAppUi && preferChat && ( - - Room app available - - - )} - - - - - ))} + {mainView} {showMediaSolo && } {!showMediaSolo && showRightDrawer && ( <> diff --git a/src/app/features/room/RoomTimeline.tsx b/src/app/features/room/RoomTimeline.tsx index 2d4c933c..7977abb9 100644 --- a/src/app/features/room/RoomTimeline.tsx +++ b/src/app/features/room/RoomTimeline.tsx @@ -684,10 +684,10 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli ); const setReturnToEventId = useCallback( - (eventId: string | null) => { - if (eventId) setRoomReturnAnchor(room.roomId, eventId); + (targetEventId: string | null) => { + if (targetEventId) setRoomReturnAnchor(room.roomId, targetEventId); else clearRoomReturnAnchor(room.roomId); - setReturnToEventIdState(eventId); + setReturnToEventIdState(targetEventId); }, [room.roomId], ); @@ -1345,11 +1345,11 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli // Setup copy handler for better copy formatting (Name - Time: Message) useEffect(() => { - const getMessageData = (eventId: string) => { + const getMessageData = (messageEventId: string) => { const timelineSet = room.getUnfilteredTimelineSet(); - const evtTimeline = timelineSet.getTimelineForEvent(eventId); + const evtTimeline = timelineSet.getTimelineForEvent(messageEventId); if (!evtTimeline) return null; - const mEvent = evtTimeline.getEvents().find((e) => e.getId() === eventId); + const mEvent = evtTimeline.getEvents().find((e) => e.getId() === messageEventId); if (!mEvent) return null; const sender = getMemberDisplayName(room, mEvent.getSender() ?? '') ?? @@ -2231,13 +2231,11 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli `${senderName} ${startedWith} and ${opposite} ${cycles} times, then ${startedWith}`, ); } - } else { + } else if (cycles === 1) { // Ended on opposite action (equal joins/leaves or started-opposite pattern) - if (cycles === 1) { - summaryParts.push(`${senderName} ${startedWith}, then ${opposite}`); - } else { - summaryParts.push(`${senderName} ${startedWith} and ${opposite} ${cycles} times`); - } + summaryParts.push(`${senderName} ${startedWith}, then ${opposite}`); + } else { + summaryParts.push(`${senderName} ${startedWith} and ${opposite} ${cycles} times`); } } else if (joins > 1) { summaryParts.push(`${senderName} joined ${joins} times`); diff --git a/src/app/features/room/RoomViewHeader.tsx b/src/app/features/room/RoomViewHeader.tsx index 85f5d7ef..c3fe0a29 100644 --- a/src/app/features/room/RoomViewHeader.tsx +++ b/src/app/features/room/RoomViewHeader.tsx @@ -546,11 +546,12 @@ export function RoomViewHeader({ forumLayout = false }: RoomViewHeaderProps) { const searchParams: _SearchPathSearchParams = { rooms: room.roomId, }; - const path = space - ? getSpaceSearchPath(getCanonicalAliasOrRoomId(mx, space.roomId)) - : isDirect || onDirectPath - ? getDirectSearchPath() - : getHomeSearchPath(); + let path = getHomeSearchPath(); + if (space) { + path = getSpaceSearchPath(getCanonicalAliasOrRoomId(mx, space.roomId)); + } else if (isDirect || onDirectPath) { + path = getDirectSearchPath(); + } navigate(withSearchParam(path, searchParams)); }; diff --git a/src/app/features/room/emoji-confetti/findJumboMount.ts b/src/app/features/room/emoji-confetti/findJumboMount.ts index dcdbc420..74299bc6 100644 --- a/src/app/features/room/emoji-confetti/findJumboMount.ts +++ b/src/app/features/room/emoji-confetti/findJumboMount.ts @@ -36,11 +36,7 @@ export function measureJumboGlyph(targetEventId: string): JumboGlyphMetrics | nu 0; const isImg = glyph instanceof HTMLImageElement || glyph.tagName === 'IMG'; - const size = isImg - ? Math.max(rect.width, rect.height) - : fontSize > 0 - ? fontSize - : Math.max(rect.width, rect.height); + const size = isImg || fontSize <= 0 ? Math.max(rect.width, rect.height) : fontSize; return { mount, diff --git a/src/app/features/room/emoji-confetti/fireworkParticleEngine.ts b/src/app/features/room/emoji-confetti/fireworkParticleEngine.ts index 4679bacb..bb555f5c 100644 --- a/src/app/features/room/emoji-confetti/fireworkParticleEngine.ts +++ b/src/app/features/room/emoji-confetti/fireworkParticleEngine.ts @@ -340,11 +340,11 @@ export function createFireworkSim( const spawnPlan = buildSpawnPlan(profile, primaryEmoji, startMs); // Keep the spewing stand-in up for the whole fountain — not just a short flash. const lastSpawnAt = spawnPlan.length > 0 ? spawnPlan[spawnPlan.length - 1].atMs : startMs; - const heroUntilMs = profile.morphTo - ? profile.heroDurationMs != null - ? startMs + profile.heroDurationMs - : lastSpawnAt + 120 - : null; + let heroUntilMs = null; + if (profile.morphTo) { + heroUntilMs = + profile.heroDurationMs != null ? startMs + profile.heroDurationMs : lastSpawnAt + 120; + } return { particles: [], diff --git a/src/app/features/room/emoji-confetti/sendEmojiConfetti.ts b/src/app/features/room/emoji-confetti/sendEmojiConfetti.ts index feacda22..5341d6c5 100644 --- a/src/app/features/room/emoji-confetti/sendEmojiConfetti.ts +++ b/src/app/features/room/emoji-confetti/sendEmojiConfetti.ts @@ -30,10 +30,11 @@ export function sendEmojiConfettiEvent( mx: MatrixClient, roomId: string, targetEventId: string, - emojis: string[], + emojiList: string[], ) { const content: EmojiConfettiContent = { - emojis, + // emojis is the event content wire field + emojis: emojiList, msgtype: EMOJI_CONFETTI_EVENT_TYPE, target_event_id: targetEventId, }; diff --git a/src/app/features/room/message/Message.tsx b/src/app/features/room/message/Message.tsx index 3955623a..cb4dfdc5 100644 --- a/src/app/features/room/message/Message.tsx +++ b/src/app/features/room/message/Message.tsx @@ -901,14 +901,14 @@ export const Message = as<'div', MessageProps>( ); - const presenceClass = - senderPresence?.presence === Presence.Online - ? css.MessageAvatarOnline - : senderPresence?.presence === Presence.Unavailable - ? css.MessageAvatarUnavailable - : senderPresence?.presence === Presence.Offline - ? css.MessageAvatarOffline - : undefined; + let presenceClass; + if (senderPresence?.presence === Presence.Online) { + presenceClass = css.MessageAvatarOnline; + } else if (senderPresence?.presence === Presence.Unavailable) { + presenceClass = css.MessageAvatarUnavailable; + } else if (senderPresence?.presence === Presence.Offline) { + presenceClass = css.MessageAvatarOffline; + } const avatarJSX = !collapse && messageLayout !== MessageLayout.Compact && ( 0; + let navContent: React.ReactNode; + if (isSearching) { + if (searchResults.length > 0) { + navContent = searchResults.map(({ item }) => ( + + )); + } else { + navContent = ( + + + No settings match “{searchQuery.trim()}” + + + ); + } + } else { + navContent = menuItems.map((item) => ( + } + onClick={() => setActivePage(item.page)} + > + + {item.name} + + + )); + } + return ( -
- {isSearching ? ( - searchResults.length > 0 ? ( - searchResults.map(({ item }) => ( - - )) - ) : ( - - - No settings match “{searchQuery.trim()}” - - - ) - ) : ( - menuItems.map((item) => ( - - } - onClick={() => setActivePage(item.page)} - > - - {item.name} - - - )) - )} -
+
{navContent}
diff --git a/src/app/features/settings/account/Profile.tsx b/src/app/features/settings/account/Profile.tsx index 9dd520ab..39341106 100644 --- a/src/app/features/settings/account/Profile.tsx +++ b/src/app/features/settings/account/Profile.tsx @@ -390,9 +390,9 @@ function ProfileBanner({ setError(undefined); try { await mx.setAvatarUrl(upload.mxc); - const userId = mx.getUserId(); - if (userId) { - const user = mx.getUser(userId); + const currentUserId = mx.getUserId(); + if (currentUserId) { + const user = mx.getUser(currentUserId); if (user && user.avatarUrl !== upload.mxc) { user.setAvatarUrl(upload.mxc); } diff --git a/src/app/features/settings/audio/Audio.tsx b/src/app/features/settings/audio/Audio.tsx index 18dbdad2..68a2ae3d 100644 --- a/src/app/features/settings/audio/Audio.tsx +++ b/src/app/features/settings/audio/Audio.tsx @@ -771,6 +771,42 @@ export function Audio({ requestClose }: AudioProps) { settings.autoGainControl, ]); + let micVariant: 'Critical' | 'Success' | 'Secondary'; + if (micTestState === 'error') { + micVariant = 'Critical'; + } else if (micTestState === 'done') { + micVariant = 'Success'; + } else { + micVariant = 'Secondary'; + } + + let micLabel = 'Test'; + if (micTestState === 'testing') { + micLabel = 'Testing...'; + } else if (micTestState === 'done') { + micLabel = 'Done ✓'; + } else if (micTestState === 'error') { + micLabel = 'Failed'; + } + + let speakerVariant: 'Critical' | 'Success' | 'Secondary'; + if (speakerTestState === 'error') { + speakerVariant = 'Critical'; + } else if (speakerTestState === 'done') { + speakerVariant = 'Success'; + } else { + speakerVariant = 'Secondary'; + } + + let speakerLabel = 'Test'; + if (speakerTestState === 'testing') { + speakerLabel = 'Playing...'; + } else if (speakerTestState === 'done') { + speakerLabel = 'Done ✓'; + } else if (speakerTestState === 'error') { + speakerLabel = 'Failed'; + } + return ( @@ -833,27 +869,13 @@ export function Audio({ requestClose }: AudioProps) { } diff --git a/src/app/features/settings/developer-tools/DevelopTools.tsx b/src/app/features/settings/developer-tools/DevelopTools.tsx index eeef738e..24e6040d 100644 --- a/src/app/features/settings/developer-tools/DevelopTools.tsx +++ b/src/app/features/settings/developer-tools/DevelopTools.tsx @@ -98,9 +98,9 @@ export function DeveloperTools({ requestClose }: DeveloperToolsProps) { ); const handleProfileExpand = useCallback( - (expand: boolean) => { - setProfileExpand(expand); - if (expand) fetchProfileFields(profileUserId.trim()); + (expanded: boolean) => { + setProfileExpand(expanded); + if (expanded) fetchProfileFields(profileUserId.trim()); }, [fetchProfileFields, profileUserId], ); diff --git a/src/app/features/settings/notifications/SystemNotification.tsx b/src/app/features/settings/notifications/SystemNotification.tsx index 8413186c..4123ba2d 100644 --- a/src/app/features/settings/notifications/SystemNotification.tsx +++ b/src/app/features/settings/notifications/SystemNotification.tsx @@ -184,11 +184,12 @@ function AndroidPushNotifications() { const refresh = useCallback(async () => { setLoading(true); const s = await getBackgroundSyncStatus(); - const distributors = Array.isArray(s?.distributors) - ? s.distributors - : typeof s?.distributors === 'string' && s.distributors && s.distributors !== '[]' - ? [s.distributors] - : []; + let distributors: string[] = []; + if (Array.isArray(s?.distributors)) { + distributors = s.distributors; + } else if (typeof s?.distributors === 'string' && s.distributors && s.distributors !== '[]') { + distributors = [s.distributors]; + } setStatus( s ? { @@ -205,7 +206,7 @@ function AndroidPushNotifications() { }, []); useEffect(() => { - void refresh(); + refresh(); }, [refresh]); const [resetState, reset] = useAsyncCallback( diff --git a/src/app/features/settings/plugins/PluginLoader.tsx b/src/app/features/settings/plugins/PluginLoader.tsx index 8627e42e..f991b767 100644 --- a/src/app/features/settings/plugins/PluginLoader.tsx +++ b/src/app/features/settings/plugins/PluginLoader.tsx @@ -109,7 +109,7 @@ export function PluginLoader({ matrixClient, children }: PluginLoaderProps) { }; }, [matrixClient]); - return <>{children}; + return children; } /** diff --git a/src/app/features/space-settings/permissions/Permissions.tsx b/src/app/features/space-settings/permissions/Permissions.tsx index 14ad5dbb..3fc9e866 100644 --- a/src/app/features/space-settings/permissions/Permissions.tsx +++ b/src/app/features/space-settings/permissions/Permissions.tsx @@ -367,10 +367,8 @@ export function Permissions({ requestClose }: PermissionsProps) { have permission. {' '} - You don't have permission to edit { - nonSyncableChildren.length - } other{' '} - {nonSyncableChildren.length === 1 ? 'space/room' : 'spaces/rooms'} + You don't have permission to edit {nonSyncableChildren.length}{' '} + other {nonSyncableChildren.length === 1 ? 'space/room' : 'spaces/rooms'} {nonSyncableChildren.length <= 5 && ( <>: {nonSyncableChildren.map((c) => c.name).join(', ')} )} diff --git a/src/app/hooks/useAutoJoinSpaceRooms.ts b/src/app/hooks/useAutoJoinSpaceRooms.ts index 10c1f62c..166a005c 100644 --- a/src/app/hooks/useAutoJoinSpaceRooms.ts +++ b/src/app/hooks/useAutoJoinSpaceRooms.ts @@ -280,7 +280,7 @@ export function useAutoJoinOnSpaceVisit(space: Room | undefined): void { const spaceId = space.roomId; let cancelled = false; - void (async () => { + (async () => { try { await autoJoinSpaceChildren(mx, spaceId, (current, total) => { if (!cancelled) { diff --git a/src/app/hooks/useCommands.ts b/src/app/hooks/useCommands.ts index 91c4a824..70696f2c 100644 --- a/src/app/hooks/useCommands.ts +++ b/src/app/hooks/useCommands.ts @@ -112,7 +112,7 @@ export const parseTimestampFlag = (input: string): number | undefined => { const unit = match[2]; const now = Date.now(); // in milliseconds - let delta = 0; + let delta; switch (unit) { case 'd': diff --git a/src/app/hooks/useFilePasteHandler.ts b/src/app/hooks/useFilePasteHandler.ts index c0df2f58..26b554b0 100644 --- a/src/app/hooks/useFilePasteHandler.ts +++ b/src/app/hooks/useFilePasteHandler.ts @@ -25,7 +25,7 @@ export const useFilePasteHandler = (onPaste: (file: File[]) => void): ClipboardE // preventDefault before the async read, or the editor also inserts text. evt.preventDefault(); - void readClipboardImage().then((clipboardImage) => { + readClipboardImage().then((clipboardImage) => { if (clipboardImage) onPaste([clipboardImage]); }); }, diff --git a/src/app/hooks/useRoomMediaEvents.ts b/src/app/hooks/useRoomMediaEvents.ts index 518fe6de..217e462f 100644 --- a/src/app/hooks/useRoomMediaEvents.ts +++ b/src/app/hooks/useRoomMediaEvents.ts @@ -91,11 +91,7 @@ const toMediaItem = (mEvent: MatrixEvent): RoomMediaItem | undefined => { eventId, msgtype, thumbMxc, - thumbMimeType: usingThumbEnc - ? info?.thumbnail_info?.mimetype - : thumbMxc - ? info?.thumbnail_info?.mimetype - : undefined, + thumbMimeType: usingThumbEnc || thumbMxc ? info?.thumbnail_info?.mimetype : undefined, thumbEncInfo: usingThumbEnc ? thumbFile : undefined, fullMxc, fullMimeType: info?.mimetype, diff --git a/src/app/paarrot-api.ts b/src/app/paarrot-api.ts index da93e383..d1fbc8bd 100644 --- a/src/app/paarrot-api.ts +++ b/src/app/paarrot-api.ts @@ -182,15 +182,9 @@ function getCurrentRoomId(): string | null { try { // Get the pathname from URL // Support both normal routing and hash routing - let { pathname } = window.location; - - // If using hash router, parse from hash - if (window.location.hash) { - const hashMatch = window.location.hash.match(/#(.+)/); - if (hashMatch) { - pathname = hashMatch[1]; - } - } + const hashMatch = window.location.hash.match(/#(.+)/); + const [, hashPath] = hashMatch ?? []; + const pathname = hashPath ?? window.location.pathname; // URL patterns: // /home/:roomIdOrAlias/:eventId?/ diff --git a/src/app/pages/client/ClientNonUIFeatures.tsx b/src/app/pages/client/ClientNonUIFeatures.tsx index 743fd439..c2d78804 100644 --- a/src/app/pages/client/ClientNonUIFeatures.tsx +++ b/src/app/pages/client/ClientNonUIFeatures.tsx @@ -674,7 +674,7 @@ function AndroidShareIntentHandler() { return () => { mounted = false; - void listenerHandle?.remove(); + listenerHandle?.remove(); }; }, []); diff --git a/src/app/pages/client/sidebar/DirectTab.tsx b/src/app/pages/client/sidebar/DirectTab.tsx index 83d6d8b7..22e8b196 100644 --- a/src/app/pages/client/sidebar/DirectTab.tsx +++ b/src/app/pages/client/sidebar/DirectTab.tsx @@ -91,6 +91,14 @@ export function DirectTab() { return cords; }); }; + + let iconSrc = PaarrotSVG; + if (directUnread?.highlight) { + iconSrc = PaarrotHighlightSVG; + } else if (directUnread?.total) { + iconSrc = PaarrotUnreadSVG; + } + return ( @@ -102,13 +110,7 @@ export function DirectTab() { onContextMenu={handleContextMenu} > Direct Messages diff --git a/src/app/plugins/react-custom-html-parser.tsx b/src/app/plugins/react-custom-html-parser.tsx index 9030649a..41abd29c 100644 --- a/src/app/plugins/react-custom-html-parser.tsx +++ b/src/app/plugins/react-custom-html-parser.tsx @@ -295,8 +295,12 @@ export function CodeBlock({ children }: { children: ChildNode[] }) { const [override, setOverride] = useState(AUTO_LANGUAGE); const [menuCords, setMenuCords] = useState(); - const activeLanguage = - override === AUTO_LANGUAGE ? language : override === PLAIN_LANGUAGE ? undefined : override; + let activeLanguage: string | undefined = override; + if (override === AUTO_LANGUAGE) { + activeLanguage = language; + } else if (override === PLAIN_LANGUAGE) { + activeLanguage = undefined; + } const languageLabel = override === AUTO_LANGUAGE ? (language ?? 'Code') diff --git a/src/app/utils/backgroundSync.ts b/src/app/utils/backgroundSync.ts index 1eda57e2..30a05c1f 100644 --- a/src/app/utils/backgroundSync.ts +++ b/src/app/utils/backgroundSync.ts @@ -316,7 +316,7 @@ class AndroidUnifiedPushManager { } this.distributorSetupAttempted = true; - void this.tryRequestDistributorSetup(); + this.tryRequestDistributorSetup(); } /** Re-opens distributor selection once after ACTION_REQUIRED and logs actionable status. */ @@ -385,12 +385,12 @@ class AndroidUnifiedPushManager { this.listenerHandles = [ await MatrixBackgroundSync.addListener('unifiedPushNewEndpoint', (event) => { - void this.handleNewEndpoint(event).catch((err) => { + this.handleNewEndpoint(event).catch((err) => { console.error('[BackgroundSync] handleNewEndpoint failed:', err); }); }), await MatrixBackgroundSync.addListener('unifiedPushUnregistered', (event) => { - void this.handleUnregistered(event); + this.handleUnregistered(event); }), await MatrixBackgroundSync.addListener('unifiedPushRegistrationFailed', (event) => { this.handleRegistrationFailed(event); diff --git a/src/app/utils/common.ts b/src/app/utils/common.ts index c84a3bca..05411281 100644 --- a/src/app/utils/common.ts +++ b/src/app/utils/common.ts @@ -139,7 +139,7 @@ export const randomStr = (len = 12): string => { export const suffixRename = (name: string, validator: (newName: string) => boolean): string => { let suffix = 1; - let newName = name; + let newName; do { newName = name + suffix; suffix += 1; diff --git a/src/app/utils/copyHandler.ts b/src/app/utils/copyHandler.ts index 95767512..f88f8d25 100644 --- a/src/app/utils/copyHandler.ts +++ b/src/app/utils/copyHandler.ts @@ -68,9 +68,6 @@ export const setupCopyHandler = ( // Format the time const timeStr = timeHourMinute(data.ts, hour24Clock); - // Extract the selected text from within this message's content - let selectedText = ''; - // Create a range for this message's content const contentRange = document.createRange(); contentRange.selectNodeContents(contentEl); @@ -88,7 +85,8 @@ export const setupCopyHandler = ( extractRange.setEnd(contentRange.endContainer, contentRange.endOffset); } - selectedText = extractRange.toString().trim(); + // Extract the selected text from within this message's content + const selectedText = extractRange.toString().trim(); if (selectedText) { messages.push({ diff --git a/src/app/utils/discordCollectibles.ts b/src/app/utils/discordCollectibles.ts index 09efa34c..1cb2f9dc 100644 --- a/src/app/utils/discordCollectibles.ts +++ b/src/app/utils/discordCollectibles.ts @@ -289,14 +289,14 @@ export function groupCollectibleItems(items: DiscordCollectibleItem[]): Collecti return [...map.entries()] .map(([id, groupItems]) => { - const items = dedupeVariantItems(groupItems).sort((a, b) => + const sortedItems = dedupeVariantItems(groupItems).sort((a, b) => variantItemLabel(a).localeCompare(variantItemLabel(b)), ); return { id, - name: variantGroupDisplayName(items[0]), - category: items[0].category, - items, + name: variantGroupDisplayName(sortedItems[0]), + category: sortedItems[0].category, + items: sortedItems, }; }) .sort((a, b) => a.name.localeCompare(b.name)); diff --git a/src/app/utils/profileFields.ts b/src/app/utils/profileFields.ts index d03b6836..f12ffdc4 100644 --- a/src/app/utils/profileFields.ts +++ b/src/app/utils/profileFields.ts @@ -83,13 +83,14 @@ export function parseColorPreference(value: unknown): ColorPreference | undefine if (!value || typeof value !== 'object') return undefined; const obj = value as Record; - const on_dark = + const onDark = typeof obj.on_dark === 'string' && isValidHexColor(obj.on_dark) ? obj.on_dark : undefined; - const on_light = + const onLight = typeof obj.on_light === 'string' && isValidHexColor(obj.on_light) ? obj.on_light : undefined; - if (!on_dark && !on_light) return undefined; - return { on_dark, on_light }; + if (!onDark && !onLight) return undefined; + // on_dark/on_light are the MSC4522 wire keys, so the property names stay + return { on_dark: onDark, on_light: onLight }; } export function extractColorPreferenceFromProfile( @@ -128,10 +129,10 @@ export function extractBannerUrlFromProfile(profile: Record): s function parseStoredCollectible(value: unknown): StoredCollectible | undefined { if (!value || typeof value !== 'object') return undefined; const obj = value as Record; - const sku_id = typeof obj.sku_id === 'string' ? obj.sku_id : undefined; + const skuId = typeof obj.sku_id === 'string' ? obj.sku_id : undefined; const name = typeof obj.name === 'string' ? obj.name : undefined; const { assets } = obj; - if (!sku_id || !name || !assets || typeof assets !== 'object') return undefined; + if (!skuId || !name || !assets || typeof assets !== 'object') return undefined; const parsedAssets: Record = {}; Object.entries(assets as Record).forEach(([key, mxc]) => { @@ -142,7 +143,8 @@ function parseStoredCollectible(value: unknown): StoredCollectible | undefined { if (Object.keys(parsedAssets).length === 0) return undefined; return { - sku_id, + // sku_id is the Discord collectible wire key + sku_id: skuId, name, assets: parsedAssets, effect: obj.effect, diff --git a/src/app/utils/registerDesktopMediaSaver.ts b/src/app/utils/registerDesktopMediaSaver.ts index 93cb96fc..6b226174 100644 --- a/src/app/utils/registerDesktopMediaSaver.ts +++ b/src/app/utils/registerDesktopMediaSaver.ts @@ -44,6 +44,5 @@ export function registerDesktopMediaSaver(): void { registerMediaSaver(async (blob, filename) => { await saveWithElectron(blob, filename); }); - return; } } diff --git a/src/app/utils/tauri.ts b/src/app/utils/tauri.ts index 6ec5a9c7..5598c1de 100644 --- a/src/app/utils/tauri.ts +++ b/src/app/utils/tauri.ts @@ -134,7 +134,6 @@ export const focusWindow = async (): Promise => { if (electron?.window?.focus) { await electron.window.focus(); } - return; } catch (err) { console.warn('Failed to focus Electron window:', err); } @@ -426,12 +425,12 @@ export const readClipboardImage = async (): Promise => { if (electron?.clipboard?.readImage) { const result = await electron.clipboard.readImage(); // IPC may return a data URL string or { success, data } depending on path. - const dataUrl = - typeof result === 'string' - ? result - : result && typeof result === 'object' && typeof result.data === 'string' - ? result.data - : null; + let dataUrl = null; + if (typeof result === 'string') { + dataUrl = result; + } else if (result && typeof result === 'object' && typeof result.data === 'string') { + dataUrl = result.data; + } if (!dataUrl) return null; // Convert data URL to File