diff --git a/apps/mobile/src/features/threads/thread-list-v2-items.tsx b/apps/mobile/src/features/threads/thread-list-v2-items.tsx index 68beb4100d..a7496630d2 100644 --- a/apps/mobile/src/features/threads/thread-list-v2-items.tsx +++ b/apps/mobile/src/features/threads/thread-list-v2-items.tsx @@ -3,10 +3,12 @@ import type { EnvironmentThreadShell, } from "@t3tools/client-runtime/state/shell"; import type { MenuAction } from "@react-native-menu/menu"; -import { memo, useCallback, useMemo, type ComponentProps } from "react"; +import { memo, useCallback, useMemo, type ComponentProps, type ReactNode } from "react"; import { Platform, Pressable, useWindowDimensions, View } from "react-native"; import type { SwipeableMethods } from "react-native-gesture-handler/ReanimatedSwipeable"; +import Animated, { useAnimatedStyle, useSharedValue, withSpring } from "react-native-reanimated"; +import { SymbolView } from "../../components/AppSymbol"; import { AppText as Text } from "../../components/AppText"; import { ControlPillMenu } from "../../components/ControlPill"; import { ProjectFavicon } from "../../components/ProjectFavicon"; @@ -17,10 +19,12 @@ import { ThreadSwipeable } from "../home/thread-swipe-actions"; import { resolveThreadListV2Status, type ThreadListV2Status } from "./threadListV2"; /** - * Thread List v2 rows, ported from the web sidebar v2 (SidebarV2.tsx): - * brutalist square cards where a thin title bar carries the project - * favicon + name as chrome, a solid edge strip carries status color, and - * settled threads collapse to dimmed slim rows. + * Thread List v2 rows. The design language is the web sidebar v2 (status + * edge strip, mono project labels, settled tail), but the card anatomy is + * native iOS list-app, not the web's window chrome: a solid raised surface + * (no outline), a leading favicon tile as the touch anchor, a trailing + * chevron, and spring press feedback. Bordered translucent boxes with a + * header row read as notifications — information, not buttons. */ const MONO_FONT = Platform.select({ @@ -62,12 +66,47 @@ const SLIM_MENU_ACTIONS: MenuAction[] = [ { id: "delete", title: "Delete", image: "trash", attributes: { destructive: true } }, ]; +const PRESS_SPRING = { damping: 30, stiffness: 400 } as const; + +/** + * Pressable that springs down to 97% while touched — the "this is a real + * object under your finger" signal every native list app ships. + */ +function PressableScaleCard(props: { + readonly accessibilityHint: string; + readonly accessibilityLabel: string; + readonly onPress: () => void; + readonly children: ReactNode; +}) { + const scale = useSharedValue(1); + const animatedStyle = useAnimatedStyle(() => ({ transform: [{ scale: scale.value }] })); + + return ( + + { + scale.value = withSpring(0.97, PRESS_SPRING); + }} + onPressOut={() => { + scale.value = withSpring(1, PRESS_SPRING); + }} + > + {props.children} + + + ); +} + export const ThreadListV2SettledDivider = memo(function ThreadListV2SettledDivider() { const separatorColor = useThemeColor("--color-separator"); return ( - + Settled @@ -104,7 +143,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: { onUnsettleThread, } = props; - const separatorColor = useThemeColor("--color-separator"); + const iconSubtleColor = useThemeColor("--color-icon-subtle"); const screenColor = useThemeColor("--color-screen"); const status = resolveThreadListV2Status(thread); @@ -148,86 +187,102 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: { const rowContent = (close: () => void) => variant === "card" ? ( - { - close(); - onSelectThread(thread); - }} - style={({ pressed }) => ({ opacity: pressed ? 0.7 : 1 })} - > - - - {/* Title bar: project favicon + name as chrome. */} - + + { + close(); + onSelectThread(thread); + }} + > + {/* Solid raised card: bg-card with no border reads as an object, + not a notification banner. */} + + {statusEdge ? : null} + {/* Favicon tile: the leading touch anchor, app-icon style. */} + {props.project ? ( ) : null} - - {props.project?.title ?? ""} - - - {timeLabel} - - {/* Status edge strip spans the full card over both zones. */} - {statusEdge ? ( - - ) : null} - - + + + + {props.project?.title ?? ""} + + + {timeLabel} + + + {thread.title} - - {statusWord ? ( - - {statusWord.label} - - ) : null} - {status === "failed" && thread.session?.lastError ? ( - - {thread.session.lastError} - - ) : thread.branch ? ( - - {thread.branch} - - ) : null} - + {statusWord || thread.branch || (status === "failed" && thread.session?.lastError) ? ( + + {statusWord ? ( + + {statusWord.label} + + ) : null} + {status === "failed" && thread.session?.lastError ? ( + + {thread.session.lastError} + + ) : thread.branch ? ( + + {thread.branch} + + ) : null} + + ) : null} + + {/* Trailing chevron: the universal "this navigates" affordance. */} + + - - + + ) : ( ({ opacity: pressed ? 0.7 : 1 })} > {/* Settled history recedes: dimmed favicon + muted title. */} - + {props.project ? ( ) : null} - + {thread.title} {relativeTime(thread.latestUserMessageAt ?? thread.updatedAt ?? thread.createdAt)} @@ -290,9 +345,6 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: { )} - {props.showSettledDivider ? null : variant === "slim" ? ( - - ) : null} ); });