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