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,4 +1,11 @@
import React, { KeyboardEventHandler, useCallback, useEffect, useMemo, useRef, useState } from 'react';
import React, {
KeyboardEventHandler,
useCallback,
useEffect,
useMemo,
useRef,
useState,
} from 'react';
import classNames from 'classnames';
import { IconButton } from 'folds';
import { Icon, Icons } from '../../components/icons';
@@ -28,7 +35,11 @@ type ForumTopicSearchInputProps = {
type SuggestionMode = 'qualifier' | 'author' | 'title';
export function ForumTopicSearchInput({ value, onChange, threads = [] }: ForumTopicSearchInputProps) {
export function ForumTopicSearchInput({
value,
onChange,
threads = [],
}: ForumTopicSearchInputProps) {
const inputRef = useRef<HTMLInputElement>(null);
const mirrorRef = useRef<HTMLSpanElement>(null);
const pillsRef = useRef<HTMLDivElement>(null);
@@ -48,15 +59,14 @@ export function ForumTopicSearchInput({ value, onChange, threads = [] }: ForumTo
: TOPIC_SEARCH_QUALIFIERS;
const authorMatches = useMemo(
() =>
valueContext?.key === 'from' ? matchAuthorHints(valueContext.partial, authorHints) : [],
[authorHints, valueContext]
() => (valueContext?.key === 'from' ? matchAuthorHints(valueContext.partial, authorHints) : []),
[authorHints, valueContext],
);
const titleMatches = useMemo(
() =>
valueContext?.key === 'intitle' ? matchTitleHints(valueContext.partial, titleHints) : [],
[titleHints, valueContext]
[titleHints, valueContext],
);
const suggestionMode: SuggestionMode | null = useMemo(() => {
@@ -144,7 +154,7 @@ export function ForumTopicSearchInput({ value, onChange, threads = [] }: ForumTo
positionFloatingPills();
});
},
[onChange, positionFloatingPills]
[onChange, positionFloatingPills],
);
const insertQualifier = useCallback(
@@ -155,7 +165,7 @@ export function ForumTopicSearchInput({ value, onChange, threads = [] }: ForumTo
const { value: nextValue, cursor } = insertTopicSearchQualifierAt(value, caretPos, qualifier);
applyInputUpdate(nextValue, cursor);
},
[applyInputUpdate, value]
[applyInputUpdate, value],
);
const insertValue = useCallback(
@@ -166,7 +176,7 @@ export function ForumTopicSearchInput({ value, onChange, threads = [] }: ForumTo
const { value: nextValue, cursor } = insertTopicSearchValueAt(value, caretPos, replacement);
applyInputUpdate(nextValue, cursor);
},
[applyInputUpdate, value]
[applyInputUpdate, value],
);
const selectAtIndex = useCallback(
@@ -192,7 +202,7 @@ export function ForumTopicSearchInput({ value, onChange, threads = [] }: ForumTo
}
}
},
[authorMatches, insertQualifier, insertValue, qualifierMatches, suggestionMode, titleMatches]
[authorMatches, insertQualifier, insertValue, qualifierMatches, suggestionMode, titleMatches],
);
const selectHighlighted = useCallback(() => {
@@ -204,7 +214,7 @@ export function ForumTopicSearchInput({ value, onChange, threads = [] }: ForumTo
if (!suggestionCount) return;
setHighlightIndex((idx) => (idx + delta + suggestionCount) % suggestionCount);
},
[suggestionCount]
[suggestionCount],
);
const handleKeyDown: KeyboardEventHandler<HTMLInputElement> = (event) => {
@@ -259,8 +269,7 @@ export function ForumTopicSearchInput({ value, onChange, threads = [] }: ForumTo
? `title:${valueContext?.partial ?? ''}`
: `qualifier:${qualifierPartial}`;
const nextIndex =
tabKey === tabPartial ? (highlightIndex + 1) % suggestionCount : 0;
const nextIndex = tabKey === tabPartial ? (highlightIndex + 1) % suggestionCount : 0;
setTabPartial(tabKey);
setHighlightIndex(nextIndex);
selectAtIndex(nextIndex);