Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

ThreadNavigationSidebar.tsx

1,289 lines47.7 KB

1import type {
2 EnvironmentProject,
3 EnvironmentThreadShell,
4} from "@t3tools/client-runtime/state/shell";
5import {
6 threadSearchMatchKey,
7 type EnvironmentThreadSearchMatch,
8} from "@t3tools/client-runtime/state/thread-search";
9import { LegendList } from "@legendapp/list/react-native";
10import type { MenuAction } from "@react-native-menu/menu";
11import { useAtomValue } from "@effect/atom-react";
12import type { EnvironmentId } from "@t3tools/contracts";
13import { sortPinnedThreadsByOrderKey } from "@t3tools/client-runtime/state/thread-sort";
14import { useCallback, useEffect, useMemo, useRef, useState } from "react";
15import type { LayoutChangeEvent } from "react-native";
16import { Platform, Pressable, StyleSheet, TextInput, View } from "react-native";
17import { Gesture, GestureDetector } from "react-native-gesture-handler";
18import type { SwipeableMethods } from "react-native-gesture-handler/ReanimatedSwipeable";
19import { useSafeAreaInsets } from "react-native-safe-area-context";
20import type { SearchBarCommands } from "react-native-screens";
21​
22import { AppText as Text } from "../../components/AppText";
23import { CompactBrandTitle } from "../../components/CompactBrandTitle";
24import { ControlPillMenu } from "../../components/ControlPill";
25import { SymbolView } from "../../components/AppSymbol";
26import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
27import { NativeStackScreenOptions } from "../../native/StackHeader";
28import { scopedProjectKey, scopedThreadKey } from "../../lib/scopedEntities";
29import { useProjects, useThreadShells } from "../../state/entities";
30import { useThreadSearch } from "../../state/queries";
31import { useThreadListV2Enabled } from "./use-thread-list-v2-enabled";
32import { useThreadListV2ShelfPreferences } from "./use-thread-list-v2-shelf-preferences";
33import { environmentServerConfigsAtom } from "../../state/server";
34import { usePendingNewTasks } from "../../state/use-pending-new-tasks";
35import { useWorkspaceState } from "../../state/workspace";
36import { useSavedRemoteConnections } from "../../state/use-remote-environment-registry";
37import { useHardwareKeyboardCommand } from "../keyboard/hardwareKeyboardCommands";
38import {
39 hasCustomHomeListOptions,
40 PROJECT_SORT_OPTIONS,
41 THREAD_SORT_OPTIONS,
42 useHomeListOptions,
43} from "../home/home-list-options";
44import { buildHomeListFilterMenu } from "../home/home-list-filter-menu";
45import {
46 buildHomeListLayout,
47 DEFAULT_GROUP_DISPLAY_STATE,
48 homeListItemsAreEqual,
49 nextGroupDisplayState,
50 type HomeGroupDisplayAction,
51 type HomeGroupDisplayState,
52 type HomeListItem,
53} from "../home/homeListItems";
54import { buildHomeProjectScopes, buildHomeThreadGroups } from "../home/homeThreadList";
55import { SwipeableScrollGateProvider, useSwipeableScrollGate } from "../home/thread-swipe-actions";
56import { usePendingTaskListActions } from "../home/usePendingTaskListActions";
57import { useThreadListActions } from "../home/useThreadListActions";
58import {
59 getConnectionAwareBrandHeaderOptions,
60 WorkspaceConnectionTitle,
61} from "../home/WorkspaceConnectionTitle";
62import { SidebarHeaderActions } from "./sidebar-header-actions";
63import { SidebarFilterButton } from "./sidebar-filter-button";
64import { createSidebarHeaderItems } from "./sidebar-native-header-items";
65import { SidebarNavigationShell } from "./sidebar-navigation-shell";
66import {
67 PendingTaskListRow,
68 ThreadListGroupHeader,
69 ThreadListRow,
70 ThreadListShowMoreRow,
71} from "./thread-list-items";
72import {
73 ThreadListV2PendingRow,
74 ThreadListV2Row,
75 ThreadListV2SettledShelfHeader,
76 ThreadListV2SnoozedShelfHeader,
77} from "./thread-list-v2-items";
78import {
79 buildThreadListV2Items,
80 buildThreadListV2ListItems,
81 THREAD_LIST_V2_SETTLED_INITIAL_COUNT,
82 THREAD_LIST_V2_SETTLED_PAGE_COUNT,
83 type ThreadListV2ListItem,
84} from "./threadListV2";
85​
86/** The sidebar list serves both lists: v1 grouped items or, when the Thread
87 List v2 beta is on, flat v2 rows with queued tasks spliced in, and a settled
88 "Show more" pager. */
89type SidebarListItem =
90 | HomeListItem
91 | ThreadListV2ListItem
92 | { readonly type: "v2-show-more"; readonly key: string; readonly hiddenCount: number };
93​
94const SIDEBAR_STICKY_HEADER_HEIGHT = 106;
95​
96interface ThreadNavigationSidebarProps {
97 readonly width: number;
98 readonly visible: boolean;
99 readonly selectedThreadKey: string | null;
100 readonly onOpenSettings: () => void;
101 readonly onOpenEnvironmentSettings: () => void;
102 readonly onNewThreadInProject: (project: EnvironmentProject) => void;
103 readonly onSearchQueryChange: (query: string) => void;
104 readonly onSelectThread: (thread: EnvironmentThreadShell) => void;
105 readonly onRequestVisibility: () => void;
106 readonly searchQuery: string;
108​
109/**
110 * iPad/large-width sidebar column.
111 *
112 * On iOS the pane is hosted inside its own navigation-inert single-screen
113 * native stack (SidebarNavigationShell) so the header is a real
114 * UINavigationBar: large title, native bar-button items, and a
115 * UISearchController search field — the same chrome a UISplitViewController
116 * column gets. Other platforms keep the custom header chrome.
117 */
118export function ThreadNavigationSidebar(props: ThreadNavigationSidebarProps) {
119 if (Platform.OS !== "ios") {
120 return <ThreadNavigationSidebarPane {...props} nativeChrome={false} />;
121 }
122 return <NativeSidebarContainer {...props} />;
124​
125function NativeSidebarContainer(props: ThreadNavigationSidebarProps) {
126 return (
127 <View
128 testID="thread-navigation-sidebar"
129 className="flex-1 border-border bg-drawer"
130 style={{ borderRightWidth: StyleSheet.hairlineWidth, width: props.width }}
131 >
132 <SidebarNavigationShell>
133 <ThreadNavigationSidebarPane {...props} nativeChrome />
134 </SidebarNavigationShell>
135 </View>
136 );
138​
139function ThreadNavigationSidebarPane(
140 props: ThreadNavigationSidebarProps & { readonly nativeChrome: boolean },
141) {
142 const insets = useSafeAreaInsets();
143 const projects = useProjects();
144 const threads = useThreadShells();
145 const { environments: workspaceEnvironments, state: catalogState } = useWorkspaceState();
146 const { savedConnectionsById } = useSavedRemoteConnections();
147 const searchInputRef = useRef<TextInput>(null);
148 const searchBarRef = useRef<SearchBarCommands>(null);
149 const openSwipeableRef = useRef<SwipeableMethods | null>(null);
150 const sidebarScrollGesture = useMemo(() => Gesture.Native(), []);
151 const {
152 archiveThread,
153 confirmDeleteThread,
154 settleThread,
155 snoozeThread,
156 unsnoozeThread,
157 unsettleThread,
158 pinThread,
159 unpinThread,
160 movePinnedThread,
161 regenerateThreadTitle,
162 } = useThreadListActions();
163 const threadListV2Enabled = useThreadListV2Enabled();
164 const pendingTasks = usePendingNewTasks();
165 const { openPendingTask, confirmDeletePendingTask } = usePendingTaskListActions();
166 const environments = useMemo(
167 () =>
168 Object.values(savedConnectionsById)
169 .map((connection) => ({
170 environmentId: connection.environmentId,
171 label: connection.environmentLabel,
172 }))
173 .sort((left, right) => left.label.localeCompare(right.label)),
174 [savedConnectionsById],
175 );
176 const availableEnvironmentIds = useMemo(
177 () => new Set(environments.map((environment) => environment.environmentId)),
178 [environments],
179 );
180 const { options, setSelectedEnvironmentId, setProjectSortOrder, setThreadSortOrder } =
181 useHomeListOptions(availableEnvironmentIds);
182 const searchEnvironmentIds = useMemo(
183 () =>
184 options.selectedEnvironmentId === null
185 ? workspaceEnvironments
186 .filter((environment) => environment.connectionState === "connected")
187 .map((environment) => environment.environmentId)
188 : workspaceEnvironments.some(
189 (environment) =>
190 environment.environmentId === options.selectedEnvironmentId &&
191 environment.connectionState === "connected",
192 )
193 ? [options.selectedEnvironmentId]
194 : [],
195 [options.selectedEnvironmentId, workspaceEnvironments],
196 );
197 const threadSearch = useThreadSearch(searchEnvironmentIds, props.searchQuery);
198 const threadSearchMatchByKey = useMemo(() => {
199 const matches = new Map<string, EnvironmentThreadSearchMatch>();
200 for (const match of threadSearch.matches) {
201 if (match.source === "user" || match.source === "assistant") {
202 matches.set(threadSearchMatchKey(match), match);
203 }
204 }
205 return matches;
206 }, [threadSearch.matches]);
207 const matchedThreadKeys = useMemo(
208 () => new Set(threadSearch.matches.map(threadSearchMatchKey)),
209 [threadSearch.matches],
210 );
211 const [selectedProjectKey, setSelectedProjectKey] = useState<string | null>(null);
212 const projectScopes = useMemo(
213 () =>
214 buildHomeProjectScopes({
215 projects,
216 environmentId: options.selectedEnvironmentId,
217 projectGroupingMode: options.projectGroupingMode,
218 }),
219 [options.projectGroupingMode, options.selectedEnvironmentId, projects],
220 );
221 const projectFilterOptions = useMemo(
222 () =>
223 projectScopes.map((scope) => ({
224 key: scope.key,
225 label: scope.title,
226 })),
227 [projectScopes],
228 );
229 const projectTitleByProjectKey = useMemo(
230 () =>
231 new Map(
232 projectScopes.flatMap((scope) =>
233 scope.projectRefs.map(
234 (projectRef) =>
235 [
236 scopedProjectKey(projectRef.environmentId, projectRef.projectId),
237 scope.title,
238 ] as const,
239 ),
240 ),
241 ),
242 [projectScopes],
243 );
244 const selectedProjectScope = useMemo(
245 () =>
246 selectedProjectKey === null
247 ? null
248 : (projectScopes.find((scope) => scope.key === selectedProjectKey) ?? null),
249 [projectScopes, selectedProjectKey],
250 );
251 useEffect(() => {
252 if (
253 selectedProjectKey !== null &&
254 !projectFilterOptions.some((project) => project.key === selectedProjectKey)
255 ) {
256 setSelectedProjectKey(null);
257 }
258 }, [projectFilterOptions, selectedProjectKey]);
259 const selectedProjectRefs = useMemo(
260 () =>
261 selectedProjectScope === null
262 ? null
263 : new Set(
264 selectedProjectScope.projectRefs.map((projectRef) =>
265 scopedProjectKey(projectRef.environmentId, projectRef.projectId),
266 ),
267 ),
268 [selectedProjectScope],
269 );
270 const scopedProjects = useMemo(
271 () =>
272 selectedProjectRefs === null
273 ? projects
274 : projects.filter((project) =>
275 selectedProjectRefs.has(scopedProjectKey(project.environmentId, project.id)),
276 ),
277 [projects, selectedProjectRefs],
278 );
279 const scopedThreads = useMemo(
280 () =>
281 selectedProjectRefs === null
282 ? threads
283 : threads.filter((thread) =>
284 selectedProjectRefs.has(scopedProjectKey(thread.environmentId, thread.projectId)),
285 ),
286 [selectedProjectRefs, threads],
287 );
288 const scopedPendingTasks = useMemo(
289 () =>
290 selectedProjectRefs === null
291 ? pendingTasks
292 : pendingTasks.filter((pendingTask) =>
293 selectedProjectRefs.has(
294 scopedProjectKey(pendingTask.message.environmentId, pendingTask.creation.projectId),
295 ),
296 ),
297 [pendingTasks, selectedProjectRefs],
298 );
299 const groups = useMemo(
300 () =>
301 buildHomeThreadGroups({
302 projects: scopedProjects,
303 threads: scopedThreads,
304 pendingTasks: scopedPendingTasks,
305 environmentId: options.selectedEnvironmentId,
306 searchQuery: props.searchQuery,
307 matchedThreadKeys,
308 projectSortOrder: options.projectSortOrder,
309 threadSortOrder: options.threadSortOrder,
310 projectGroupingMode: options.projectGroupingMode,
311 }),
312 [
313 matchedThreadKeys,
314 options,
315 props.searchQuery,
316 scopedPendingTasks,
317 scopedProjects,
318 scopedThreads,
319 ],
320 );
321 const [groupDisplayStates, setGroupDisplayStates] = useState<
322 ReadonlyMap<string, HomeGroupDisplayState>
323 >(() => new Map());
324 const updateGroupDisplay = useCallback((key: string, action: HomeGroupDisplayAction) => {
325 setGroupDisplayStates((previous) => {
326 const next = new Map(previous);
327 next.set(
328 key,
329 nextGroupDisplayState(previous.get(key) ?? DEFAULT_GROUP_DISPLAY_STATE, action),
330 );
331 return next;
332 });
333 }, []);
334 const hasSearchQuery = props.searchQuery.trim().length > 0;
335 const listLayout = useMemo(
336 () =>
337 buildHomeListLayout({
338 groups,
339 displayStates: groupDisplayStates,
340 showAllThreads: hasSearchQuery,
341 }),
342 [groups, groupDisplayStates, hasSearchQuery],
343 );
344 const projectCwdByKey = useMemo(() => {
345 const map = new Map<string, string>();
346 for (const project of projects) {
347 map.set(scopedProjectKey(project.environmentId, project.id), project.workspaceRoot);
348 }
349 return map;
350 }, [projects]);
351 const projectByKey = useMemo(() => {
352 const map = new Map<string, EnvironmentProject>();
353 for (const project of projects) {
354 map.set(scopedProjectKey(project.environmentId, project.id), project);
355 }
356 return map;
357 }, [projects]);
358​
359 // Thread List v2 (beta) support — same model as the compact Home list
360 // (HomeScreen.tsx): flat creation-order card block + settled recency tail.
361 // The settled tail renders in pages; expansion resets when the filter
362 // context changes so environment/search flips never inherit a deep page.
363 const [settledVisibleCount, setSettledVisibleCount] = useState(
364 THREAD_LIST_V2_SETTLED_INITIAL_COUNT,
365 );
366 const settledResetKey = `${options.selectedEnvironmentId ?? "all"}:${selectedProjectKey ?? "all"}:${props.searchQuery.trim()}`;
367 const lastSettledResetKeyRef = useRef(settledResetKey);
368 if (lastSettledResetKeyRef.current !== settledResetKey) {
369 lastSettledResetKeyRef.current = settledResetKey;
370 setSettledVisibleCount(THREAD_LIST_V2_SETTLED_INITIAL_COUNT);
371 }
372 const showMoreSettled = useCallback(
373 () => setSettledVisibleCount((count) => count + THREAD_LIST_V2_SETTLED_PAGE_COUNT),
374 [],
375 );
376 const {
377 loaded: shelfPreferencesLoaded,
378 settledShelfExpanded,
379 snoozedShelfExpanded,
380 toggleSettledShelf,
381 toggleSnoozedShelf,
382 } = useThreadListV2ShelfPreferences();
383 // The queued-start and snooze helpers need a clock while the pane stays open.
384 const [nowMinute, setNowMinute] = useState(() => new Date().toISOString().slice(0, 16));
385 // Snooze wake times are second-precise; a counter bumped exactly at the
386 // next wake boundary re-runs the partition with a fresh clock so a woken
387 // thread reappears immediately instead of on the next minute tick.
388 const [snoozeWakeTick, bumpSnoozeWakeTick] = useState(0);
389 useEffect(() => {
390 if (!threadListV2Enabled) return;
391 // Refresh immediately because the mount-time value can be hours old.
392 setNowMinute(new Date().toISOString().slice(0, 16));
393 const id = setInterval(() => setNowMinute(new Date().toISOString().slice(0, 16)), 60_000);
394 return () => clearInterval(id);
395 }, [threadListV2Enabled]);
396 // Threads on servers without the settlement capability never classify as
397 // settled (the user could neither un-settle nor pin them).
398 const serverConfigs = useAtomValue(environmentServerConfigsAtom);
399 const settlementEnvironmentIds = useMemo(() => {
400 const supported = new Set<EnvironmentId>();
401 for (const [environmentId, config] of serverConfigs) {
402 if (config.environment.capabilities.threadSettlement === true) {
403 supported.add(environmentId);
404 }
405 }
406 return supported;
407 }, [serverConfigs]);
408 const snoozeEnvironmentIds = useMemo(() => {
409 const supported = new Set<EnvironmentId>();
410 for (const [environmentId, config] of serverConfigs) {
411 if (config.environment.capabilities.threadSnooze === true) {
412 supported.add(environmentId);
413 }
414 }
415 return supported;
416 }, [serverConfigs]);
417 const pinningEnvironmentIds = useMemo(() => {
418 const supported = new Set<EnvironmentId>();
419 for (const [environmentId, config] of serverConfigs) {
420 if (config.environment.capabilities.threadPinning === true) {
421 supported.add(environmentId);
422 }
423 }
424 return supported;
425 }, [serverConfigs]);
426 const pinReorderEnvironmentIds = useMemo(() => {
427 const supported = new Set<EnvironmentId>();
428 for (const [environmentId, config] of serverConfigs) {
429 if (config.environment.capabilities.threadPinReorder === true) {
430 supported.add(environmentId);
431 }
432 }
433 return supported;
434 }, [serverConfigs]);
435 const titleRegenerationEnvironmentIds = useMemo(() => {
436 const supported = new Set<EnvironmentId>();
437 for (const [environmentId, config] of serverConfigs) {
438 if (config.environment.capabilities.threadTitleRegeneration === true) {
439 supported.add(environmentId);
440 }
441 }
442 return supported;
443 }, [serverConfigs]);
444 // Canonical arranged pinned order for Move up/down flags — computed from
445 // all shells so search/scope filtering never disables a valid move.
446 const arrangedPinnedKeys = useMemo(() => {
447 const pinned = sortPinnedThreadsByOrderKey(
448 threads.filter(
449 (thread) =>
450 thread.pinnedAt != null &&
451 thread.archivedAt === null &&
452 pinReorderEnvironmentIds.has(thread.environmentId),
453 ),
454 );
455 return pinned.map((thread) => `${thread.environmentId}:${thread.id}`);
456 }, [pinReorderEnvironmentIds, threads]);
457 const threadListV2Layout = useMemo(() => {
458 if (!threadListV2Enabled)
459 return {
460 items: [],
461 hiddenSettledCount: 0,
462 snoozedCount: 0,
463 snoozedShelfHeaderIndex: null,
464 settledCount: 0,
465 settledShelfHeaderIndex: null,
466 nextSnoozeWakeAt: null,
467 };
468 return buildThreadListV2Items({
469 threads: threads.filter((thread) => thread.archivedAt === null),
470 environmentId: options.selectedEnvironmentId,
471 projectRefs: selectedProjectScope === null ? null : selectedProjectScope.projectRefs,
472 searchQuery: props.searchQuery,
473 matchedThreadKeys,
474 settlementEnvironmentIds,
475 snoozeEnvironmentIds,
476 settledLimit: settledVisibleCount,
477 now: new Date().toISOString(),
478 snoozedShelfExpanded,
479 settledShelfExpanded,
480 selectedThreadKey: props.selectedThreadKey ?? null,
481 });
482 }, [
483 nowMinute,
484 snoozeWakeTick,
485 snoozedShelfExpanded,
486 settledShelfExpanded,
487 props.selectedThreadKey,
488 options.selectedEnvironmentId,
489 props.searchQuery,
490 matchedThreadKeys,
491 settledVisibleCount,
492 settlementEnvironmentIds,
493 snoozeEnvironmentIds,
494 threadListV2Enabled,
495 threads,
496 selectedProjectScope,
497 ]);
498 // Re-partition the moment the earliest snooze expires (clamped to the
499 // signed-32-bit setTimeout range; far-future wakes re-arm at the clamp).
500 const nextSnoozeWakeAt = threadListV2Layout.nextSnoozeWakeAt;
501 useEffect(() => {
502 if (nextSnoozeWakeAt === null) return;
503 const wakeAtMs = Date.parse(nextSnoozeWakeAt);
504 if (Number.isNaN(wakeAtMs)) return;
505 const delayMs = Math.min(Math.max(0, wakeAtMs - Date.now()) + 50, 2_147_483_647);
506 const id = setTimeout(() => bumpSnoozeWakeTick((tick) => tick + 1), delayMs);
507 return () => clearTimeout(id);
508 // snoozeWakeTick must re-arm the timer even when nextSnoozeWakeAt is
509 // unchanged: after a clamped fire (wake beyond the 32-bit setTimeout
510 // range) the boundary string is identical and the chain would die.
511 }, [nextSnoozeWakeAt, snoozeWakeTick]);
512 const listItems = useMemo<readonly SidebarListItem[]>(() => {
513 if (!threadListV2Enabled) return listLayout.items;
514 // Queued offline tasks are not thread shells, so the v2 item builder
515 // never sees them; the shared splice puts them below the active block
516 // (mirrors the compact Home v2 list) where they stay visible and
517 // deletable while their environment is offline. Same environment scope
518 // and search filter as the list.
519 const v2SearchQuery = props.searchQuery.trim().toLocaleLowerCase();
520 const v2PendingTasks = pendingTasks.filter(
521 (pendingTask) =>
522 (options.selectedEnvironmentId === null ||
523 pendingTask.message.environmentId === options.selectedEnvironmentId) &&
524 (selectedProjectRefs === null ||
525 selectedProjectRefs.has(
526 scopedProjectKey(pendingTask.message.environmentId, pendingTask.creation.projectId),
527 )) &&
528 (v2SearchQuery.length === 0 ||
529 pendingTask.title.toLocaleLowerCase().includes(v2SearchQuery)),
530 );
531 const items: SidebarListItem[] = buildThreadListV2ListItems({
532 items: threadListV2Layout.items,
533 pendingTasks: v2PendingTasks,
534 snoozedCount: threadListV2Layout.snoozedCount,
535 snoozedShelfExpanded,
536 snoozedShelfHeaderIndex: threadListV2Layout.snoozedShelfHeaderIndex,
537 settledCount: threadListV2Layout.settledCount,
538 settledShelfExpanded,
539 settledShelfHeaderIndex: threadListV2Layout.settledShelfHeaderIndex,
540 snoozeLabelNow: `${nowMinute}:00.000Z`,
541 });
542 if (settledShelfExpanded && threadListV2Layout.hiddenSettledCount > 0) {
543 items.push({
544 type: "v2-show-more",
545 key: "v2-show-more",
546 hiddenCount: threadListV2Layout.hiddenSettledCount,
547 });
548 }
549 return items;
550 }, [
551 listLayout.items,
552 nowMinute,
553 options.selectedEnvironmentId,
554 pendingTasks,
555 props.searchQuery,
556 selectedProjectRefs,
557 settledShelfExpanded,
558 snoozedShelfExpanded,
559 threadListV2Enabled,
560 threadListV2Layout,
561 ]);
562 const listMenuActions = useMemo<MenuAction[]>(
563 () => [
564 {
565 id: "environment",
566 title: "Environment",
567 subactions: [
568 {
569 id: "environment:all",
570 title: "All environments",
571 subtitle: "Show threads from every environment",
572 state: options.selectedEnvironmentId === null ? "on" : "off",
573 },
574 ...environments.map((environment) => ({
575 id: `environment:${environment.environmentId}`,
576 title: environment.label,
577 state:
578 options.selectedEnvironmentId === environment.environmentId
579 ? ("on" as const)
580 : ("off" as const),
581 })),
582 ],
583 },
584 ...(projectFilterOptions.length === 0
585 ? []
586 : ([
587 {
588 id: "project",
589 title: "Project",
590 subactions: [
591 {
592 id: "project:all",
593 title: "All projects",
594 subtitle: "Show threads from every project",
595 state: selectedProjectKey === null ? "on" : "off",
596 },
597 ...projectFilterOptions.map((project) => ({
598 id: `project:${project.key}`,
599 title: project.label,
600 state: selectedProjectKey === project.key ? ("on" as const) : ("off" as const),
601 })),
602 ],
603 },
604 ] satisfies MenuAction[])),
605 // v2 lays the list out in fixed creation order — offering sort/group
606 // controls it silently ignores would be a lie. Environment still
607 // scopes the v2 partition, so it stays.
608 ...(threadListV2Enabled
609 ? []
610 : ([
611 {
612 id: "project-sort",
613 title: "Sort projects",
614 subactions: PROJECT_SORT_OPTIONS.map((option) => ({
615 id: `project-sort:${option.value}`,
616 title: option.label,
617 state: options.projectSortOrder === option.value ? "on" : "off",
618 })),
619 },
620 {
621 id: "thread-sort",
622 title: "Sort threads",
623 subactions: THREAD_SORT_OPTIONS.map((option) => ({
624 id: `thread-sort:${option.value}`,
625 title: option.label,
626 state: options.threadSortOrder === option.value ? "on" : "off",
627 })),
628 },
629 ] satisfies MenuAction[])),
630 ],
631 [environments, options, projectFilterOptions, selectedProjectKey, threadListV2Enabled],
632 );
633 const handleListMenuAction = useCallback(
634 ({ nativeEvent }: { readonly nativeEvent: { readonly event: string } }) => {
635 const event = nativeEvent.event;
636 if (event === "environment:all") {
637 setSelectedEnvironmentId(null);
638 return;
639 }
640 if (event.startsWith("environment:")) {
641 const environment = environments.find(
642 (candidate) => String(candidate.environmentId) === event.slice("environment:".length),
643 );
644 if (environment) setSelectedEnvironmentId(environment.environmentId);
645 return;
646 }
647 if (event === "project:all") {
648 setSelectedProjectKey(null);
649 return;
650 }
651 if (event.startsWith("project:")) {
652 const projectKey = event.slice("project:".length);
653 if (projectFilterOptions.some((project) => project.key === projectKey)) {
654 setSelectedProjectKey(projectKey);
655 }
656 return;
657 }
658 const projectSort = PROJECT_SORT_OPTIONS.find(
659 (option) => `project-sort:${option.value}` === event,
660 );
661 if (projectSort) {
662 setProjectSortOrder(projectSort.value);
663 return;
664 }
665 const threadSort = THREAD_SORT_OPTIONS.find(
666 (option) => `thread-sort:${option.value}` === event,
667 );
668 if (threadSort) {
669 setThreadSortOrder(threadSort.value);
670 return;
671 }
672 },
673 [
674 environments,
675 projectFilterOptions,
676 setProjectSortOrder,
677 setSelectedEnvironmentId,
678 setThreadSortOrder,
679 ],
680 );
681​
682 const [measuredHeaderHeight, setMeasuredHeaderHeight] = useState<number | null>(null);
683 // The sticky header (title row, search field, optional connection status)
684 // is measured so the list inset always matches its real height — no
685 // hardcoded per-variant constants.
686 const stickyHeaderHeight = measuredHeaderHeight ?? insets.top + SIDEBAR_STICKY_HEADER_HEIGHT;
687 const topListInset = stickyHeaderHeight + 6;
688 const handleStickyHeaderLayout = useCallback((event: LayoutChangeEvent) => {
689 const nextHeight = Math.round(event.nativeEvent.layout.height);
690 setMeasuredHeaderHeight((current) => (current === nextHeight ? current : nextHeight));
691 }, []);
692 const handleSwipeableWillOpen = useCallback((methods: SwipeableMethods) => {
693 if (openSwipeableRef.current !== methods) {
694 openSwipeableRef.current?.close();
695 openSwipeableRef.current = methods;
696 }
697 }, []);
698 const handleSwipeableClose = useCallback((methods: SwipeableMethods) => {
699 if (openSwipeableRef.current === methods) {
700 openSwipeableRef.current = null;
701 }
702 }, []);
703 const handleSelectThread = useCallback(
704 (thread: EnvironmentThreadShell) => {
705 props.onSelectThread(thread);
706 openSwipeableRef.current?.close();
707 },
708 [props.onSelectThread],
709 );
710 const handleScrollBeginDrag = useCallback(() => {
711 openSwipeableRef.current?.close();
712 }, []);
713 const { swipeEnabled, scrollGateHandlers } = useSwipeableScrollGate({
714 onScrollBeginDrag: handleScrollBeginDrag,
715 });
716 // Project shells load after the first rows draw, so the maps they feed have
717 // to bust the recycler's memoization — otherwise a row keeps the blank
718 // favicon and fallback title it was first rendered with.
719 const listExtraData = useMemo(
720 () => ({
721 selectedThreadKey: props.selectedThreadKey ?? "",
722 projectByKey,
723 projectCwdByKey,
724 projectTitleByProjectKey,
725 savedConnectionsById,
726 serverConfigs,
727 snoozePresetMinute: nowMinute,
728 threadSearchMatchByKey,
729 }),
730 [
731 props.selectedThreadKey,
732 projectByKey,
733 projectCwdByKey,
734 projectTitleByProjectKey,
735 savedConnectionsById,
736 serverConfigs,
737 nowMinute,
738 threadSearchMatchByKey,
739 ],
740 );
741 const sidebarItemsAreEqual = useCallback(
742 (previous: SidebarListItem, item: SidebarListItem): boolean => {
743 if (previous.type === "v2-thread" && item.type === "v2-thread") {
744 return (
745 previous.key === item.key &&
746 previous.item.thread === item.item.thread &&
747 previous.item.variant === item.item.variant &&
748 previous.item.snoozed === item.item.snoozed &&
749 previous.item.pinned === item.item.pinned &&
750 previous.snoozeWakeLabelText === item.snoozeWakeLabelText
751 );
752 }
753 if (previous.type === "v2-show-more" && item.type === "v2-show-more") {
754 return previous.hiddenCount === item.hiddenCount;
755 }
756 if (previous.type === "v2-pending" && item.type === "v2-pending") {
757 return (
758 previous.pendingTask === item.pendingTask &&
759 previous.showPendingDivider === item.showPendingDivider
760 );
761 }
762 if (previous.type === "v2-snoozed-shelf" && item.type === "v2-snoozed-shelf") {
763 return previous.count === item.count && previous.expanded === item.expanded;
764 }
765 if (previous.type === "v2-settled-shelf" && item.type === "v2-settled-shelf") {
766 return previous.count === item.count && previous.expanded === item.expanded;
767 }
768 if (
769 previous.type === "v2-thread" ||
770 previous.type === "v2-show-more" ||
771 previous.type === "v2-pending" ||
772 previous.type === "v2-snoozed-shelf" ||
773 previous.type === "v2-settled-shelf" ||
774 item.type === "v2-thread" ||
775 item.type === "v2-show-more" ||
776 item.type === "v2-pending" ||
777 item.type === "v2-snoozed-shelf" ||
778 item.type === "v2-settled-shelf"
779 ) {
780 return false;
781 }
782 return homeListItemsAreEqual(previous, item);
783 },
784 [],
785 );
786 const focusSearch = useCallback(() => {
787 const focus = () => {
788 if (props.nativeChrome) {
789 searchBarRef.current?.focus();
790 return;
791 }
792 searchInputRef.current?.focus();
793 };
794 if (!props.visible) {
795 props.onRequestVisibility();
796 setTimeout(focus, 240);
797 } else {
798 focus();
799 }
800 return true;
801 }, [props.nativeChrome, props.onRequestVisibility, props.visible]);
802 useHardwareKeyboardCommand("focusSearch", focusSearch);
803 const renderListItem = useCallback(
804 ({ item }: { readonly item: SidebarListItem }) => {
805 switch (item.type) {
806 case "v2-pending": {
807 const pendingScopeKey = scopedProjectKey(
808 item.pendingTask.message.environmentId,
809 item.pendingTask.creation.projectId,
810 );
811 return (
812 <ThreadListV2PendingRow
813 pendingTask={item.pendingTask}
814 project={projectByKey.get(pendingScopeKey) ?? null}
815 projectTitle={projectTitleByProjectKey.get(pendingScopeKey)}
816 environmentLabel={
817 Object.keys(savedConnectionsById).length > 1
818 ? (savedConnectionsById[item.pendingTask.message.environmentId]
819 ?.environmentLabel ?? null)
820 : null
821 }
822 pane="sidebar"
823 showPendingDivider={item.showPendingDivider}
824 onSelectPendingTask={openPendingTask}
825 onDeletePendingTask={confirmDeletePendingTask}
826 />
827 );
828 }
829 case "v2-thread": {
830 const thread = item.item.thread;
831 const scopeKey = scopedProjectKey(thread.environmentId, thread.projectId);
832 return (
833 <ThreadListV2Row
834 thread={thread}
835 variant={item.item.variant}
836 snoozed={item.item.snoozed}
837 pinned={item.item.pinned}
838 snoozePresetMinute={nowMinute}
839 snoozeWakeLabelText={item.snoozeWakeLabelText}
840 project={projectByKey.get(scopeKey) ?? null}
841 projectTitle={projectTitleByProjectKey.get(scopeKey)}
842 providerDriver={
843 serverConfigs
844 .get(thread.environmentId)
845 ?.providers.find(
846 (provider) =>
847 provider.instanceId ===
848 (thread.session?.providerInstanceId ?? thread.modelSelection.instanceId),
849 )?.driver ?? null
850 }
851 environmentLabel={
852 Object.keys(savedConnectionsById).length > 1
853 ? (savedConnectionsById[thread.environmentId]?.environmentLabel ?? null)
854 : null
855 }
856 searchMatch={threadSearchMatchByKey.get(
857 threadSearchMatchKey({
858 environmentId: thread.environmentId,
859 threadId: thread.id,
860 }),
861 )}
862 searchQuery={props.searchQuery}
863 pane="sidebar"
864 selected={
865 scopedThreadKey(thread.environmentId, thread.id) === props.selectedThreadKey
866 }
867 fullSwipeWidth={props.width - 20}
868 onSelectThread={handleSelectThread}
869 onDeleteThread={confirmDeleteThread}
870 onArchiveThread={archiveThread}
871 onRegenerateThreadTitle={regenerateThreadTitle}
872 titleRegenerationSupported={titleRegenerationEnvironmentIds.has(thread.environmentId)}
873 settlementSupported={settlementEnvironmentIds.has(thread.environmentId)}
874 onSettleThread={settleThread}
875 snoozeSupported={snoozeEnvironmentIds.has(thread.environmentId)}
876 pinningSupported={pinningEnvironmentIds.has(thread.environmentId)}
877 pinReorderSupported={pinReorderEnvironmentIds.has(thread.environmentId)}
878 canMovePinnedUp={
879 arrangedPinnedKeys.indexOf(`${thread.environmentId}:${thread.id}`) > 0
880 }
881 canMovePinnedDown={(() => {
882 const index = arrangedPinnedKeys.indexOf(`${thread.environmentId}:${thread.id}`);
883 return index !== -1 && index < arrangedPinnedKeys.length - 1;
884 })()}
885 onSnoozeThread={snoozeThread}
886 onUnsnoozeThread={unsnoozeThread}
887 onUnsettleThread={unsettleThread}
888 onPinThread={pinThread}
889 onUnpinThread={unpinThread}
890 onMovePinnedThread={movePinnedThread}
891 projectCwd={projectCwdByKey.get(scopeKey) ?? null}
892 onSwipeableClose={handleSwipeableClose}
893 onSwipeableWillOpen={handleSwipeableWillOpen}
894 simultaneousSwipeGesture={sidebarScrollGesture}
895 />
896 );
897 }
898 case "v2-snoozed-shelf":
899 return (
900 <ThreadListV2SnoozedShelfHeader
901 count={item.count}
902 disabled={!shelfPreferencesLoaded}
903 expanded={item.expanded}
904 onToggle={toggleSnoozedShelf}
905 pane="sidebar"
906 />
907 );
908 case "v2-settled-shelf":
909 return (
910 <ThreadListV2SettledShelfHeader
911 count={item.count}
912 disabled={!shelfPreferencesLoaded}
913 expanded={item.expanded}
914 onToggle={toggleSettledShelf}
915 pane="sidebar"
916 />
917 );
918 case "v2-show-more":
919 return (
920 <Pressable
921 accessibilityRole="button"
922 accessibilityLabel={`Show ${Math.min(item.hiddenCount, THREAD_LIST_V2_SETTLED_PAGE_COUNT)} more settled threads`}
923 onPress={showMoreSettled}
924 className="mx-4 mt-2 items-center rounded-lg border border-dashed border-border py-2.5"
925 style={({ pressed }) => ({ opacity: pressed ? 0.6 : 1 })}
926 >
927 <Text className="text-xs font-t3-medium text-foreground-muted">
928 Show more ({item.hiddenCount} settled hidden)
929 </Text>
930 </Pressable>
931 );
932 case "header":
933 return (
934 <ThreadListGroupHeader
935 variant="sidebar"
936 collapsed={item.collapsed}
937 isFirst={item.isFirst}
938 groupKey={item.group.key}
939 onGroupAction={updateGroupDisplay}
940 // Same gating as the compact Home list: aggregated groups have no
941 // single target project, and pending-project groups hold a
942 // placeholder shell rather than a real project.
943 newThreadTarget={item.group.newThreadTarget}
944 onNewThread={props.onNewThreadInProject}
945 project={item.group.representative}
946 threadCount={item.group.threads.length + item.group.pendingTasks.length}
947 title={item.group.title}
948 />
949 );
950 case "pending-task":
951 return (
952 <PendingTaskListRow
953 variant="sidebar"
954 pendingTask={item.pendingTask}
955 environmentLabel={
956 savedConnectionsById[item.pendingTask.message.environmentId]?.environmentLabel ??
957 null
958 }
959 isLast={item.isLast}
960 onSelectPendingTask={openPendingTask}
961 onDeletePendingTask={confirmDeletePendingTask}
962 />
963 );
964 case "thread": {
965 const thread = item.thread;
966 return (
967 <ThreadListRow
968 variant="sidebar"
969 thread={thread}
970 environmentLabel={
971 savedConnectionsById[thread.environmentId]?.environmentLabel ?? null
972 }
973 projectCwd={
974 projectCwdByKey.get(scopedProjectKey(thread.environmentId, thread.projectId)) ??
975 null
976 }
977 isLast={item.isLast}
978 searchMatch={threadSearchMatchByKey.get(
979 threadSearchMatchKey({
980 environmentId: thread.environmentId,
981 threadId: thread.id,
982 }),
983 )}
984 searchQuery={props.searchQuery}
985 selected={
986 scopedThreadKey(thread.environmentId, thread.id) === props.selectedThreadKey
987 }
988 fullSwipeWidth={props.width - 20}
989 onArchiveThread={archiveThread}
990 onDeleteThread={confirmDeleteThread}
991 onRegenerateThreadTitle={regenerateThreadTitle}
992 titleRegenerationSupported={titleRegenerationEnvironmentIds.has(thread.environmentId)}
993 onSelectThread={handleSelectThread}
994 onSwipeableClose={handleSwipeableClose}
995 onSwipeableWillOpen={handleSwipeableWillOpen}
996 simultaneousSwipeGesture={sidebarScrollGesture}
997 />
998 );
999 }
1000 case "show-more":
1001 return (
1002 <ThreadListShowMoreRow
1003 variant="sidebar"
1004 hiddenCount={item.hiddenCount}
1005 canShowLess={item.canShowLess}
1006 groupKey={item.groupKey}
1007 onGroupAction={updateGroupDisplay}
1008 />
1009 );
1011 },
1013 archiveThread,
1014 arrangedPinnedKeys,
1015 confirmDeletePendingTask,
1016 confirmDeleteThread,
1017 handleSelectThread,
1018 handleSwipeableClose,
1019 handleSwipeableWillOpen,
1020 movePinnedThread,
1021 openPendingTask,
1022 pinReorderEnvironmentIds,
1023 pinThread,
1024 pinningEnvironmentIds,
1025 projectByKey,
1026 projectCwdByKey,
1027 projectTitleByProjectKey,
1028 regenerateThreadTitle,
1029 props.onNewThreadInProject,
1030 props.searchQuery,
1031 props.selectedThreadKey,
1032 props.width,
1033 savedConnectionsById,
1034 serverConfigs,
1035 shelfPreferencesLoaded,
1036 threadSearchMatchByKey,
1037 titleRegenerationEnvironmentIds,
1038 settleThread,
1039 settlementEnvironmentIds,
1040 showMoreSettled,
1041 sidebarScrollGesture,
1042 snoozeEnvironmentIds,
1043 snoozeThread,
1044 nowMinute,
1045 toggleSettledShelf,
1046 toggleSnoozedShelf,
1047 unpinThread,
1048 unsettleThread,
1049 unsnoozeThread,
1050 updateGroupDisplay,
1051 ],
1052 );
1053 // v2 ignores the sort/group options, so only the environment filter can
1054 // light the "customized" state while the beta is on.
1055 const filterCustomized = threadListV2Enabled
1056 ? options.selectedEnvironmentId !== null || selectedProjectKey !== null
1057 : hasCustomHomeListOptions({ ...options, selectedProjectKey });
1058 const filterIcon = filterCustomized
1059 ? "line.3.horizontal.decrease.circle.fill"
1060 : "line.3.horizontal.decrease.circle";
1061 const filterMenu = useMemo(
1062 () =>
1063 buildHomeListFilterMenu({
1064 environments,
1065 projects: projectFilterOptions,
1066 selectedEnvironmentId: options.selectedEnvironmentId,
1067 selectedProjectKey,
1068 projectSortOrder: options.projectSortOrder,
1069 threadSortOrder: options.threadSortOrder,
1070 onEnvironmentChange: setSelectedEnvironmentId,
1071 onProjectChange: setSelectedProjectKey,
1072 onProjectSortOrderChange: setProjectSortOrder,
1073 onThreadSortOrderChange: setThreadSortOrder,
1074 listOrganization: !threadListV2Enabled,
1075 }),
1077 environments,
1078 options,
1079 projectFilterOptions,
1080 selectedProjectKey,
1081 setProjectSortOrder,
1082 setSelectedEnvironmentId,
1083 setThreadSortOrder,
1084 threadListV2Enabled,
1085 ],
1086 );
1087 const nativeHeaderItems = useMemo(
1088 () =>
1089 createSidebarHeaderItems({
1090 filterIcon,
1091 filterMenu,
1092 onOpenSettings: props.onOpenSettings,
1093 }),
1094 [filterIcon, filterMenu, props.onOpenSettings],
1095 );
1096 // Snoozed threads need no special case: the shelf header is a list row
1097 // even while collapsed.
1098 const listEmpty = (
1099 <Text className="px-2 py-4 text-sm text-foreground-muted">
1100 {catalogState.isLoadingConnections
1101 ? "Loading threads…"
1102 : props.searchQuery.trim().length > 0
1103 ? threadSearch.isPending
1104 ? "Searching thread messages…"
1105 : "No matching threads"
1106 : selectedProjectScope !== null
1107 ? `No threads in ${selectedProjectScope.title}`
1108 : "No threads yet"}
1109 </Text>
1110 );
1111​
1112 if (props.nativeChrome) {
1113 return (
1114 <>
1115 <NativeStackScreenOptions
1116 optionsVersion={[nativeHeaderItems, props.width]}
1117 options={{
1118 // Re-applies the shell's static brand slot with the
1119 // connection-status swap so reconnects surface in the header
1120 // instead of shifting the list.
1121 ...getConnectionAwareBrandHeaderOptions({
1122 headerWidth: props.width,
1123 trailingItemCount: nativeHeaderItems.length,
1124 onOpenEnvironments: props.onOpenEnvironmentSettings,
1125 fallbackTitleStyle: { fontSize: 18, fontWeight: "800" },
1126 }),
1127 headerSearchBarOptions: {
1128 ref: searchBarRef,
1129 autoCapitalize: "none",
1130 hideNavigationBar: false,
1131 // Keep the search bar pinned under the title — UIKit's default
1132 // hidesSearchBarWhenScrolling collapses it on scroll.
1133 hideWhenScrolling: false,
1134 obscureBackground: false,
1135 placeholder: "Search",
1136 placement: "stacked",
1137 onCancelButtonPress: () => {
1138 props.onSearchQueryChange("");
1139 },
1140 onChangeText: (event) => {
1141 props.onSearchQueryChange(event.nativeEvent.text);
1142 },
1143 },
1144 unstable_headerRightItems: () => nativeHeaderItems,
1145 }}
1146 />
1147 <View className="flex-1">
1148 <SwipeableScrollGateProvider enabled={swipeEnabled}>
1149 <GestureDetector gesture={sidebarScrollGesture}>
1150 <LegendList
1151 data={listItems}
1152 drawDistance={500}
1153 estimatedItemSize={64}
1154 extraData={listExtraData}
1155 getItemType={(item) => item.type}
1156 itemsAreEqual={sidebarItemsAreEqual}
1157 keyExtractor={(item) => item.key}
1158 renderItem={renderListItem}
1159 automaticallyAdjustsScrollIndicatorInsets={NATIVE_LIQUID_GLASS_SUPPORTED}
1160 contentInsetAdjustmentBehavior={
1161 NATIVE_LIQUID_GLASS_SUPPORTED ? "automatic" : "never"
1163 contentContainerStyle={[
1164 styles.threadListContent,
1166 paddingBottom: Math.max(insets.bottom, 16) + 16,
1167 paddingTop: 6,
1168 },
1169 ]}
1170 keyboardDismissMode="on-drag"
1171 keyboardShouldPersistTaps="handled"
1172 {...scrollGateHandlers}
1173 recycleItems
1174 scrollEventThrottle={16}
1175 showsVerticalScrollIndicator={false}
1176 style={styles.threadList}
1177 ListEmptyComponent={listEmpty}
1178 />
1179 </GestureDetector>
1180 </SwipeableScrollGateProvider>
1181 </View>
1182 </>
1183 );
1185​
1186 return (
1187 <View
1188 testID="thread-navigation-sidebar"
1189 className="flex-1 border-r border-border bg-drawer"
1190 style={{ width: props.width }}
1192 <View className="flex-1" style={{ paddingBottom: insets.bottom }}>
1193 <SwipeableScrollGateProvider enabled={swipeEnabled}>
1194 <GestureDetector gesture={sidebarScrollGesture}>
1195 <LegendList
1196 data={listItems}
1197 drawDistance={500}
1198 estimatedItemSize={64}
1199 extraData={listExtraData}
1200 getItemType={(item) => item.type}
1201 itemsAreEqual={sidebarItemsAreEqual}
1202 keyExtractor={(item) => item.key}
1203 renderItem={renderListItem}
1204 contentContainerStyle={[
1205 styles.threadListContent,
1207 paddingBottom:
1208 Platform.OS === "android"
1209 ? Math.max(insets.bottom, 16) + 88 - insets.bottom
1210 : 16 + insets.bottom,
1211 paddingTop: topListInset,
1212 },
1213 ]}
1214 keyboardDismissMode="on-drag"
1215 keyboardShouldPersistTaps="handled"
1216 {...scrollGateHandlers}
1217 recycleItems
1218 scrollEventThrottle={16}
1219 showsVerticalScrollIndicator={false}
1220 style={styles.threadList}
1221 ListEmptyComponent={listEmpty}
1222 />
1223 </GestureDetector>
1224 </SwipeableScrollGateProvider>
1225 </View>
1226​
1227 <View
1228 className="absolute inset-x-0 top-0 z-[4] bg-drawer"
1229 collapsable={false}
1230 onLayout={handleStickyHeaderLayout}
1231 pointerEvents="auto"
1232 style={{ paddingTop: insets.top }}
1234 <View className="h-[50px] flex-row items-end gap-0.5 pr-2 pl-5">
1235 {/* Title slot doubles as the connection status surface: while an
1236 environment reconnects, the brand fades to a status label in
1237 place (no layout shift in the list below). */}
1238 <WorkspaceConnectionTitle
1239 grow
1240 onPress={props.onOpenEnvironmentSettings}
1241 size="pageTitle"
1242 brand={
1243 <View className="h-11 flex-1 justify-center">
1244 <CompactBrandTitle allowFontScaling={false} />
1245 </View>
1247 />
1248 <View className="flex-row items-center gap-2.5">
1249 <ControlPillMenu actions={listMenuActions} onPressAction={handleListMenuAction}>
1250 <SidebarFilterButton accessibilityLabel="Filter and sort threads" icon={filterIcon} />
1251 </ControlPillMenu>
1252 <SidebarHeaderActions onOpenSettings={props.onOpenSettings} />
1253 </View>
1254 </View>
1255​
1256 <View className="mx-4 mt-[9px] h-[38px] flex-row items-center gap-1.5 rounded-xl bg-sidebar-search pr-2.5 pl-[11px]">
1257 <SymbolView
1258 name="magnifyingglass"
1259 size={15}
1260 tintColorClassName={"accent-foreground-muted"}
1261 type="monochrome"
1262 />
1263 <TextInput
1264 ref={searchInputRef}
1265 accessibilityLabel="Search threads"
1266 autoCapitalize="none"
1267 autoCorrect={false}
1268 clearButtonMode="while-editing"
1269 onChangeText={props.onSearchQueryChange}
1270 placeholder="Search"
1271 placeholderTextColorClassName={"accent-placeholder"}
1272 returnKeyType="search"
1273 className="h-[34px] flex-1 px-0 py-0 font-sans text-base text-foreground"
1274 value={props.searchQuery}
1275 />
1276 </View>
1277 </View>
1278 </View>
1279 );
1281​
1282const styles = StyleSheet.create({
1283 threadList: {
1284 flex: 1,
1285 },
1286 threadListContent: {
1287 paddingHorizontal: 8,
1288 },
1289});