The best way to control Claude Code, Codex and more from any computer or phone
refactor(mobile): share thread list section controls (#12363)
Julius Marminge committed
Sep 17, 2026 at 20:19 UTC
767a5dbd00d0a2050745a2ae2e29050c5282b8c0
3 files changed
+108
-89
apps/mobile/src/features/home/HomeScreen.tsx
+5
-12
@@ -23,12 +23,11 @@ import { useAtomSet, useAtomValue } from "@effect/atom-react";
23
import { AsyncResult } from "effect/unstable/reactivity";
24
import { useFocusEffect } from "@react-navigation/native";
25
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
26
-import { ActivityIndicator, FlatList, Platform, Pressable, View } from "react-native";
26
+import { ActivityIndicator, FlatList, Platform, View } from "react-native";
27
import type { SwipeableMethods } from "react-native-gesture-handler/ReanimatedSwipeable";
28
import { useSafeAreaInsets } from "react-native-safe-area-context";
29
30
import { cn } from "../../lib/cn";
31
-import { AppText as Text } from "../../components/AppText";
31
import { EmptyState } from "../../components/EmptyState";
32
import { MaterialFloatingActionButton } from "../../components/MaterialFloatingActionButton";
33
import type { WorkspaceEnvironment, WorkspaceState } from "../../state/workspaceModel";
@@ -53,6 +52,7 @@ import {
52
ThreadListV2PendingRow,
53
ThreadListV2Row,
54
ThreadListV2SettledShelfHeader,
55
+ ThreadListV2ShowMoreRow,
56
ThreadListV2SnoozedShelfHeader,
57
} from "../threads/thread-list-v2-items";
58
import { resolveThreadProviderInstance } from "../threads/thread-provider-instance";
@@ -1234,17 +1234,10 @@ export function HomeScreen(props: HomeScreenProps) {
1234
ListHeaderComponent={v2ListHeader}
1235
ListFooterComponent={
1236
settledShelfExpanded && threadListV2Layout.hiddenSettledCount > 0 ? (
1237
- <Pressable
1238
- accessibilityRole="button"
1239
- accessibilityLabel={`Show ${Math.min(threadListV2Layout.hiddenSettledCount, THREAD_LIST_V2_SETTLED_PAGE_COUNT)} more settled threads`}
1237
+ <ThreadListV2ShowMoreRow
1238
+ hiddenCount={threadListV2Layout.hiddenSettledCount}
1239
onPress={showMoreSettled}
1241
- className="mx-4 mt-2 items-center rounded-lg border border-dashed border-border py-2.5"
1242
- style={({ pressed }) => ({ opacity: pressed ? 0.6 : 1 })}
1243
- >
1244
- <Text className="text-xs font-t3-medium text-foreground-muted">
1245
- Show more ({threadListV2Layout.hiddenSettledCount} settled hidden)
1246
- </Text>
1247
- </Pressable>
1240
+ />
1241
) : null
1242
}
1243
ListEmptyComponent={v2ListEmpty}
apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx
+3
-12
@@ -14,7 +14,7 @@ import { useAtomValue } from "@effect/atom-react";
14
import { type EnvironmentId, resolveEnvironmentMachineKind } from "@t3tools/contracts";
15
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
16
import type { LayoutChangeEvent } from "react-native";
17
-import { Platform, Pressable, StyleSheet, TextInput, View } from "react-native";
17
+import { Platform, StyleSheet, TextInput, View } from "react-native";
18
import { Gesture, GestureDetector } from "react-native-gesture-handler";
19
import type { SwipeableMethods } from "react-native-gesture-handler/ReanimatedSwipeable";
20
import { useSafeAreaInsets } from "react-native-safe-area-context";
@@ -81,6 +81,7 @@ import {
81
ThreadListV2PendingRow,
82
ThreadListV2Row,
83
ThreadListV2SettledShelfHeader,
84
+ ThreadListV2ShowMoreRow,
85
ThreadListV2SnoozedShelfHeader,
86
} from "./thread-list-v2-items";
87
import { resolveThreadProviderInstance } from "./thread-provider-instance";
@@ -990,17 +991,7 @@ function ThreadNavigationSidebarPane(
991
);
992
case "v2-show-more":
993
return (
993
- <Pressable
994
- accessibilityRole="button"
995
- accessibilityLabel={`Show ${Math.min(item.hiddenCount, THREAD_LIST_V2_SETTLED_PAGE_COUNT)} more settled threads`}
996
- onPress={showMoreSettled}
997
- className="mx-4 mt-2 items-center rounded-lg border border-dashed border-border py-2.5"
998
- style={({ pressed }) => ({ opacity: pressed ? 0.6 : 1 })}
999
- >
1000
- <Text className="text-xs font-t3-medium text-foreground-muted">
1001
- Show more ({item.hiddenCount} settled hidden)
1002
- </Text>
1003
- </Pressable>
994
+ <ThreadListV2ShowMoreRow hiddenCount={item.hiddenCount} onPress={showMoreSettled} />
995
);
996
case "header":
997
return (
apps/mobile/src/features/threads/thread-list-v2-items.tsx
+100
-65
@@ -31,6 +31,7 @@ import { useThreadPr } from "../../state/use-thread-pr";
31
import { ThreadSwipeable } from "../home/thread-swipe-actions";
32
import { buildThreadTitleRegenerationMenuItems } from "./thread-title-regeneration-menu";
33
import {
34
+ THREAD_LIST_V2_SETTLED_PAGE_COUNT,
35
resolveThreadListV2SnoozeMenuSelection,
36
resolveThreadListV2SnoozeGateExpiryMs,
37
resolveThreadListV2Status,
@@ -95,96 +96,130 @@ const LEGACY_MENU_ACTIONS: MenuAction[] = [
96
/** Rounded-row radius shared with the v1 sidebar rows. */
97
const SIDEBAR_V2_ROW_RADIUS = 12;
98
98
-/** Section label + rule: the only structure in an otherwise flat list. */
99
-export const ThreadListV2SectionDivider = memo(function ThreadListV2SectionDivider(props: {
99
+function ThreadListV2Section(props: {
100
readonly label: string;
101
readonly pane?: "screen" | "sidebar";
102
+ readonly tone?: "default" | "snoozed";
103
+ readonly disclosure?: {
104
+ readonly expanded: boolean;
105
+ readonly disabled?: boolean;
106
+ readonly onToggle: () => void;
107
+ readonly accessibilityLabel: string;
108
+ readonly accessibilityHint: string;
109
+ };
110
}) {
103
- return (
104
- <View
105
- className={cn(
106
- "mb-1.5 mt-4 flex-row items-center gap-2.5",
107
- props.pane === "sidebar" ? "px-3" : "px-5",
108
- )}
109
- >
110
- <Text className="text-xs font-t3-medium text-foreground-tertiary">{props.label}</Text>
111
- <View className="h-px flex-1 bg-border" />
112
- </View>
111
+ const snoozed = props.tone === "snoozed";
112
+ const className = cn(
113
+ "mb-1.5 mt-4 flex-row items-center gap-2.5",
114
+ props.pane === "sidebar" ? "px-3" : "px-5",
115
+ );
116
+ const content = (
117
+ <>
118
+ <Text
119
+ className={cn(
120
+ "text-xs font-t3-medium",
121
+ snoozed ? "text-foreground-secondary" : "text-foreground-tertiary",
122
+ )}
123
+ >
124
+ {props.label}
125
+ </Text>
126
+ <View className={cn("h-px flex-1", snoozed ? "bg-primary/20" : "bg-border")} />
127
+ {props.disclosure ? (
128
+ <SymbolView
129
+ name="chevron.down"
130
+ size={10}
131
+ tintColorClassName={snoozed ? "accent-icon-muted" : "accent-foreground-muted"}
132
+ type="monochrome"
133
+ style={{ transform: [{ rotate: props.disclosure.expanded ? "180deg" : "0deg" }] }}
134
+ />
135
+ ) : null}
136
+ </>
137
);
114
-});
138
116
-export const ThreadListV2SnoozedShelfHeader = memo(function ThreadListV2SnoozedShelfHeader(props: {
117
- readonly count: number;
118
- readonly disabled?: boolean;
119
- readonly expanded: boolean;
120
- readonly onToggle: () => void;
121
- readonly pane?: "screen" | "sidebar";
122
-}) {
123
- return (
139
+ return props.disclosure ? (
140
<Pressable
125
- accessibilityHint={
126
- props.expanded ? "Collapses the snoozed threads." : "Expands the snoozed threads."
127
- }
128
- accessibilityLabel={props.count === 1 ? "1 snoozed thread" : `${props.count} snoozed threads`}
141
+ accessibilityHint={props.disclosure.accessibilityHint}
142
+ accessibilityLabel={props.disclosure.accessibilityLabel}
143
accessibilityRole="button"
130
- accessibilityState={{ disabled: props.disabled, expanded: props.expanded }}
131
- className={cn(
132
- "mb-1.5 mt-4 flex-row items-center gap-2.5",
133
- props.pane === "sidebar" ? "px-3" : "px-5",
134
- )}
135
- disabled={props.disabled}
136
- onPress={props.onToggle}
144
+ accessibilityState={{
145
+ disabled: props.disclosure.disabled,
146
+ expanded: props.disclosure.expanded,
147
+ }}
148
+ className={className}
149
+ disabled={props.disclosure.disabled}
150
+ onPress={props.disclosure.onToggle}
151
style={({ pressed }) => ({ opacity: pressed ? 0.6 : 1 })}
152
>
139
- <Text className="text-xs font-t3-medium text-foreground-secondary">
140
- {props.expanded ? "Snoozed" : `Snoozed (${props.count})`}
141
- </Text>
142
- <View className="h-px flex-1 bg-primary/20" />
143
- <SymbolView
144
- name="chevron.down"
145
- size={10}
146
- tintColorClassName="accent-icon-muted"
147
- type="monochrome"
148
- style={{ transform: [{ rotate: props.expanded ? "180deg" : "0deg" }] }}
149
- />
153
+ {content}
154
</Pressable>
155
+ ) : (
156
+ <View className={className}>{content}</View>
157
);
158
+}
159
+
160
+/** Section label + rule: the only structure in an otherwise flat list. */
161
+export const ThreadListV2SectionDivider = memo(function ThreadListV2SectionDivider(props: {
162
+ readonly label: string;
163
+ readonly pane?: "screen" | "sidebar";
164
+}) {
165
+ return <ThreadListV2Section {...props} />;
166
});
167
154
-export const ThreadListV2SettledShelfHeader = memo(function ThreadListV2SettledShelfHeader(props: {
168
+type ThreadListV2ShelfHeaderProps = {
169
readonly count: number;
170
readonly disabled?: boolean;
171
readonly expanded: boolean;
172
readonly onToggle: () => void;
173
readonly pane?: "screen" | "sidebar";
174
+};
175
+
176
+function ThreadListV2ShelfHeader(
177
+ props: ThreadListV2ShelfHeaderProps & { readonly kind: "snoozed" | "settled" },
178
+) {
179
+ const label = props.kind === "snoozed" ? "Snoozed" : "Settled";
180
+ return (
181
+ <ThreadListV2Section
182
+ label={props.expanded ? label : `${label} (${props.count})`}
183
+ pane={props.pane}
184
+ tone={props.kind === "snoozed" ? "snoozed" : "default"}
185
+ disclosure={{
186
+ expanded: props.expanded,
187
+ disabled: props.disabled,
188
+ onToggle: props.onToggle,
189
+ accessibilityLabel: `${props.count} ${props.kind} ${props.count === 1 ? "thread" : "threads"}`,
190
+ accessibilityHint: `${props.expanded ? "Collapses" : "Expands"} the ${props.kind} threads.`,
191
+ }}
192
+ />
193
+ );
194
+}
195
+
196
+export const ThreadListV2SnoozedShelfHeader = memo(function ThreadListV2SnoozedShelfHeader(
197
+ props: ThreadListV2ShelfHeaderProps,
198
+) {
199
+ return <ThreadListV2ShelfHeader {...props} kind="snoozed" />;
200
+});
201
+
202
+export const ThreadListV2SettledShelfHeader = memo(function ThreadListV2SettledShelfHeader(
203
+ props: ThreadListV2ShelfHeaderProps,
204
+) {
205
+ return <ThreadListV2ShelfHeader {...props} kind="settled" />;
206
+});
207
+
208
+export const ThreadListV2ShowMoreRow = memo(function ThreadListV2ShowMoreRow(props: {
209
+ readonly hiddenCount: number;
210
+ readonly onPress: () => void;
211
}) {
212
return (
213
<Pressable
163
- accessibilityHint={
164
- props.expanded ? "Collapses the settled threads." : "Expands the settled threads."
165
- }
166
- accessibilityLabel={props.count === 1 ? "1 settled thread" : `${props.count} settled threads`}
214
accessibilityRole="button"
168
- accessibilityState={{ disabled: props.disabled, expanded: props.expanded }}
169
- className={cn(
170
- "mb-1.5 mt-4 flex-row items-center gap-2.5",
171
- props.pane === "sidebar" ? "px-3" : "px-5",
172
- )}
173
- disabled={props.disabled}
174
- onPress={props.onToggle}
215
+ accessibilityLabel={`Show ${Math.min(props.hiddenCount, THREAD_LIST_V2_SETTLED_PAGE_COUNT)} more settled threads`}
216
+ onPress={props.onPress}
217
+ className="mx-4 mt-2 items-center rounded-lg border border-dashed border-border py-2.5"
218
style={({ pressed }) => ({ opacity: pressed ? 0.6 : 1 })}
219
>
177
- <Text className="text-xs font-t3-medium text-foreground-tertiary">
178
- {props.expanded ? "Settled" : `Settled (${props.count})`}
220
+ <Text className="text-xs font-t3-medium text-foreground-muted">
221
+ Show more ({props.hiddenCount} settled hidden)
222
</Text>
180
- <View className="h-px flex-1 bg-border" />
181
- <SymbolView
182
- name="chevron.down"
183
- size={10}
184
- tintColorClassName="accent-foreground-muted"
185
- type="monochrome"
186
- style={{ transform: [{ rotate: props.expanded ? "180deg" : "0deg" }] }}
187
- />
223
</Pressable>
224
);
225
});