Open History to see the last commit
1import { isLiquidGlassSupported, LiquidGlassView } from "@callstack/liquid-glass";
2import type {
3 EnvironmentProject,
4 EnvironmentThreadShell,
5} from "@t3tools/client-runtime/state/shell";
6import { LegendList } from "@legendapp/list/react-native";
7import type { MenuAction } from "@react-native-menu/menu";
8import { useCallback, useMemo, useRef, useState, type ReactNode } from "react";
9import type { LayoutChangeEvent, NativeScrollEvent, NativeSyntheticEvent } from "react-native";
10import { Platform, StyleSheet, TextInput, View, useColorScheme } from "react-native";
11import { Gesture, GestureDetector } from "react-native-gesture-handler";
12import type { SwipeableMethods } from "react-native-gesture-handler/ReanimatedSwipeable";
13import { useSafeAreaInsets } from "react-native-safe-area-context";
14import type { SearchBarCommands } from "react-native-screens";
15import Svg, { Defs, LinearGradient, Rect, Stop } from "react-native-svg";
16
17import { AppText as Text } from "../../components/AppText";
18import { ControlPillMenu } from "../../components/ControlPill";
19import { SymbolView } from "../../components/AppSymbol";
20import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
21import { NativeStackScreenOptions } from "../../native/StackHeader";
22import { scopedProjectKey, scopedThreadKey } from "../../lib/scopedEntities";
23import { useThemeColor } from "../../lib/useThemeColor";
24import { useProjects, useThreadShells } from "../../state/entities";
25import { usePendingNewTasks } from "../../state/use-pending-new-tasks";
26import { useWorkspaceState } from "../../state/workspace";
27import { useSavedRemoteConnections } from "../../state/use-remote-environment-registry";
28import { useHardwareKeyboardCommand } from "../keyboard/hardwareKeyboardCommands";
29import {
30 hasCustomHomeListOptions,
31 PROJECT_GROUPING_OPTIONS,
32 PROJECT_SORT_OPTIONS,
33 THREAD_SORT_OPTIONS,
34 useHomeListOptions,
35} from "../home/home-list-options";
36import { buildHomeListFilterMenu } from "../home/home-list-filter-menu";
37import {
38 buildHomeListLayout,
39 DEFAULT_GROUP_DISPLAY_STATE,
40 homeListItemsAreEqual,
41 nextGroupDisplayState,
42 type HomeGroupDisplayAction,
43 type HomeGroupDisplayState,
44 type HomeListItem,
45} from "../home/homeListItems";
46import { buildHomeThreadGroups } from "../home/homeThreadList";
47import { SwipeableScrollGateProvider, useSwipeableScrollGate } from "../home/thread-swipe-actions";
48import { usePendingTaskListActions } from "../home/usePendingTaskListActions";
49import { useThreadListActions } from "../home/useThreadListActions";
50import { WorkspaceConnectionStatus } from "../home/WorkspaceConnectionStatus";
51import { shouldShowWorkspaceConnectionStatus } from "../home/workspace-connection-status";
52import { SidebarHeaderActions } from "./sidebar-header-actions";
53import { SidebarFilterButton } from "./sidebar-filter-button";
54import { createSidebarHeaderItems } from "./sidebar-native-header-items";
55import { SidebarNavigationShell } from "./sidebar-navigation-shell";
56import {
57 PendingTaskListRow,
58 ThreadListGroupHeader,
59 ThreadListRow,
60 ThreadListShowMoreRow,
61} from "./thread-list-items";
62
63/**
64 * Shared capsule behind the sidebar header buttons — a native liquid-glass
65 * surface on iOS 26+, a tinted pill everywhere else.
66 */
67function SidebarHeaderButtonGroup(props: {
68 readonly children: ReactNode;
69 readonly colorScheme: "light" | "dark";
70}) {
71 if (isLiquidGlassSupported) {
72 return (
73 <LiquidGlassView
74 colorScheme={props.colorScheme}
75 effect="regular"
76 interactive
77 style={styles.headerButtonGroup}
78 >
79 {props.children}
80 </LiquidGlassView>
81 );
82 }
83
84 return (
85 <View
86 style={[
87 styles.headerButtonGroup,
88 props.colorScheme === "dark"
89 ? { backgroundColor: "rgba(118,118,128,0.24)", borderColor: "rgba(255,255,255,0.08)" }
90 : { backgroundColor: "rgba(255,255,255,0.72)", borderColor: "rgba(0,0,0,0.08)" },
91 { borderWidth: StyleSheet.hairlineWidth },
92 ]}
93 >
94 {props.children}
95 </View>
96 );
97}
98
99const SIDEBAR_STICKY_HEADER_HEIGHT = 106;
100const SIDEBAR_STICKY_HEADER_FADE_HEIGHT = 44;
101const SIDEBAR_HEADER_WASH_OPACITY = {
102 dark: [0.22, 0.14, 0.04],
103 light: [0.46, 0.3, 0.08],
104} as const;
105
106interface ThreadNavigationSidebarProps {
107 readonly width: number;
108 readonly visible: boolean;
109 readonly selectedThreadKey: string | null;
110 readonly onOpenSettings: () => void;
111 readonly onOpenEnvironmentSettings: () => void;
112 readonly onNewThreadInProject: (project: EnvironmentProject) => void;
113 readonly onSearchQueryChange: (query: string) => void;
114 readonly onSelectThread: (thread: EnvironmentThreadShell) => void;
115 readonly onRequestVisibility: () => void;
116 readonly searchQuery: string;
117}
118
119/**
120 * iPad/large-width sidebar column.
121 *
122 * On iOS the pane is hosted inside its own navigation-inert single-screen
123 * native stack (SidebarNavigationShell) so the header is a real
124 * UINavigationBar: large title, native bar-button items, and a
125 * UISearchController search field — the same chrome a UISplitViewController
126 * column gets. Other platforms keep the custom header chrome.
127 */
128export function ThreadNavigationSidebar(props: ThreadNavigationSidebarProps) {
129 if (Platform.OS !== "ios") {
130 return <ThreadNavigationSidebarPane {...props} nativeChrome={false} />;
131 }
132 return <NativeSidebarContainer {...props} />;
133}
134
135function NativeSidebarContainer(props: ThreadNavigationSidebarProps) {
136 const backgroundColor = useThemeColor("--color-drawer");
137 const borderColor = useThemeColor("--color-border");
138
139 return (
140 <View
141 testID="thread-navigation-sidebar"
142 className="flex-1"
143 style={{
144 width: props.width,
145 backgroundColor,
146 borderRightColor: borderColor,
147 borderRightWidth: StyleSheet.hairlineWidth,
148 }}
149 >
150 <SidebarNavigationShell>
151 <ThreadNavigationSidebarPane {...props} nativeChrome />
152 </SidebarNavigationShell>
153 </View>
154 );
155}
156
157function ThreadNavigationSidebarPane(
158 props: ThreadNavigationSidebarProps & { readonly nativeChrome: boolean },
159) {
160 const insets = useSafeAreaInsets();
161 const colorScheme = useColorScheme() === "dark" ? "dark" : "light";
162 const projects = useProjects();
163 const threads = useThreadShells();
164 const { state: catalogState } = useWorkspaceState();
165 const { savedConnectionsById } = useSavedRemoteConnections();
166 const [headerIsOverContent, setHeaderIsOverContent] = useState(false);
167 const searchInputRef = useRef<TextInput>(null);
168 const searchBarRef = useRef<SearchBarCommands>(null);
169 const openSwipeableRef = useRef<SwipeableMethods | null>(null);
170 const headerIsOverContentRef = useRef(false);
171 const sidebarScrollGesture = useMemo(() => Gesture.Native(), []);
172 const { archiveThread, confirmDeleteThread } = useThreadListActions();
173 const pendingTasks = usePendingNewTasks();
174 const { openPendingTask, confirmDeletePendingTask } = usePendingTaskListActions();
175 const environments = useMemo(
176 () =>
177 Object.values(savedConnectionsById)
178 .map((connection) => ({
179 environmentId: connection.environmentId,
180 label: connection.environmentLabel,
181 }))
182 .sort((left, right) => left.label.localeCompare(right.label)),
183 [savedConnectionsById],
184 );
185 const availableEnvironmentIds = useMemo(
186 () => new Set(environments.map((environment) => environment.environmentId)),
187 [environments],
188 );
189 const {
190 options,
191 setSelectedEnvironmentId,
192 setProjectGroupingMode,
193 setProjectSortOrder,
194 setThreadSortOrder,
195 } = useHomeListOptions(availableEnvironmentIds);
196 const groups = useMemo(
197 () =>
198 buildHomeThreadGroups({
199 projects,
200 threads,
201 pendingTasks,
202 environmentId: options.selectedEnvironmentId,
203 searchQuery: props.searchQuery,
204 projectSortOrder: options.projectSortOrder,
205 threadSortOrder: options.threadSortOrder,
206 projectGroupingMode: options.projectGroupingMode,
207 }),
208 [options, pendingTasks, projects, props.searchQuery, threads],
209 );
210 const [groupDisplayStates, setGroupDisplayStates] = useState<
211 ReadonlyMap<string, HomeGroupDisplayState>
212 >(() => new Map());
213 const updateGroupDisplay = useCallback((key: string, action: HomeGroupDisplayAction) => {
214 setGroupDisplayStates((previous) => {
215 const next = new Map(previous);
216 next.set(
217 key,
218 nextGroupDisplayState(previous.get(key) ?? DEFAULT_GROUP_DISPLAY_STATE, action),
219 );
220 return next;
221 });
222 }, []);
223 const hasSearchQuery = props.searchQuery.trim().length > 0;
224 const listLayout = useMemo(
225 () =>
226 buildHomeListLayout({
227 groups,
228 displayStates: groupDisplayStates,
229 showAllThreads: hasSearchQuery,
230 }),
231 [groups, groupDisplayStates, hasSearchQuery],
232 );
233 const projectCwdByKey = useMemo(() => {
234 const map = new Map<string, string>();
235 for (const project of projects) {
236 map.set(scopedProjectKey(project.environmentId, project.id), project.workspaceRoot);
237 }
238 return map;
239 }, [projects]);
240 const showsConnectionStatus = shouldShowWorkspaceConnectionStatus(catalogState);
241 const listMenuActions = useMemo<MenuAction[]>(
242 () => [
243 {
244 id: "environment",
245 title: "Environment",
246 subactions: [
247 {
248 id: "environment:all",
249 title: "All environments",
250 subtitle: "Show threads from every environment",
251 state: options.selectedEnvironmentId === null ? "on" : "off",
252 },
253 ...environments.map((environment) => ({
254 id: `environment:${environment.environmentId}`,
255 title: environment.label,
256 state:
257 options.selectedEnvironmentId === environment.environmentId
258 ? ("on" as const)
259 : ("off" as const),
260 })),
261 ],
262 },
263 {
264 id: "project-sort",
265 title: "Sort projects",
266 subactions: PROJECT_SORT_OPTIONS.map((option) => ({
267 id: `project-sort:${option.value}`,
268 title: option.label,
269 state: options.projectSortOrder === option.value ? "on" : "off",
270 })),
271 },
272 {
273 id: "thread-sort",
274 title: "Sort threads",
275 subactions: THREAD_SORT_OPTIONS.map((option) => ({
276 id: `thread-sort:${option.value}`,
277 title: option.label,
278 state: options.threadSortOrder === option.value ? "on" : "off",
279 })),
280 },
281 {
282 id: "project-grouping",
283 title: "Group projects",
284 subactions: PROJECT_GROUPING_OPTIONS.map((option) => ({
285 id: `project-grouping:${option.value}`,
286 title: option.label,
287 subtitle: option.subtitle,
288 state: options.projectGroupingMode === option.value ? "on" : "off",
289 })),
290 },
291 ],
292 [environments, options],
293 );
294 const handleListMenuAction = useCallback(
295 ({ nativeEvent }: { readonly nativeEvent: { readonly event: string } }) => {
296 const event = nativeEvent.event;
297 if (event === "environment:all") {
298 setSelectedEnvironmentId(null);
299 return;
300 }
301 if (event.startsWith("environment:")) {
302 const environment = environments.find(
303 (candidate) => String(candidate.environmentId) === event.slice("environment:".length),
304 );
305 if (environment) setSelectedEnvironmentId(environment.environmentId);
306 return;
307 }
308 const projectSort = PROJECT_SORT_OPTIONS.find(
309 (option) => `project-sort:${option.value}` === event,
310 );
311 if (projectSort) {
312 setProjectSortOrder(projectSort.value);
313 return;
314 }
315 const threadSort = THREAD_SORT_OPTIONS.find(
316 (option) => `thread-sort:${option.value}` === event,
317 );
318 if (threadSort) {
319 setThreadSortOrder(threadSort.value);
320 return;
321 }
322 const grouping = PROJECT_GROUPING_OPTIONS.find(
323 (option) => `project-grouping:${option.value}` === event,
324 );
325 if (grouping) setProjectGroupingMode(grouping.value);
326 },
327 [
328 environments,
329 setProjectGroupingMode,
330 setProjectSortOrder,
331 setSelectedEnvironmentId,
332 setThreadSortOrder,
333 ],
334 );
335
336 const backgroundColor = useThemeColor("--color-drawer");
337 const borderColor = useThemeColor("--color-border");
338 const mutedColor = useThemeColor("--color-foreground-muted");
339 const placeholderColor = useThemeColor("--color-placeholder");
340 const headerFadeColor = String(backgroundColor);
341 const headerWashOpacity = SIDEBAR_HEADER_WASH_OPACITY[colorScheme];
342 const [measuredHeaderHeight, setMeasuredHeaderHeight] = useState<number | null>(null);
343 // The sticky header (title row, search field, optional connection status)
344 // is measured so the list inset always matches its real height — no
345 // hardcoded per-variant constants.
346 const stickyHeaderHeight = measuredHeaderHeight ?? insets.top + SIDEBAR_STICKY_HEADER_HEIGHT;
347 const topListInset = stickyHeaderHeight + 6;
348 const handleStickyHeaderLayout = useCallback((event: LayoutChangeEvent) => {
349 const nextHeight = Math.round(event.nativeEvent.layout.height);
350 setMeasuredHeaderHeight((current) => (current === nextHeight ? current : nextHeight));
351 }, []);
352 const handleSwipeableWillOpen = useCallback((methods: SwipeableMethods) => {
353 if (openSwipeableRef.current !== methods) {
354 openSwipeableRef.current?.close();
355 openSwipeableRef.current = methods;
356 }
357 }, []);
358 const handleSwipeableClose = useCallback((methods: SwipeableMethods) => {
359 if (openSwipeableRef.current === methods) {
360 openSwipeableRef.current = null;
361 }
362 }, []);
363 const handleSelectThread = useCallback(
364 (thread: EnvironmentThreadShell) => {
365 props.onSelectThread(thread);
366 openSwipeableRef.current?.close();
367 },
368 [props.onSelectThread],
369 );
370 const handleScroll = useCallback((event: NativeSyntheticEvent<NativeScrollEvent>) => {
371 const next = event.nativeEvent.contentOffset.y > 6;
372 if (headerIsOverContentRef.current === next) {
373 return;
374 }
375 headerIsOverContentRef.current = next;
376 setHeaderIsOverContent(next);
377 }, []);
378 const handleScrollBeginDrag = useCallback(() => {
379 openSwipeableRef.current?.close();
380 }, []);
381 const { swipeEnabled, scrollGateHandlers } = useSwipeableScrollGate({
382 onScroll: handleScroll,
383 onScrollBeginDrag: handleScrollBeginDrag,
384 });
385 const listExtraData = props.selectedThreadKey ?? "";
386 const focusSearch = useCallback(() => {
387 const focus = () => {
388 if (props.nativeChrome) {
389 searchBarRef.current?.focus();
390 return;
391 }
392 searchInputRef.current?.focus();
393 };
394 if (!props.visible) {
395 props.onRequestVisibility();
396 setTimeout(focus, 240);
397 } else {
398 focus();
399 }
400 return true;
401 }, [props.nativeChrome, props.onRequestVisibility, props.visible]);
402 useHardwareKeyboardCommand("focusSearch", focusSearch);
403 const renderListItem = useCallback(
404 ({ item }: { readonly item: HomeListItem }) => {
405 switch (item.type) {
406 case "header":
407 return (
408 <ThreadListGroupHeader
409 variant="sidebar"
410 collapsed={item.collapsed}
411 isFirst={item.isFirst}
412 groupKey={item.group.key}
413 onGroupAction={updateGroupDisplay}
414 // Same gating as the compact Home list: aggregated groups have no
415 // single target project, and pending-project groups hold a
416 // placeholder shell rather than a real project.
417 newThreadTarget={item.group.newThreadTarget}
418 onNewThread={props.onNewThreadInProject}
419 project={item.group.representative}
420 threadCount={item.group.threads.length + item.group.pendingTasks.length}
421 title={item.group.title}
422 />
423 );
424 case "pending-task":
425 return (
426 <PendingTaskListRow
427 variant="sidebar"
428 pendingTask={item.pendingTask}
429 environmentLabel={
430 savedConnectionsById[item.pendingTask.message.environmentId]?.environmentLabel ??
431 null
432 }
433 isLast={item.isLast}
434 onSelectPendingTask={openPendingTask}
435 onDeletePendingTask={confirmDeletePendingTask}
436 />
437 );
438 case "thread": {
439 const thread = item.thread;
440 return (
441 <ThreadListRow
442 variant="sidebar"
443 thread={thread}
444 environmentLabel={
445 savedConnectionsById[thread.environmentId]?.environmentLabel ?? null
446 }
447 projectCwd={
448 projectCwdByKey.get(scopedProjectKey(thread.environmentId, thread.projectId)) ??
449 null
450 }
451 isLast={item.isLast}
452 selected={
453 scopedThreadKey(thread.environmentId, thread.id) === props.selectedThreadKey
454 }
455 fullSwipeWidth={props.width - 20}
456 onArchiveThread={archiveThread}
457 onDeleteThread={confirmDeleteThread}
458 onSelectThread={handleSelectThread}
459 onSwipeableClose={handleSwipeableClose}
460 onSwipeableWillOpen={handleSwipeableWillOpen}
461 simultaneousSwipeGesture={sidebarScrollGesture}
462 />
463 );
464 }
465 case "show-more":
466 return (
467 <ThreadListShowMoreRow
468 variant="sidebar"
469 hiddenCount={item.hiddenCount}
470 canShowLess={item.canShowLess}
471 groupKey={item.groupKey}
472 onGroupAction={updateGroupDisplay}
473 />
474 );
475 }
476 },
477 [
478 archiveThread,
479 confirmDeletePendingTask,
480 confirmDeleteThread,
481 handleSelectThread,
482 handleSwipeableClose,
483 handleSwipeableWillOpen,
484 openPendingTask,
485 projectCwdByKey,
486 props.onNewThreadInProject,
487 props.selectedThreadKey,
488 props.width,
489 savedConnectionsById,
490 sidebarScrollGesture,
491 updateGroupDisplay,
492 ],
493 );
494 const filterIcon = hasCustomHomeListOptions(options)
495 ? "line.3.horizontal.decrease.circle.fill"
496 : "line.3.horizontal.decrease.circle";
497 const filterMenu = useMemo(
498 () =>
499 buildHomeListFilterMenu({
500 environments,
501 selectedEnvironmentId: options.selectedEnvironmentId,
502 projectSortOrder: options.projectSortOrder,
503 threadSortOrder: options.threadSortOrder,
504 projectGroupingMode: options.projectGroupingMode,
505 onEnvironmentChange: setSelectedEnvironmentId,
506 onProjectSortOrderChange: setProjectSortOrder,
507 onThreadSortOrderChange: setThreadSortOrder,
508 onProjectGroupingModeChange: setProjectGroupingMode,
509 }),
510 [
511 environments,
512 options,
513 setProjectGroupingMode,
514 setProjectSortOrder,
515 setSelectedEnvironmentId,
516 setThreadSortOrder,
517 ],
518 );
519 const nativeHeaderItems = useMemo(
520 () =>
521 createSidebarHeaderItems({
522 filterIcon,
523 filterMenu,
524 onOpenSettings: props.onOpenSettings,
525 }),
526 [filterIcon, filterMenu, props.onOpenSettings],
527 );
528 const listEmpty = (
529 <Text className="px-2 py-4 text-sm text-foreground-muted">
530 {catalogState.isLoadingConnections
531 ? "Loading threads…"
532 : props.searchQuery.trim().length > 0
533 ? "No matching threads"
534 : "No threads yet"}
535 </Text>
536 );
537
538 if (props.nativeChrome) {
539 return (
540 <>
541 <NativeStackScreenOptions
542 options={{
543 headerSearchBarOptions: {
544 ref: searchBarRef,
545 autoCapitalize: "none",
546 hideNavigationBar: false,
547 // Keep the search bar pinned under the title — UIKit's default
548 // hidesSearchBarWhenScrolling collapses it on scroll.
549 hideWhenScrolling: false,
550 obscureBackground: false,
551 placeholder: "Search",
552 placement: "stacked",
553 onCancelButtonPress: () => {
554 props.onSearchQueryChange("");
555 },
556 onChangeText: (event) => {
557 props.onSearchQueryChange(event.nativeEvent.text);
558 },
559 },
560 unstable_headerRightItems: () => nativeHeaderItems,
561 }}
562 />
563 <View className="flex-1">
564 <SwipeableScrollGateProvider enabled={swipeEnabled}>
565 <GestureDetector gesture={sidebarScrollGesture}>
566 <LegendList
567 data={listLayout.items}
568 drawDistance={500}
569 estimatedItemSize={64}
570 extraData={listExtraData}
571 getItemType={(item) => item.type}
572 itemsAreEqual={homeListItemsAreEqual}
573 keyExtractor={(item) => item.key}
574 renderItem={renderListItem}
575 automaticallyAdjustsScrollIndicatorInsets={NATIVE_LIQUID_GLASS_SUPPORTED}
576 contentInsetAdjustmentBehavior={
577 NATIVE_LIQUID_GLASS_SUPPORTED ? "automatic" : "never"
578 }
579 contentContainerStyle={[
580 styles.threadListContent,
581 {
582 paddingBottom: Math.max(insets.bottom, 16) + 16,
583 paddingTop: 6,
584 },
585 ]}
586 keyboardDismissMode="on-drag"
587 keyboardShouldPersistTaps="handled"
588 {...scrollGateHandlers}
589 recycleItems
590 scrollEventThrottle={16}
591 showsVerticalScrollIndicator={false}
592 style={styles.threadList}
593 ListHeaderComponent={
594 showsConnectionStatus ? (
595 <View className="px-1.5 pt-0.5 pb-2">
596 <WorkspaceConnectionStatus
597 onPress={props.onOpenEnvironmentSettings}
598 state={catalogState}
599 variant="sidebar"
600 />
601 </View>
602 ) : null
603 }
604 ListEmptyComponent={listEmpty}
605 />
606 </GestureDetector>
607 </SwipeableScrollGateProvider>
608 </View>
609 </>
610 );
611 }
612
613 return (
614 <View
615 testID="thread-navigation-sidebar"
616 className="flex-1"
617 style={{
618 width: props.width,
619 backgroundColor,
620 borderRightColor: borderColor,
621 borderRightWidth: StyleSheet.hairlineWidth,
622 }}
623 >
624 <View className="flex-1" style={{ paddingBottom: insets.bottom }}>
625 <SwipeableScrollGateProvider enabled={swipeEnabled}>
626 <GestureDetector gesture={sidebarScrollGesture}>
627 <LegendList
628 data={listLayout.items}
629 drawDistance={500}
630 estimatedItemSize={64}
631 extraData={listExtraData}
632 getItemType={(item) => item.type}
633 itemsAreEqual={homeListItemsAreEqual}
634 keyExtractor={(item) => item.key}
635 renderItem={renderListItem}
636 contentContainerStyle={[
637 styles.threadListContent,
638 {
639 paddingBottom: 16 + insets.bottom,
640 paddingTop: topListInset,
641 },
642 ]}
643 keyboardDismissMode="on-drag"
644 keyboardShouldPersistTaps="handled"
645 {...scrollGateHandlers}
646 recycleItems
647 scrollEventThrottle={16}
648 showsVerticalScrollIndicator={false}
649 style={styles.threadList}
650 ListEmptyComponent={listEmpty}
651 />
652 </GestureDetector>
653 </SwipeableScrollGateProvider>
654 </View>
655
656 <View
657 className="absolute inset-x-0 top-0 z-[4]"
658 onLayout={handleStickyHeaderLayout}
659 pointerEvents="box-none"
660 style={{ paddingTop: insets.top }}
661 >
662 <View
663 className="absolute inset-x-0 top-0"
664 pointerEvents="none"
665 accessibilityElementsHidden
666 importantForAccessibility="no-hide-descendants"
667 style={{ height: stickyHeaderHeight + SIDEBAR_STICKY_HEADER_FADE_HEIGHT }}
668 >
669 <Svg width="100%" height="100%">
670 <Defs>
671 <LinearGradient id="sidebar-header-wash" x1="0%" x2="0%" y1="0%" y2="100%">
672 <Stop
673 offset="0%"
674 stopColor={headerFadeColor}
675 stopOpacity={headerIsOverContent ? headerWashOpacity[0] : 0}
676 />
677 <Stop
678 offset="58%"
679 stopColor={headerFadeColor}
680 stopOpacity={headerIsOverContent ? headerWashOpacity[1] : 0}
681 />
682 <Stop
683 offset="88%"
684 stopColor={headerFadeColor}
685 stopOpacity={headerIsOverContent ? headerWashOpacity[2] : 0}
686 />
687 <Stop offset="100%" stopColor={headerFadeColor} stopOpacity={0} />
688 </LinearGradient>
689 </Defs>
690 <Rect width="100%" height="100%" fill="url(#sidebar-header-wash)" />
691 </Svg>
692 </View>
693 <View className="h-[50px] flex-row items-end gap-0.5 pr-2 pl-5">
694 <Text className="flex-1 text-[34px] font-t3-bold text-foreground" numberOfLines={1}>
695 Threads
696 </Text>
697 <SidebarHeaderButtonGroup colorScheme={colorScheme}>
698 <ControlPillMenu actions={listMenuActions} onPressAction={handleListMenuAction}>
699 <SidebarFilterButton
700 grouped
701 accessibilityLabel="Filter and sort threads"
702 icon={filterIcon}
703 />
704 </ControlPillMenu>
705 <SidebarHeaderActions grouped onOpenSettings={props.onOpenSettings} />
706 </SidebarHeaderButtonGroup>
707 </View>
708
709 <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]">
710 <SymbolView name="magnifyingglass" size={15} tintColor={mutedColor} type="monochrome" />
711 <TextInput
712 ref={searchInputRef}
713 accessibilityLabel="Search threads"
714 autoCapitalize="none"
715 autoCorrect={false}
716 clearButtonMode="while-editing"
717 onChangeText={props.onSearchQueryChange}
718 placeholder="Search"
719 placeholderTextColor={placeholderColor}
720 returnKeyType="search"
721 className="h-[34px] flex-1 px-0 py-0 font-sans text-base text-foreground"
722 value={props.searchQuery}
723 />
724 </View>
725
726 {showsConnectionStatus ? (
727 <View className="px-3.5 pt-2.5">
728 <WorkspaceConnectionStatus
729 onPress={props.onOpenEnvironmentSettings}
730 state={catalogState}
731 variant="sidebar"
732 />
733 </View>
734 ) : null}
735 </View>
736 </View>
737 );
738}
739
740const styles = StyleSheet.create({
741 headerButtonGroup: {
742 alignItems: "center",
743 borderRadius: 22,
744 flexDirection: "row",
745 overflow: "hidden",
746 },
747 threadList: {
748 flex: 1,
749 },
750 threadListContent: {
751 paddingHorizontal: 8,
752 },
753});