diff --git a/src/app/features/room/RoomTimeline.tsx b/src/app/features/room/RoomTimeline.tsx index 2302add0..4cb826d1 100644 --- a/src/app/features/room/RoomTimeline.tsx +++ b/src/app/features/room/RoomTimeline.tsx @@ -16,6 +16,7 @@ import { EventTimeline, EventTimelineSet, EventTimelineSetHandlerMap, + EventType, IContent, MatrixClient, MatrixEvent, @@ -1529,7 +1530,7 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli (reactions.find(eventWithShortcode)?.getContent().shortcode as string | undefined); mx.sendEvent( room.roomId, - MessageEvent.Reaction as any, + EventType.Reaction, getReactionContent(targetEventId, key, rShortcode), ); }, diff --git a/src/app/features/room/RoomViewTyping.tsx b/src/app/features/room/RoomViewTyping.tsx index 516a0085..13a2c0b7 100644 --- a/src/app/features/room/RoomViewTyping.tsx +++ b/src/app/features/room/RoomViewTyping.tsx @@ -50,7 +50,8 @@ export const RoomViewTyping = as<'div', RoomViewTypingProps>( // One verb for everyone keeps the joined form; mixed verbs need a clause per person const firstVerb = verbs[typers[0].userId]; const sameVerb = typers.every((typer) => verbs[typer.userId] === firstVerb); - const clauses = entries.map((entry) => ({ + const clauses = entries.map((entry, index) => ({ + key: entry.plural ? 'others' : typers[index].userId, name: entry.name, suffix: `${entry.plural ? 'are' : 'is'} ${entry.verb ?? DEFAULT_VERB}`, })); @@ -81,7 +82,7 @@ export const RoomViewTyping = as<'div', RoomViewTypingProps>( {clauses.map((clause, index) => ( - + {index > 0 && (index === clauses.length - 1 ? ' and ' : ', ')} {clause.name} {!sharedSuffix && ` ${clause.suffix}`} diff --git a/src/app/features/room/emoji-confetti/EmojiConfettiBurstCanvas.tsx b/src/app/features/room/emoji-confetti/EmojiConfettiBurstCanvas.tsx index 8b8573d1..6635739b 100644 --- a/src/app/features/room/emoji-confetti/EmojiConfettiBurstCanvas.tsx +++ b/src/app/features/room/emoji-confetti/EmojiConfettiBurstCanvas.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useMemo, useRef } from 'react'; +import React, { useCallback, useEffect, useMemo, useRef } from 'react'; import { createPortal } from 'react-dom'; import { EmojiConfettiBurst } from './types'; import { @@ -238,7 +238,7 @@ function LocalBurstCanvas({ burst, primaryEmoji, onComplete }: BurstCanvasProps) [burst.origin.maskRadius, canvasSize], ); - const updateLayerPosition = () => { + const updateLayerPosition = useCallback(() => { const layer = layerRef.current; if (!layer) return false; @@ -249,7 +249,7 @@ function LocalBurstCanvas({ burst, primaryEmoji, onComplete }: BurstCanvasProps) layer.style.left = `${rect.left + rect.width / 2 - canvasSize / 2}px`; layer.style.top = `${rect.top + rect.height / 2 - canvasSize / 2}px`; return true; - }; + }, [burst.targetEventId, canvasSize]); useEffect(() => { const onScrollOrResize = () => { @@ -263,7 +263,7 @@ function LocalBurstCanvas({ burst, primaryEmoji, onComplete }: BurstCanvasProps) window.removeEventListener('scroll', onScrollOrResize, true); window.removeEventListener('resize', onScrollOrResize); }; - }, [burst.targetEventId, canvasSize]); + }, [burst.targetEventId, canvasSize, updateLayerPosition]); useEffect(() => { if (!canvasRef.current || spawnedRef.current) return undefined; @@ -348,7 +348,7 @@ function LocalBurstCanvas({ burst, primaryEmoji, onComplete }: BurstCanvasProps) window.clearInterval(retry); frameCleanup?.(); }; - }, [burst.id, burst.targetEventId, canvasSize, localOrigin, primaryEmoji]); + }, [burst.id, burst.targetEventId, canvasSize, localOrigin, primaryEmoji, updateLayerPosition]); return createPortal(
{ return /\/feed\/?$/.test(pathname); }; -export const useSpaceLobbySelected = (_spaceIdOrAlias?: string): boolean => { +export const useSpaceLobbySelected = (): boolean => { const { pathname } = useLocation(); return /\/lobby\/?$/.test(pathname); }; -export const useSpaceSearchSelected = (_spaceIdOrAlias?: string): boolean => { +export const useSpaceSearchSelected = (): boolean => { const { pathname } = useLocation(); return /\/search\/?$/.test(pathname); }; diff --git a/src/app/paarrot-api.ts b/src/app/paarrot-api.ts index 94f7fc4c..a1dde03f 100644 --- a/src/app/paarrot-api.ts +++ b/src/app/paarrot-api.ts @@ -113,7 +113,7 @@ async function getStatus(matrixClient: MatrixClient) { /** * Toggle microphone mute */ -async function toggleMute(matrixClient: MatrixClient) { +async function toggleMute() { const callService = getCallService(); if (!callService) { @@ -173,7 +173,7 @@ async function setMute(matrixClient: MatrixClient, muted: boolean) { /** * Toggle deafen (mute speakers) */ -async function toggleDeafen(matrixClient: MatrixClient) { +async function toggleDeafen() { const callService = getCallService(); if (!callService) { @@ -590,7 +590,7 @@ export function initPaarrotAPI(matrixClient: MatrixClient) { break; case 'toggle-mute': - result = await toggleMute(matrixClient); + result = await toggleMute(); break; case 'set-mute': @@ -598,7 +598,7 @@ export function initPaarrotAPI(matrixClient: MatrixClient) { break; case 'toggle-deafen': - result = await toggleDeafen(matrixClient); + result = await toggleDeafen(); break; case 'set-deafen': diff --git a/src/app/pages/client/space/Space.tsx b/src/app/pages/client/space/Space.tsx index 6c2ca562..bb2a5220 100644 --- a/src/app/pages/client/space/Space.tsx +++ b/src/app/pages/client/space/Space.tsx @@ -323,8 +323,8 @@ export function Space() { const tombstoneEvent = useStateEvent(space, StateEvent.RoomTombstone); const selectedRoomId = useSelectedRoom(); - const lobbySelected = useSpaceLobbySelected(spaceIdOrAlias); - const searchSelected = useSpaceSearchSelected(spaceIdOrAlias); + const lobbySelected = useSpaceLobbySelected(); + const searchSelected = useSpaceSearchSelected(); const [closedCategories, setClosedCategories] = useAtom(useClosedNavCategoriesAtom()); diff --git a/src/app/utils/room.ts b/src/app/utils/room.ts index 1c648eb2..56e8326e 100644 --- a/src/app/utils/room.ts +++ b/src/app/utils/room.ts @@ -17,6 +17,7 @@ import { RoomMember, } from 'matrix-js-sdk'; import { CryptoBackend } from 'matrix-js-sdk/lib/common-crypto/CryptoBackend'; +import type { ReactionEventContent } from 'matrix-js-sdk/lib/@types/events'; import { IconName, IconSrc } from '../components/icons'; import { AccountDataEvent } from '../../types/matrix/accountData'; import { @@ -486,11 +487,15 @@ export const decryptAllTimelineEvent = async (mx: MatrixClient, timeline: EventT await Promise.allSettled(decryptionPromises); }; -export const getReactionContent = (eventId: string, key: string, shortcode?: string) => ({ +export const getReactionContent = ( + eventId: string, + key: string, + shortcode?: string, +): ReactionEventContent & { shortcode?: string } => ({ 'm.relates_to': { event_id: eventId, key, - rel_type: 'm.annotation', + rel_type: RelationType.Annotation, }, shortcode, });