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
@@ -1,11 +1,11 @@
import React, { RefObject, useEffect, useMemo, useRef } from 'react';
import { Text, Box, config, Spinner, IconButton, Line, toRem } from 'folds';
import { Icon, Icons } from '../../components/icons';
import { useAtomValue } from 'jotai';
import { useVirtualizer } from '@tanstack/react-virtual';
import { useInfiniteQuery } from '@tanstack/react-query';
import { useSearchParams } from 'react-router-dom';
import { SearchOrderBy } from 'matrix-js-sdk';
import { Icon, Icons } from '../../components/icons';
import { PageHero, PageHeroEmpty, PageHeroSection } from '../../components/page';
import { useMatrixClient } from '../../hooks/useMatrixClient';
import { _SearchPathSearchParams } from '../../pages/paths';
@@ -34,7 +34,7 @@ const useSearchPathSearchParams = (searchParams: URLSearchParams): _SearchPathSe
rooms: searchParams.get('rooms') ?? undefined,
senders: searchParams.get('senders') ?? undefined,
}),
[searchParams]
[searchParams],
);
type MessageSearchProps = {
@@ -58,7 +58,7 @@ export function MessageSearch({
// Include DMs — previously useRooms alone stripped them and broke DM search
const allRooms = useMemo(
() => [...nonDirectRooms, ...directRooms],
[nonDirectRooms, directRooms]
[nonDirectRooms, directRooms],
);
const [mediaAutoLoad] = useSetting(settingsAtom, 'mediaAutoLoad');
const [urlPreview] = useSetting(settingsAtom, 'urlPreview');
@@ -76,7 +76,7 @@ export function MessageSearch({
const searchParamRooms = useMemo(() => {
if (searchPathSearchParams.rooms) {
const joinedRoomIds = decodeSearchParamValueArray(searchPathSearchParams.rooms).filter(
(rId) => allRooms.includes(rId)
(rId) => allRooms.includes(rId),
);
return joinedRoomIds;
}
@@ -6,11 +6,27 @@ import React, {
useRef,
useState,
} from 'react';
import { Box, Chip, Text, Line, config, PopOut, Menu, MenuItem, Header, toRem, Scroll, Button, Input, Badge, RectCords } from 'folds';
import { Icon, Icons } from '../../components/icons';
import {
Box,
Chip,
Text,
Line,
config,
PopOut,
Menu,
MenuItem,
Header,
toRem,
Scroll,
Button,
Input,
Badge,
RectCords,
} from 'folds';
import { SearchOrderBy } from 'matrix-js-sdk';
import FocusTrap from 'focus-trap-react';
import { useVirtualizer } from '@tanstack/react-virtual';
import { Icon, Icons } from '../../components/icons';
import { useMatrixClient } from '../../hooks/useMatrixClient';
import { joinRuleToIconSrc } from '../../utils/room';
import { factoryRoomIdByAtoZ } from '../../utils/sort';
@@ -117,13 +133,13 @@ function SelectRoomButton({ roomList, selectedRooms, onChange }: SelectRoomButto
const getRoomNameStr: SearchItemStrGetter<string> = useCallback(
(rId) => mx.getRoom(rId)?.name ?? rId,
[mx]
[mx],
);
const [searchResult, _searchRoom, resetSearch] = useAsyncSearch(
roomList,
getRoomNameStr,
SEARCH_OPTS
SEARCH_OPTS,
);
const rooms = Array.from(searchResult?.items ?? roomList).sort(factoryRoomIdByAtoZ(mx));
@@ -2,6 +2,7 @@ import React, { FormEventHandler, RefObject } from 'react';
import { Box, Text, Input, Spinner, Chip, config } from 'folds';
import { Icon, Icons } from '../../components/icons';
type SearchProps = {
active?: boolean;
loading?: boolean;
@@ -3,8 +3,8 @@ import React, { MouseEventHandler, useMemo } from 'react';
import { IEventWithRoomId, JoinRule, RelationType, Room } from 'matrix-js-sdk';
import { HTMLReactParserOptions } from 'html-react-parser';
import { Avatar, Box, Chip, Header, Text, config } from 'folds';
import { Icon, Icons } from '../../components/icons';
import { Opts as LinkifyOpts } from 'linkifyjs';
import { Icon, Icons } from '../../components/icons';
import { useMatrixClient } from '../../hooks/useMatrixClient';
import {
factoryRenderLinkifyWithMention,
@@ -62,7 +62,9 @@ type SearchResultItemProps = {
item: ResultItem;
getMemberPowerTag: ReturnType<typeof useGetMemberPowerTag>;
accessibleTagColors: Map<string, string> | undefined;
renderMatrixEvent: ReturnType<typeof useMatrixEventRenderer<[IEventWithRoomId, string, GetContentCallback]>>;
renderMatrixEvent: ReturnType<
typeof useMatrixEventRenderer<[IEventWithRoomId, string, GetContentCallback]>
>;
handleOpenClick: MouseEventHandler;
legacyUsernameColor?: boolean;
hour24Clock: boolean;
@@ -88,21 +90,17 @@ function SearchResultItem({
const { event } = item;
const displayName =
getMemberDisplayName(room, event.sender) ??
getMxIdLocalPart(event.sender) ??
event.sender;
getMemberDisplayName(room, event.sender) ?? getMxIdLocalPart(event.sender) ?? event.sender;
const senderAvatarMxc = getMemberAvatarMxc(room, event.sender);
const relation = event.content['m.relates_to'];
const mainEventId =
relation?.rel_type === RelationType.Replace ? relation.event_id : event.event_id;
const getContent = (() =>
event.content['m.new_content'] ?? event.content) as GetContentCallback;
const getContent = (() => event.content['m.new_content'] ?? event.content) as GetContentCallback;
const replyEventId = relation?.['m.in_reply_to']?.event_id;
const threadRootId =
relation?.rel_type === RelationType.Thread ? relation.event_id : undefined;
const threadRootId = relation?.rel_type === RelationType.Thread ? relation.event_id : undefined;
// Get custom user color from avatar metadata
const customUserColor = useOtherUserColor(event.sender, room);
@@ -116,7 +114,8 @@ function SearchResultItem({
: undefined;
// Priority: custom user color > tag color (non-legacy) > colorMXID (legacy)
const usernameColor = customUserColor ?? (legacyUsernameColor ? colorMXID(event.sender) : tagColor);
const usernameColor =
customUserColor ?? (legacyUsernameColor ? colorMXID(event.sender) : tagColor);
return (
<SequenceCard
@@ -133,14 +132,8 @@ function SearchResultItem({
userId={event.sender}
src={
senderAvatarMxc
? mxcUrlToHttp(
mx,
senderAvatarMxc,
useAuthentication,
48,
48,
'crop'
) ?? undefined
? (mxcUrlToHttp(mx, senderAvatarMxc, useAuthentication, 48, 48, 'crop') ??
undefined)
: undefined
}
alt={displayName}
@@ -237,10 +230,10 @@ export function SearchResultGroup({
() => ({
...LINKIFY_OPTS,
render: factoryRenderLinkifyWithMention((href) =>
renderMatrixMention(mx, room.roomId, href, makeMentionCustomProps(mentionClickHandler))
renderMatrixMention(mx, room.roomId, href, makeMentionCustomProps(mentionClickHandler)),
),
}),
[mx, room, mentionClickHandler]
[mx, room, mentionClickHandler],
);
const htmlReactParserOptions = useMemo<HTMLReactParserOptions>(
() =>
@@ -259,7 +252,7 @@ export function SearchResultGroup({
mentionClickHandler,
spoilerClickHandler,
useAuthentication,
]
],
);
const renderMatrixEvent = useMatrixEventRenderer<[IEventWithRoomId, string, GetContentCallback]>(
@@ -326,7 +319,7 @@ export function SearchResultGroup({
</Text>
</Box>
);
}
},
);
const handleOpenClick: MouseEventHandler = (evt) => {
@@ -104,8 +104,7 @@ const getSearchableBody = (event: MatrixEvent): string | undefined => {
}
const body = typeof content.body === 'string' ? content.body : undefined;
const formatted =
typeof content.formatted_body === 'string' ? content.formatted_body : undefined;
const formatted = typeof content.formatted_body === 'string' ? content.formatted_body : undefined;
return [body, formatted].filter(Boolean).join('\n') || undefined;
};
@@ -233,7 +232,7 @@ export const useMessageSearch = (params: MessageSearchParams) => {
return searchLocalRooms(
mx,
scopedRooms.filter((id) => isEncryptedRoom(mx, id)),
term
term,
);
}
@@ -245,7 +244,7 @@ export const useMessageSearch = (params: MessageSearchParams) => {
throw new Error('Message search failed');
}
},
[mx, term, order, rooms, senders]
[mx, term, order, rooms, senders],
);
return searchMessages;