Apply the auto-fixable lint rules and the formatter, and drop the Vite build artifacts.
Checks / checks (push) Successful in 2m11s
Trigger cinny-mobile / dispatch (push) Successful in 1s

This commit is contained in:
2026-11-01 04:23:53 +11:00
parent 3cd159a63e
commit a6ad8651b3
605 changed files with 11480 additions and 9125 deletions
+10 -8
View File
@@ -5,7 +5,7 @@ import { MatrixClient, MatrixEvent, Room, RoomEvent, IRoomTimelineData } from 'm
* Hook that tracks timeline events across all rooms to trigger re-sorting of room lists.
* Returns a counter that increments whenever a message is sent or received in any room.
* This can be used as a dependency in useMemo to trigger re-sorting of room lists.
*
*
* @param mx - The Matrix client instance
* @param roomIds - Optional array of room IDs to track. If not provided, tracks all rooms.
* @returns A number that increments on each timeline event
@@ -19,18 +19,18 @@ export const useRoomListReorder = (mx: MatrixClient, roomIds?: string[]): number
room: Room | undefined,
toStartOfTimeline: boolean | undefined,
removed: boolean,
data: IRoomTimelineData
data: IRoomTimelineData,
) => {
if (!room || !data.liveEvent) return;
if (toStartOfTimeline) return;
if (roomIds && !roomIds.includes(room.roomId)) return;
setUpdateCounter((prev) => prev + 1);
};
mx.on(RoomEvent.Timeline, handleTimelineEvent);
return () => {
mx.removeListener(RoomEvent.Timeline, handleTimelineEvent);
};
@@ -42,12 +42,12 @@ export const useRoomListReorder = (mx: MatrixClient, roomIds?: string[]): number
/**
* Hook that implements FLIP (First, Last, Invert, Play) animation for list reordering.
* Tracks element positions before and after reorder, then animates the difference.
*
*
* @param items - Array of item IDs in their current order
* @returns Ref callback to attach to the list container
*/
export const useListReorderAnimation = <T extends string>(
items: T[]
items: T[],
): React.RefCallback<HTMLElement> => {
const positionsRef = useRef<Map<T, number>>(new Map());
const containerRef = useRef<HTMLElement | null>(null);
@@ -59,7 +59,9 @@ export const useListReorderAnimation = <T extends string>(
const elements = new Map<T, HTMLElement>();
items.forEach((itemId) => {
const element = containerRef.current!.querySelector(`[data-room-id="${itemId}"]`) as HTMLElement;
const element = containerRef.current!.querySelector(
`[data-room-id="${itemId}"]`,
) as HTMLElement;
if (element) {
currentPositions.set(itemId, element.offsetTop);
elements.set(itemId, element);