Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
fix(mobile): reconnects no longer shift the thread list (#5372)
Theo Browne6d70e6d77824
diff --git a/apps/mobile/src/components/CompactBrandTitle.tsx b/apps/mobile/src/components/CompactBrandTitle.tsxindex f0710e85d..28f7cfe57 100644--- a/apps/mobile/src/components/CompactBrandTitle.tsx+++ b/apps/mobile/src/components/CompactBrandTitle.tsx@@ -16,6 +16,18 @@ import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../native/native-glass";const IOS_NATIVE_LEADING_TITLE_OFFSET = -6;const IPAD_NATIVE_LEADING_TITLE_OFFSET = 7;+/**+ * Horizontal correction applied to content rendered in the brand title slot,+ * shared with the connection-status swap so both align identically.+ */+export function brandTitleOffset(nativeLeadingItem: boolean): number {+ if (Platform.OS !== "ios") return 0;+ if (nativeLeadingItem) {+ return Platform.isPad ? IPAD_NATIVE_LEADING_TITLE_OFFSET : IOS_NATIVE_LEADING_TITLE_OFFSET;+ }+ return Platform.isPad ? IPAD_HOME_TITLE_OFFSET : 0;+}+/*** Compact brand lockup sized for native navigation bars.*/@@ -28,16 +40,7 @@ export function CompactBrandTitle(const mutedColor = useThemeColor("--color-foreground-muted");const subtleColor = useThemeColor("--color-subtle");const stageLabel = resolveMobileStageLabel(Constants.expoConfig?.extra?.appVariant);- const titleOffset =- Platform.OS !== "ios"- ? 0- : props.nativeLeadingItem- ? Platform.isPad- ? IPAD_NATIVE_LEADING_TITLE_OFFSET- : IOS_NATIVE_LEADING_TITLE_OFFSET- : Platform.isPad- ? IPAD_HOME_TITLE_OFFSET- : 0;+ const titleOffset = brandTitleOffset(props.nativeLeadingItem === true);return (<Viewdiff --git a/apps/mobile/src/features/home/HomeHeader.tsx b/apps/mobile/src/features/home/HomeHeader.tsxindex a209dbd76..f3d33934a 100644--- a/apps/mobile/src/features/home/HomeHeader.tsx+++ b/apps/mobile/src/features/home/HomeHeader.tsx@@ -21,6 +21,7 @@ import {NATIVE_MAIL_SEARCH_TOOLBAR_SUPPORTED,} from "../layout/native-mail-search-toolbar";import type { HomeProjectSortOrder } from "./homeThreadList";+import { WorkspaceConnectionTitle } from "./WorkspaceConnectionTitle";import {buildHomeListFilterMenu,type HomeListFilterMenuEnvironment,@@ -47,6 +48,7 @@ export function HomeHeader(props: {readonly onProjectChange: (projectKey: string | null) => void;readonly onProjectSortOrderChange: (sortOrder: HomeProjectSortOrder) => void;readonly onThreadSortOrderChange: (sortOrder: SidebarThreadSortOrder) => void;+ readonly onOpenEnvironments: () => void;readonly onOpenSettings: () => void;readonly onStartNewTask: () => void;}) {@@ -207,18 +209,27 @@ function AndroidHomeHeader(props: HomeHeaderProps) {><View className="w-full max-w-[720px] self-center gap-3"><View className="flex-row items-center gap-2.5">- <View className="flex-1 flex-row items-center gap-2">- {/* Mirrors the desktop SidebarBrand: T3 mark + muted "Code". */}- <T3Wordmark color={iconColor} height={15} />- <RNText className="-ml-0.5 text-[21px] font-t3-medium tracking-[-0.5px] text-foreground-muted">- Code- </RNText>- <View className="rounded-full bg-subtle px-2 py-0.75">- <RNText className="text-[11px] font-t3-bold tracking-[1.1px] text-foreground-muted uppercase">- {stageLabel}- </RNText>- </View>- </View>+ {/* Brand slot doubles as the connection status surface: while an+ environment reconnects, the lockup fades to a status label in+ place (no layout shift in the list below). */}+ <WorkspaceConnectionTitle+ grow+ onPress={props.onOpenEnvironments}+ brand={+ <View className="flex-row items-center gap-2">+ {/* Mirrors the desktop SidebarBrand: T3 mark + muted "Code". */}+ <T3Wordmark color={iconColor} height={15} />+ <RNText className="-ml-0.5 text-[21px] font-t3-medium tracking-[-0.5px] text-foreground-muted">+ Code+ </RNText>+ <View className="rounded-full bg-subtle px-2 py-0.75">+ <RNText className="text-[11px] font-t3-bold tracking-[1.1px] text-foreground-muted uppercase">+ {stageLabel}+ </RNText>+ </View>+ </View>+ }+ /><ControlPillMenuactions={menuActions}diff --git a/apps/mobile/src/features/home/HomeRouteScreen.tsx b/apps/mobile/src/features/home/HomeRouteScreen.tsxindex 16a3efde6..adfc4e15d 100644--- a/apps/mobile/src/features/home/HomeRouteScreen.tsx+++ b/apps/mobile/src/features/home/HomeRouteScreen.tsx@@ -3,7 +3,6 @@ import * as Order from "effect/Order";import { useNavigation } from "@react-navigation/native";import { useEffect, useMemo, useState } from "react";-import { getCompactBrandHeaderOptions } from "../../components/CompactBrandTitle";import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";import { useProjects, useThreadShells } from "../../state/entities";import { usePendingNewTasks } from "../../state/use-pending-new-tasks";@@ -20,6 +19,7 @@ import { useHomeListOptions } from "./home-list-options";import { buildHomeProjectScopes } from "./homeThreadList";import { usePendingTaskListActions } from "./usePendingTaskListActions";import { useThreadListActions } from "./useThreadListActions";+import { getConnectionAwareBrandHeaderOptions } from "./WorkspaceConnectionTitle";/* ─── Route screen ───────────────────────────────────────────────────── */@@ -126,8 +126,16 @@ export function HomeRouteScreen() {onStartNewTask={() => navigation.navigate("NewTaskSheet", { screen: "NewTask" })}><>- {/* Restore the compact title after the split branch blanks the detail header. */}- <NativeStackScreenOptions options={getCompactBrandHeaderOptions()} />+ {/* Restore the compact title after the split branch blanks the detail+ header. The brand slot doubles as the connection status surface:+ while an environment reconnects, the lockup fades to a status label+ in place (no layout shift in the list below). */}+ <NativeStackScreenOptions+ options={getConnectionAwareBrandHeaderOptions({+ onOpenEnvironments: () =>+ navigation.navigate("SettingsSheet", { screen: "SettingsEnvironments" }),+ })}+ /><HomeHeaderenvironments={environments}projects={projectFilterOptions}@@ -138,6 +146,9 @@ export function HomeRouteScreen() {threadSortOrder={listOptions.threadSortOrder}onEnvironmentChange={setSelectedEnvironmentId}onProjectChange={setSelectedProjectKey}+ onOpenEnvironments={() =>+ navigation.navigate("SettingsSheet", { screen: "SettingsEnvironments" })+ }onOpenSettings={() => navigation.navigate("SettingsSheet", { screen: "Settings" })}onProjectSortOrderChange={setProjectSortOrder}onSearchQueryChange={setSearchQuery}@@ -161,9 +172,6 @@ export function HomeRouteScreen() {onUnpinThread={unpinThread}onEnvironmentChange={setSelectedEnvironmentId}onProjectChange={setSelectedProjectKey}- onOpenEnvironments={() =>- navigation.navigate("SettingsSheet", { screen: "SettingsEnvironments" })- }onOpenSettings={() => navigation.navigate("SettingsSheet", { screen: "Settings" })}onProjectSortOrderChange={setProjectSortOrder}onSearchQueryChange={setSearchQuery}diff --git a/apps/mobile/src/features/home/HomeScreen.tsx b/apps/mobile/src/features/home/HomeScreen.tsxindex ba32dc6b6..7de628987 100644--- a/apps/mobile/src/features/home/HomeScreen.tsx+++ b/apps/mobile/src/features/home/HomeScreen.tsx@@ -71,8 +71,6 @@ import {type HomeProjectSortOrder,} from "./homeThreadList";import { SwipeableScrollGateProvider, useSwipeableScrollGate } from "./thread-swipe-actions";-import { WorkspaceConnectionStatus } from "./WorkspaceConnectionStatus";-import { shouldShowWorkspaceConnectionStatus } from "./workspace-connection-status";/* ─── Types ──────────────────────────────────────────────────────────── */@@ -97,7 +95,6 @@ interface HomeScreenProps {readonly onProjectSortOrderChange: (sortOrder: HomeProjectSortOrder) => void;readonly onThreadSortOrderChange: (sortOrder: SidebarThreadSortOrder) => void;readonly onAddConnection: () => void;- readonly onOpenEnvironments: () => void;readonly onOpenSettings: () => void;readonly onStartNewTask: () => void;readonly onSelectThread: (thread: EnvironmentThreadShell) => void;@@ -976,20 +973,13 @@ export function HomeScreen(props: HomeScreenProps) {? null: (props.savedConnectionsById[props.selectedEnvironmentId]?.environmentLabel ??"this environment");- const shouldShowConnectionStatus = shouldShowWorkspaceConnectionStatus(props.catalogState);+ // Connection state surfaces in the header title slot+ // (WorkspaceConnectionTitle) — nothing renders inside the list, so+ // reconnects never shift the rows.const emptyState = deriveEmptyState({catalogState: props.catalogState,projectCount: props.projects.length,});- const connectionStatus =- shouldShowConnectionStatus && Platform.OS !== "ios" ? (- <View- className="absolute left-0 right-0 items-center"- style={{ bottom: Math.max(insets.bottom, 18) + 76 }}- >- <WorkspaceConnectionStatus state={props.catalogState} onPress={props.onOpenEnvironments} />- </View>- ) : null;if (!hasAnyThreads) {return (@@ -1008,41 +998,17 @@ export function HomeScreen(props: HomeScreenProps) {onAction={!props.catalogState.hasReadyEnvironment ? props.onAddConnection : undefined}variant="plain"/>- {emptyState.loading && !shouldShowConnectionStatus ? (+ {emptyState.loading ? (<View className="mt-4 items-center"><ActivityIndicator color={accentColor} /></View>) : null}- {shouldShowConnectionStatus && Platform.OS === "ios" ? (- <View className="mt-4">- <WorkspaceConnectionStatus- state={props.catalogState}- onPress={props.onOpenEnvironments}- variant="sidebar"- />- </View>- ) : null}</View>- {connectionStatus}</View>);}- const listHeader = (- <>- {Platform.OS === "ios" ? null : <HomeTopContentSpacer />}-- {shouldShowConnectionStatus && Platform.OS === "ios" ? (- <View className="pb-4">- <WorkspaceConnectionStatus- state={props.catalogState}- onPress={props.onOpenEnvironments}- variant="sidebar"- />- </View>- ) : null}- </>- );+ const listHeader = Platform.OS === "ios" ? null : <HomeTopContentSpacer />;// Project scoping lives in the header filter menu (no inline chip row on// mobile — the menu is the one filter surface).@@ -1123,7 +1089,6 @@ export function HomeScreen(props: HomeScreenProps) {}}/></SwipeableScrollGateProvider>- {connectionStatus}</View>);}@@ -1178,7 +1143,6 @@ export function HomeScreen(props: HomeScreenProps) {}/></SwipeableScrollGateProvider>- {connectionStatus}</View>);}diff --git a/apps/mobile/src/features/home/WorkspaceConnectionStatus.tsx b/apps/mobile/src/features/home/WorkspaceConnectionStatus.tsxdeleted file mode 100644index 1e986ad1a..000000000--- a/apps/mobile/src/features/home/WorkspaceConnectionStatus.tsx+++ /dev/null@@ -1,56 +0,0 @@-import { SymbolView } from "../../components/AppSymbol";-import { ActivityIndicator, Pressable } from "react-native";--import { AppText as Text } from "../../components/AppText";-import { useThemeColor } from "../../lib/useThemeColor";-import type { WorkspaceState } from "../../state/workspaceModel";-import { workspaceConnectionStatusLabel } from "./workspace-connection-status";--export function WorkspaceConnectionStatus(props: {- readonly state: WorkspaceState;- readonly onPress: () => void;- readonly variant?: "floating" | "sidebar";-}) {- const iconColor = useThemeColor("--color-icon-muted");- const isSynchronizing =- props.state.networkStatus !== "offline" &&- props.state.connectionError === null &&- (props.state.connectingEnvironments.length > 0 || props.state.hasPendingShellSnapshot);- const variant = props.variant ?? "floating";-- return (- <Pressable- accessibilityHint="Opens environment settings"- accessibilityLabel={workspaceConnectionStatusLabel(props.state)}- accessibilityRole="button"- onPress={props.onPress}- className={- variant === "sidebar"- ? "mx-3 flex-row items-center gap-2 rounded-xl bg-subtle px-3 py-2.5"- : "flex-row items-center gap-2 rounded-full bg-card px-4 py-2.5"- }- style={- variant === "floating"- ? {- shadowColor: "#000",- shadowOffset: { width: 0, height: 10 },- shadowOpacity: 0.12,- shadowRadius: 24,- }- : undefined- }- >- {isSynchronizing ? (- <ActivityIndicator color={iconColor} size="small" />- ) : (- <SymbolView name="wifi.slash" size={15} tintColor={iconColor} type="monochrome" />- )}- <Text className="min-w-0 flex-1 text-sm font-t3-bold text-foreground" numberOfLines={1}>- {workspaceConnectionStatusLabel(props.state)}- </Text>- {variant === "sidebar" ? (- <SymbolView name="chevron.right" size={11} tintColor={iconColor} type="monochrome" />- ) : null}- </Pressable>- );-}diff --git a/apps/mobile/src/features/home/WorkspaceConnectionTitle.tsx b/apps/mobile/src/features/home/WorkspaceConnectionTitle.tsxnew file mode 100644index 000000000..186704298--- /dev/null+++ b/apps/mobile/src/features/home/WorkspaceConnectionTitle.tsx@@ -0,0 +1,194 @@+import type {+ NativeStackHeaderItem,+ NativeStackNavigationOptions,+} from "@react-navigation/native-stack";+import { useEffect, useRef, useState, type ReactNode } from "react";+import { ActivityIndicator, Animated, Platform, Pressable, View } from "react-native";++import { SymbolView } from "../../components/AppSymbol";+import { AppText as Text } from "../../components/AppText";+import { brandTitleOffset, CompactBrandTitle } from "../../components/CompactBrandTitle";+import { useThemeColor } from "../../lib/useThemeColor";+import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";+import { useWorkspaceState } from "../../state/workspace";+import {+ workspaceConnectionStatusPresentation,+ type WorkspaceConnectionStatusPresentation,+} from "./workspace-connection-status";++/**+ * Delay before a connection interruption surfaces in the title slot. Sub-second+ * blips (the common reconnect case) resolve without any UI at all.+ */+const STATUS_SHOW_DELAY_MS = 800;+const FADE_IN_MS = 250;++/**+ * Connection status presentation, debounced for display: null until the+ * workspace has been in a non-connected state for STATUS_SHOW_DELAY_MS,+ * then live-updating until the workspace reconnects (null again immediately).+ */+function useDelayedConnectionStatus(): WorkspaceConnectionStatusPresentation | null {+ const { state } = useWorkspaceState();+ const presentation = workspaceConnectionStatusPresentation(state);+ const hasStatus = presentation !== null;+ const [visible, setVisible] = useState(false);++ useEffect(() => {+ if (!hasStatus) {+ setVisible(false);+ return;+ }+ const timer = setTimeout(() => setVisible(true), STATUS_SHOW_DELAY_MS);+ return () => clearTimeout(timer);+ }, [hasStatus]);++ return visible ? presentation : null;+}++/**+ * One-shot entrance fade for the status label. Deliberately JS-driven: this can+ * mount inside a native header item (RNSScreenStackHeaderSubview), where+ * native-driver animated nodes blank the re-hosted view entirely. The JS driver+ * updates opacity through the ordinary style path, which those subviews handle.+ */+function StatusFadeIn(props: { readonly children: ReactNode; readonly grow?: boolean }) {+ const opacity = useRef(new Animated.Value(0)).current;++ useEffect(() => {+ const animation = Animated.timing(opacity, {+ duration: FADE_IN_MS,+ toValue: 1,+ useNativeDriver: false,+ });+ animation.start();+ return () => animation.stop();+ }, [opacity]);++ return (+ <Animated.View+ style={[+ { alignItems: "center", flexDirection: "row", opacity },+ props.grow ? { flex: 1, minWidth: 0 } : null,+ ]}+ >+ {props.children}+ </Animated.View>+ );+}++/**+ * Renders the brand/title slot of a thread-list surface, swapping the brand+ * for the workspace connection status while an environment is unavailable.+ *+ * Both states occupy the same slot, so connection changes never shift the+ * layout below. While connected the brand renders untouched — no wrapper —+ * keeping the native header item on the exact element tree that predates the+ * status swap. Replaces the old WorkspaceConnectionStatus pill, which inserted+ * a row above the thread list.+ */+export function WorkspaceConnectionTitle(props: {+ /** Content shown while connected (brand lockup or a screen title). */+ readonly brand: ReactNode;+ /** Opens environment settings. Status is not pressable when omitted. */+ readonly onPress?: () => void;+ /** Fill the available row width (in-flow headers) instead of hugging content (native title slots). */+ readonly grow?: boolean;+ readonly size?: "navbar" | "pageTitle";+ /** Horizontal correction so the status aligns with the brand in native title slots. */+ readonly statusOffset?: number;+}) {+ const iconColor = String(useThemeColor("--color-icon-muted"));+ const status = useDelayedConnectionStatus();+ const size = props.size ?? "navbar";++ if (status === null) {+ return props.grow ? (+ <View style={{ alignItems: "center", flex: 1, flexDirection: "row", minWidth: 0 }}>+ {props.brand}+ </View>+ ) : (+ <>{props.brand}</>+ );+ }++ return (+ <StatusFadeIn grow={props.grow}>+ <Pressable+ accessibilityHint="Opens environment settings"+ accessibilityLabel={status.label}+ accessibilityRole="button"+ disabled={props.onPress === undefined}+ hitSlop={8}+ onPress={props.onPress}+ className="flex-row items-center gap-2"+ style={{ marginLeft: props.statusOffset ?? 0 }}+ >+ {status.showsProgress ? (+ <ActivityIndicator color={iconColor} size="small" />+ ) : (+ <SymbolView+ name="wifi.slash"+ size={size === "pageTitle" ? 17 : 15}+ tintColor={iconColor}+ type="monochrome"+ />+ )}+ <Text+ className={+ size === "pageTitle"+ ? "text-[20px] font-t3-bold text-foreground-muted"+ : "text-[16px] font-t3-bold text-foreground-muted"+ }+ numberOfLines={1}+ style={{ flexShrink: 1 }}+ >+ {status.label}+ </Text>+ </Pressable>+ </StatusFadeIn>+ );+}++/**+ * getCompactBrandHeaderOptions with the brand slot upgraded to the+ * connection-status swap. Screens with an environment-settings callback apply+ * this over the static brand options at mount.+ */+export function getConnectionAwareBrandHeaderOptions(opts: {+ readonly onOpenEnvironments: () => void;+ readonly fallbackTitleStyle?: NativeStackNavigationOptions["headerTitleStyle"];+}): NativeStackNavigationOptions {+ if (Platform.OS === "ios" && NATIVE_LIQUID_GLASS_SUPPORTED) {+ return {+ headerTitle: "Threads",+ headerTitleStyle: { color: "transparent", fontSize: 18, fontWeight: "800" },+ title: "Threads",+ unstable_headerLeftItems: (): NativeStackHeaderItem[] => [+ {+ element: (+ <WorkspaceConnectionTitle+ brand={<CompactBrandTitle nativeLeadingItem />}+ onPress={opts.onOpenEnvironments}+ statusOffset={brandTitleOffset(true)}+ />+ ),+ hidesSharedBackground: true,+ type: "custom",+ },+ ],+ };+ }++ return {+ headerTitle: () => (+ <WorkspaceConnectionTitle+ brand={<CompactBrandTitle />}+ onPress={opts.onOpenEnvironments}+ statusOffset={brandTitleOffset(false)}+ />+ ),+ headerTitleStyle: opts.fallbackTitleStyle,+ title: "Threads",+ };+}diff --git a/apps/mobile/src/features/home/WorkspaceConnectionStatus.test.ts b/apps/mobile/src/features/home/workspace-connection-status.test.tssimilarity index 72%rename from apps/mobile/src/features/home/WorkspaceConnectionStatus.test.tsrename to apps/mobile/src/features/home/workspace-connection-status.test.tsindex 8c3c873cc..15a990bb1 100644--- a/apps/mobile/src/features/home/WorkspaceConnectionStatus.test.ts+++ b/apps/mobile/src/features/home/workspace-connection-status.test.ts@@ -4,6 +4,7 @@ import type { WorkspaceState } from "../../state/workspaceModel";import {shouldShowWorkspaceConnectionStatus,workspaceConnectionStatusLabel,+ workspaceConnectionStatusPresentation,} from "./workspace-connection-status";function workspaceState(overrides: Partial<WorkspaceState> = {}): WorkspaceState {@@ -84,4 +85,36 @@ describe("workspace connection status", () => {expect(shouldShowWorkspaceConnectionStatus(state)).toBe(true);expect(workspaceConnectionStatusLabel(state)).toBe("Loading threads...");});++ it("presents nothing while connected", () => {+ expect(workspaceConnectionStatusPresentation(workspaceState())).toBeNull();+ });++ it("presents progress while reconnecting but not while offline", () => {+ const reconnecting = workspaceState({+ hasConnectingEnvironment: true,+ hasReadyEnvironment: false,+ connectingEnvironments: [+ {+ environmentId: "environment-1" as never,+ environmentLabel: "Julius’s Mac mini",+ displayUrl: "",+ isRelayManaged: false,+ connectionState: "reconnecting",+ connectionError: null,+ connectionErrorTraceId: null,+ },+ ],+ });+ expect(workspaceConnectionStatusPresentation(reconnecting)).toEqual({+ label: "Reconnecting to Julius’s Mac mini",+ showsProgress: true,+ });++ const offline = workspaceState({ networkStatus: "offline", hasReadyEnvironment: false });+ expect(workspaceConnectionStatusPresentation(offline)).toEqual({+ label: "You are offline",+ showsProgress: false,+ });+ });});diff --git a/apps/mobile/src/features/home/workspace-connection-status.ts b/apps/mobile/src/features/home/workspace-connection-status.tsindex d8eed4383..6f9898b1b 100644--- a/apps/mobile/src/features/home/workspace-connection-status.ts+++ b/apps/mobile/src/features/home/workspace-connection-status.ts@@ -1,5 +1,11 @@import type { WorkspaceState } from "../../state/workspaceModel";+export interface WorkspaceConnectionStatusPresentation {+ readonly label: string;+ /** True while actively working (connecting/syncing) — render a spinner. False for offline/error/idle states — render a wifi-slash icon. */+ readonly showsProgress: boolean;+}+export function shouldShowWorkspaceConnectionStatus(state: WorkspaceState): boolean {return (state.networkStatus === "offline" ||@@ -24,3 +30,17 @@ export function workspaceConnectionStatusLabel(state: WorkspaceState): string {}return "Not connected";}++/** Header-title presentation of the connection state, or null while connected. */+export function workspaceConnectionStatusPresentation(+ state: WorkspaceState,+): WorkspaceConnectionStatusPresentation | null {+ if (!shouldShowWorkspaceConnectionStatus(state)) return null;+ return {+ label: workspaceConnectionStatusLabel(state),+ showsProgress:+ state.networkStatus !== "offline" &&+ state.connectionError === null &&+ (state.connectingEnvironments.length > 0 || state.hasPendingShellSnapshot),+ };+}diff --git a/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx b/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsxindex 322ac6075..206232ebe 100644--- a/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx+++ b/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx@@ -55,8 +55,10 @@ import { buildHomeProjectScopes, buildHomeThreadGroups } from "../home/homeThreaimport { SwipeableScrollGateProvider, useSwipeableScrollGate } from "../home/thread-swipe-actions";import { usePendingTaskListActions } from "../home/usePendingTaskListActions";import { useThreadListActions } from "../home/useThreadListActions";-import { WorkspaceConnectionStatus } from "../home/WorkspaceConnectionStatus";-import { shouldShowWorkspaceConnectionStatus } from "../home/workspace-connection-status";+import {+ getConnectionAwareBrandHeaderOptions,+ WorkspaceConnectionTitle,+} from "../home/WorkspaceConnectionTitle";import { SidebarHeaderActions } from "./sidebar-header-actions";import { SidebarFilterButton } from "./sidebar-filter-button";import { createSidebarHeaderItems } from "./sidebar-native-header-items";@@ -600,7 +602,6 @@ function ThreadNavigationSidebarPane(threadListV2Enabled,threadListV2Layout,]);- const showsConnectionStatus = shouldShowWorkspaceConnectionStatus(catalogState);const listMenuActions = useMemo<MenuAction[]>(() => [{@@ -1153,6 +1154,13 @@ function ThreadNavigationSidebarPane(<NativeStackScreenOptionsoptionsVersion={nativeHeaderItems}options={{+ // Re-applies the shell's static brand slot with the+ // connection-status swap so reconnects surface in the header+ // instead of shifting the list.+ ...getConnectionAwareBrandHeaderOptions({+ onOpenEnvironments: props.onOpenEnvironmentSettings,+ fallbackTitleStyle: { fontSize: 18, fontWeight: "800" },+ }),headerSearchBarOptions: {ref: searchBarRef,autoCapitalize: "none",@@ -1203,17 +1211,6 @@ function ThreadNavigationSidebarPane(scrollEventThrottle={16}showsVerticalScrollIndicator={false}style={styles.threadList}- ListHeaderComponent={- showsConnectionStatus ? (- <View className="px-1.5 pt-0.5 pb-2">- <WorkspaceConnectionStatus- onPress={props.onOpenEnvironmentSettings}- state={catalogState}- variant="sidebar"- />- </View>- ) : null- }ListEmptyComponent={listEmpty}/></GestureDetector>@@ -1304,9 +1301,19 @@ function ThreadNavigationSidebarPane(</Svg></View><View className="h-[50px] flex-row items-end gap-0.5 pr-2 pl-5">- <Text className="flex-1 text-[34px] font-t3-bold text-foreground" numberOfLines={1}>- Threads- </Text>+ {/* Title slot doubles as the connection status surface: while an+ environment reconnects, "Threads" fades to a status label in+ place (no layout shift in the list below). */}+ <WorkspaceConnectionTitle+ grow+ onPress={props.onOpenEnvironmentSettings}+ size="pageTitle"+ brand={+ <Text className="flex-1 text-[34px] font-t3-bold text-foreground" numberOfLines={1}>+ Threads+ </Text>+ }+ /><SidebarHeaderButtonGroup colorScheme={colorScheme}><ControlPillMenu actions={listMenuActions} onPressAction={handleListMenuAction}><SidebarFilterButton@@ -1335,16 +1342,6 @@ function ThreadNavigationSidebarPane(value={props.searchQuery}/></View>-- {showsConnectionStatus ? (- <View className="px-3.5 pt-2.5">- <WorkspaceConnectionStatus- onPress={props.onOpenEnvironmentSettings}- state={catalogState}- variant="sidebar"- />- </View>- ) : null}</View></View>);