Skip to content

Commit ab492a5

Browse files
Restyle sidebar v2 rows to the split-view idiom
The first iPad pass reused the compact-Home row shell verbatim, painting opaque bg-screen slabs with square-edged selection tints onto the sidebar's drawer surface — a visibly mismatched gray block. Give ThreadListV2Row a pane variant instead: "screen" keeps the flat edge-to-edge phone idiom, "sidebar" renders rounded rows that blend into the drawer with the accent-filled white-text selection the v1 sidebar rows use (every colored row fragment gains an on-accent variant), pane- scoped paddings, and a rounded swipe container. Co-Authored-By: Claude Fable 5 <[email protected]>
1 parent 9c9aa31 commit ab492a5

2 files changed

Lines changed: 181 additions & 89 deletions

File tree

‎apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,7 @@ function ThreadNavigationSidebarPane(
585585
? (savedConnectionsById[thread.environmentId]?.environmentLabel ?? null)
586586
: null
587587
}
588+
pane="sidebar"
588589
selected={
589590
scopedThreadKey(thread.environmentId, thread.id) === props.selectedThreadKey
590591
}

‎apps/mobile/src/features/threads/thread-list-v2-items.tsx‎

Lines changed: 180 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,20 @@ const LEGACY_MENU_ACTIONS: MenuAction[] = [
6565
{ id: "delete", title: "Delete", image: "trash", attributes: { destructive: true } },
6666
];
6767

