feat(03-01): add SearchResults component with highlighting, scope toggle, and CommunicationHub integration

- Create SearchResults component with virtualized list, term highlighting via <mark>, keyboard navigation, loading/empty states
- Add search scope toggle (All Channels / This Channel) with radio group accessibility
- Integrate debounced (300ms) IPC search into CommunicationHub with stale response discard via requestId
- Update CommunicationSlice with search state (query, scope, results, loading, requestId)
- Modify FilterBar to accept scopeToggle prop and Escape key handler
- AnimatePresence cross-fade between SearchResults and MessageList views
This commit is contained in:
ZacharyZhang-NY committed 2026-03-22 14:34:35 -04:00
1 parent 43cb97ac6d
commit 7d5d1e5b30
4 files changed
+407 -12

No files matched your search

@@ -202,9 +202,13 @@ export interface FilterState {
export function FilterBar({
filters,
onChangeFilters,
scopeToggle,
onSearchKeyDown,
}: {
filters: FilterState
onChangeFilters: (next: FilterState) => void
scopeToggle?: React.ReactNode
onSearchKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void
}) {
const t = useT()
const [expanded, setExpanded] = useState(false)
@@ -218,11 +222,13 @@ export function FilterBar({
type="text"
value={filters.search}
onChange={(e) => onChangeFilters({ ...filters, search: e.target.value })}
onKeyDown={onSearchKeyDown}
placeholder={t("comm.searchMessages")}
className="w-full rounded-[6px] border border-[color:var(--line)] bg-[color:var(--panel)] py-1.5 pl-8 pr-3 text-[11px] text-[color:var(--text)] placeholder:text-[color:var(--muted)] focus:outline-none focus:ring-1"
style={{ focusRingColor: TERRACOTTA } as React.CSSProperties}
/>
</div>
{scopeToggle}
<button
type="button"
onClick={() => setExpanded(!expanded)}