68-
export const ThreadListV2SettledDivider = memo(function ThreadListV2SettledDivider() {
68+
/** Rounded-row radius shared with the v1 sidebar rows. */
69+
const SIDEBAR_V2_ROW_RADIUS = 12;
70+
71+
export const ThreadListV2SettledDivider = memo(function ThreadListV2SettledDivider(props: {
72+
readonly pane?: "screen" | "sidebar";
73+
}) {
6974
const borderColor = useThemeColor("--color-border");
7075
return (
71-
<View className="mb-1.5 mt-4 flex-row items-center gap-2.5 px-5">
76+
<View
77+
className={cn(
78+
"mb-1.5 mt-4 flex-row items-center gap-2.5",
79+
props.pane === "sidebar" ? "px-3" : "px-5",
80+
)}
81+
>
7282
<Text className="text-xs font-t3-medium text-foreground-tertiary">Settled</Text>
7383
<View className="h-px flex-1" style={{ backgroundColor: borderColor }} />
7484
</View>
@@ -86,6 +96,12 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
8696
the web sidebar's remote-environment cloud icon, but as text since
8797
phones have no hover tooltips. */
8898
readonly environmentLabel: string | null;
99+
/** Hosting surface. "screen" (default) renders the compact Home idiom:
100+
flat edge-to-edge rows on the screen background with inset hairlines.
101+
"sidebar" renders the iPad split-view idiom: rounded rows blending
102+
into the drawer surface, selection filled with the accent color —
103+
matching the v1 sidebar rows. */
104+
readonly pane?: "screen" | "sidebar";
89105
/** Highlights the thread open in the detail pane (iPad split view). The
90106
compact Home list never sets it — phones navigate away on select. */
91107
readonly selected?: boolean;
@@ -132,6 +148,11 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
132148
}, [onChangeRequestState, prState, threadKey]);
133149

134150
const screenColor = useThemeColor("--color-screen");
151+
const drawerColor = useThemeColor("--color-drawer");
152+
const pressedBackgroundColor = useThemeColor("--color-subtle");
153+
const selectedBackgroundColor = useThemeColor("--color-user-bubble");
154+
const sidebarPane = props.pane === "sidebar";
155+
const selected = props.selected === true;
135156

136157
const status = resolveThreadListV2Status(thread);
137158
const statusLabel = STATUS_LABEL_BY_STATUS[status];
@@ -189,115 +210,173 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
189210
thread.title,
190211
]);
191212

213+
// The sidebar pane fills selected rows with the accent color (matching the
214+
// v1 sidebar), so every piece of row text needs a white-on-accent variant.
215+
const cardContent = (
216+
<>
217+
<View className="flex-row items-center gap-1.5">
218+
{props.project ? (
219+
<ProjectFavicon
220+
environmentId={thread.environmentId}
221+
size={15}
222+
projectTitle={props.project.title}
223+
workspaceRoot={props.project.workspaceRoot}
224+
/>
225+
) : null}
226+
{/* "project · machine" share one truncating line — both answer
227+
"where does this thread live", and pairing them keeps the
228+
meta row down to branch + PR + provider. */}
229+
<Text
230+
className={cn(
231+
"flex-1 text-sm font-t3-medium",
232+
selected ? "text-user-bubble-foreground-muted" : "text-foreground-muted",
233+
)}
234+
numberOfLines={1}
235+
>
236+
{props.project?.title ?? ""}
237+
{props.environmentLabel ? (
238+
<Text
239+
className={cn(
240+
"text-sm",
241+
selected ? "text-user-bubble-foreground-muted" : "text-foreground-tertiary",
242+
)}
243+
>
244+
{" · "}
245+
{props.environmentLabel}
246+
</Text>
247+
) : null}
248+
</Text>
249+
<Text
250+
className={cn(
251+
"text-xs tabular-nums",
252+
selected ? "text-white" : (statusLabel?.className ?? "text-foreground-tertiary"),
253+
)}
254+
>
255+
{statusLabel?.label ?? timeLabel}
256+
</Text>
257+
</View>
258+
<Text
259+
className={cn(
260+
"mt-1 text-base font-t3-medium",
261+
selected ? "text-user-bubble-foreground" : "text-foreground",
262+
)}
263+
numberOfLines={2}
264+
>
265+
{thread.title}
266+
</Text>
267+
<View className="mt-1 flex-row items-center gap-2">
268+
{status === "failed" && thread.session?.lastError ? (
269+
<Text
270+
className={cn(
271+
"flex-1 text-xs",
272+
selected
273+
? "text-user-bubble-foreground-muted"
274+
: "text-red-600/80 dark:text-red-400/80",
275+
)}
276+
numberOfLines={1}
277+
>
278+
{thread.session.lastError}
279+
</Text>
280+
) : thread.branch ? (
281+
<Text
282+
className={cn(
283+
"flex-1 text-xs",
284+
selected ? "text-user-bubble-foreground-muted" : "text-foreground-muted",
285+
)}
286+
numberOfLines={1}
287+
style={{ fontFamily: MONO_FONT }}
288+
>
289+
{thread.branch}
290+
</Text>
291+
) : (
292+
<View className="flex-1" />
293+
)}
294+
{pr ? (
295+
<Text
296+
accessibilityLabel={pr.accessibilityLabel}
297+
className={cn("text-xs", selected ? "text-white" : pr.textClassName)}
298+
style={{ fontFamily: MONO_FONT }}
299+
>
300+
#{pr.label}
301+
</Text>
302+
) : null}
303+
{props.providerDriver ? (
304+
<View className="opacity-60">
305+
<ProviderIcon provider={props.providerDriver} size={14} />
306+
</View>
307+
) : null}
308+
</View>
309+
</>
310+
);
311+
192312
const rowContent = (close: () => void) =>
193313
variant === "card" ? (
194314
<Pressable
195315
accessibilityHint={`Opens the thread. Swipe left to ${primaryAction.label.toLowerCase()}.`}
196316
accessibilityLabel={thread.title}
197317
accessibilityRole="button"
318+
accessibilityState={{ selected }}
198319
onPress={() => {
199320
close();
200321
onSelectThread(thread);
201322
}}
202-
style={({ pressed }) => ({ opacity: pressed ? 0.7 : 1 })}
323+
style={
324+
sidebarPane
325+
? ({ pressed }) => ({
326+
backgroundColor: selected
327+
? selectedBackgroundColor
328+
: pressed
329+
? pressedBackgroundColor
330+
: drawerColor,
331+
borderRadius: SIDEBAR_V2_ROW_RADIUS,
332+
paddingHorizontal: 12,
333+
paddingVertical: 10,
334+
})
335+
: ({ pressed }) => ({ opacity: pressed ? 0.7 : 1 })
336+
}
203337
>
204-
{/* Flat native list rows: no tonal containers — colored status
205-
labels and text hierarchy carry state, an inset hairline
206-
separates rows. The opaque screen background stays so swipe
207-
actions reveal behind the row. */}
208-
<View className="bg-screen">
209-
<View className={cn("px-5 py-2.5", props.selected && "bg-subtle dark:bg-white/[0.07]")}>
210-
<View className="flex-row items-center gap-1.5">
211-
{props.project ? (
212-
<ProjectFavicon
213-
environmentId={thread.environmentId}
214-
size={15}
215-
projectTitle={props.project.title}
216-
workspaceRoot={props.project.workspaceRoot}
217-
/>
218-
) : null}
219-
{/* "project · machine" share one truncating line — both answer
220-
"where does this thread live", and pairing them keeps the
221-
meta row down to branch + PR + provider. */}
222-
<Text
223-
className="flex-1 text-sm font-t3-medium text-foreground-muted"
224-
numberOfLines={1}
225-
>
226-
{props.project?.title ?? ""}
227-
{props.environmentLabel ? (
228-
<Text className="text-sm text-foreground-tertiary">
229-
{" · "}
230-
{props.environmentLabel}
231-
</Text>
232-
) : null}
233-
</Text>
234-
<Text
235-
className={cn(
236-
"text-xs tabular-nums",
237-
statusLabel?.className ?? "text-foreground-tertiary",
238-
)}
239-
>
240-
{statusLabel?.label ?? timeLabel}
241-
</Text>
242-
</View>
243-
<Text className="mt-1 text-base font-t3-medium text-foreground" numberOfLines={2}>
244-
{thread.title}
245-
</Text>
246-
<View className="mt-1 flex-row items-center gap-2">
247-
{status === "failed" && thread.session?.lastError ? (
248-
<Text
249-
className="flex-1 text-xs text-red-600/80 dark:text-red-400/80"
250-
numberOfLines={1}
251-
>
252-
{thread.session.lastError}
253-
</Text>
254-
) : thread.branch ? (
255-
<Text
256-
className="flex-1 text-xs text-foreground-muted"
257-
numberOfLines={1}
258-
style={{ fontFamily: MONO_FONT }}
259-
>
260-
{thread.branch}
261-
</Text>
262-
) : (
263-
<View className="flex-1" />
264-
)}
265-
{pr ? (
266-
<Text
267-
accessibilityLabel={pr.accessibilityLabel}
268-
className={cn("text-xs", pr.textClassName)}
269-
style={{ fontFamily: MONO_FONT }}
270-
>
271-
#{pr.label}
272-
</Text>
273-
) : null}
274-
{props.providerDriver ? (
275-
<View className="opacity-60">
276-
<ProviderIcon provider={props.providerDriver} size={14} />
277-
</View>
278-
) : null}
279-
</View>
338+
{sidebarPane ? (
339+
cardContent
340+
) : (
341+
/* Flat native list rows: no tonal containers — colored status
342+
labels and text hierarchy carry state, an inset hairline
343+
separates rows. The opaque screen background stays so swipe
344+
actions reveal behind the row. */
345+
<View className="bg-screen">
346+
<View className="px-5 py-2.5">{cardContent}</View>
347+
<View className="ml-5 h-px bg-border-subtle" />
280348
</View>
281-
<View className="ml-5 h-px bg-border-subtle" />
282-
</View>
349+
)}
283350
</Pressable>
284351
) : (
285352
<Pressable
286353
accessibilityHint={`Opens the thread. Swipe left to ${primaryAction.label.toLowerCase()}.`}
287354
accessibilityLabel={thread.title}
288355
accessibilityRole="button"
289-
className="bg-screen"
356+
accessibilityState={{ selected }}
357+
className={sidebarPane ? undefined : "bg-screen"}
290358
onPress={() => {
291359
close();
292360
onSelectThread(thread);
293361
}}
294-
style={({ pressed }) => ({ opacity: pressed ? 0.7 : 1 })}
362+
style={
363+
sidebarPane
364+
? ({ pressed }) => ({
365+
backgroundColor: selected
366+
? selectedBackgroundColor
367+
: pressed
368+
? pressedBackgroundColor
369+
: drawerColor,
370+
borderRadius: SIDEBAR_V2_ROW_RADIUS,
371+
})
372+
: ({ pressed }) => ({ opacity: pressed ? 0.7 : 1 })
373+
}
295374
>
296375
{/* Settled history recedes: dimmed favicon + muted title. */}
297376
<View
298377
className={cn(
299-
"min-h-[44px] flex-row items-center gap-2.5 px-5 py-2",
300-
props.selected && "bg-subtle dark:bg-white/[0.07]",
378+
"min-h-[44px] flex-row items-center gap-2.5 py-2",
379+
sidebarPane ? "px-3" : "px-5",
301380
)}
302381
>
303382
{props.project ? (
@@ -310,11 +389,20 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
310389
/>
311390
</View>
312391
) : null}
313-
<Text className="flex-1 text-base text-foreground-muted" numberOfLines={1}>
392+
<Text
393+
className={cn(
394+
"flex-1 text-base",
395+
selected ? "text-user-bubble-foreground" : "text-foreground-muted",
396+
)}
397+
numberOfLines={1}
398+
>
314399
{thread.title}
315400
</Text>
316401
<Text
317-
className="text-sm tabular-nums text-foreground-tertiary"
402+
className={cn(
403+
"text-sm tabular-nums",
404+
selected ? "text-user-bubble-foreground-muted" : "text-foreground-tertiary",
405+
)}
318406
style={{ fontFamily: MONO_FONT }}
319407
>
320408
{relativeTime(thread.latestUserMessageAt ?? thread.updatedAt ?? thread.createdAt)}
@@ -325,9 +413,12 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
325413

326414
return (
327415
<>
328-
{props.showSettledDivider ? <ThreadListV2SettledDivider /> : null}
416+
{props.showSettledDivider ? <ThreadListV2SettledDivider pane={props.pane} /> : null}
329417
<ThreadSwipeable
330-
backgroundColor={screenColor}
418+
backgroundColor={sidebarPane ? drawerColor : screenColor}
419+
containerStyle={
420+
sidebarPane ? { borderRadius: SIDEBAR_V2_ROW_RADIUS, overflow: "hidden" } : undefined
421+
}
331422
enableTrackpadSwipe
332423
// Full swipe commits the advertised lifecycle action (Settle /
333424
// Un-settle), never the destructive delete.

0 commit comments

Comments
 (0)