TypeScript
feat(mobile): thread rows drop the branch and lead with the title (#25415)
Julius Marminge184d915d8774
diff --git a/apps/mobile/src/features/home/HomeScreen.tsx b/apps/mobile/src/features/home/HomeScreen.tsxindex 0ae5d3b6939..e9a71f2c253 100644--- a/apps/mobile/src/features/home/HomeScreen.tsx+++ b/apps/mobile/src/features/home/HomeScreen.tsx@@ -591,9 +591,6 @@ export function HomeScreen(props: HomeScreenProps) {timeLabel={item.timeLabel}showTrailingDivider={item.showTrailingDivider}project={projectByKey.get(scopedProjectKey(thread.environmentId, thread.projectId)) ?? null}- projectTitle={v2ProjectTitleByProjectKey.get(- scopedProjectKey(thread.environmentId, thread.projectId),- )}providerInstance={resolveProviderInstance(thread)}providers={providersByEnvironmentId.get(thread.environmentId)}environmentLabel={@@ -728,6 +725,7 @@ export function HomeScreen(props: HomeScreenProps) {{listHeader}{Platform.OS === "ios" && workspace ? (<ThreadListFilters+ gutter={primaryColumn ? 8 : 0}environments={props.environments}projects={projectScopes.map((scope) => ({ key: scope.key, label: scope.title }))}selectedEnvironmentId={props.selectedEnvironmentId}diff --git a/apps/mobile/src/features/home/ThreadListFilters.tsx b/apps/mobile/src/features/home/ThreadListFilters.tsxindex 93f9e7f68cd..a7d6894c35d 100644--- a/apps/mobile/src/features/home/ThreadListFilters.tsx+++ b/apps/mobile/src/features/home/ThreadListFilters.tsx@@ -12,7 +12,10 @@ export function ThreadListFilters(| "selectedProjectKey"| "onEnvironmentChange"| "onProjectChange"- >,+ > & {+ /** List padding the scroller bleeds through so pills start where row content does. */+ readonly gutter: number;+ },) {const selectedEnvironment = props.environments.find((environment) => environment.environmentId === props.selectedEnvironmentId,@@ -24,7 +27,8 @@ export function ThreadListFilters(<ScrollViewhorizontalshowsHorizontalScrollIndicator={false}- contentContainerStyle={{ paddingHorizontal: 16, paddingTop: 2, paddingBottom: 10, gap: 8 }}+ style={{ marginHorizontal: -props.gutter }}+ contentContainerStyle={{ paddingHorizontal: 20, paddingTop: 2, paddingBottom: 10, gap: 8 }}><ListFilterMenulabel={selectedEnvironment?.label ?? "All environments"}diff --git a/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx b/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsxindex d5a38188a7a..ce5ad0b6e8f 100644--- a/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx+++ b/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx@@ -567,7 +567,6 @@ function ThreadNavigationSidebarPane(snoozeWakeLabelText={item.snoozeWakeLabelText}timeLabel={item.timeLabel}project={projectByKey.get(scopeKey) ?? null}- projectTitle={projectTitleByProjectKey.get(scopeKey)}providerInstance={resolveProviderInstance(thread)}providers={providersByEnvironmentId.get(thread.environmentId)}environmentLabel={diff --git a/apps/mobile/src/features/threads/thread-list-v2-items.tsx b/apps/mobile/src/features/threads/thread-list-v2-items.tsxindex 57f2d75671d..6c270a0144c 100644--- a/apps/mobile/src/features/threads/thread-list-v2-items.tsx+++ b/apps/mobile/src/features/threads/thread-list-v2-items.tsx@@ -68,6 +68,12 @@ import { ThreadSearchMatchExcerpt } from "./thread-search-match";import { PullRequestGlyph } from "../pull-requests/pullRequestGlyphs";import { pullRequestStatus } from "../pull-requests/pullRequestStatus";+const TITLE_FAVICON_SIZE = 15;+// Centers the favicon on the first line of the text-base title.+const TITLE_FAVICON_OFFSET = 4;+// Lines below the title start where the title text does.+const TITLE_TEXT_INSET = TITLE_FAVICON_SIZE + 8;+interface StatusLabel {readonly label: string;readonly icon: AppSymbolName;@@ -552,7 +558,6 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {readonly timeLabel: string;readonly snoozePresetMinute: string;readonly project: EnvironmentProject | null;- readonly projectTitle?: string;readonly providers: ReadonlyArray<ThreadListProvider> | undefined;readonly providerInstance: ThreadRowProviderInstance | null;readonly environmentLabel: string | null;@@ -996,119 +1001,117 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {? `Opens the thread. Swipe left to ${primaryAction.label.toLowerCase()}.`: `Opens the thread. Swipe left for ${primaryAction.label.toLowerCase()} and snooze actions.`;+ const titleTextInset = props.project ? TITLE_TEXT_INSET : 0;const cardContent = (<>- <View className="flex-row items-center gap-1.5">+ <View className="flex-row items-start gap-2">{props.project ? (- <ProjectFavicon- environmentId={thread.environmentId}- faviconPath={props.project.faviconPath}- projectIcon={props.project.projectIcon}- size={15}- projectTitle={props.project.title}- workspaceRoot={props.project.workspaceRoot}- />+ <View style={{ marginTop: TITLE_FAVICON_OFFSET }}>+ <ProjectFavicon+ environmentId={thread.environmentId}+ faviconPath={props.project.faviconPath}+ projectIcon={props.project.projectIcon}+ size={TITLE_FAVICON_SIZE}+ projectTitle={props.project.title}+ workspaceRoot={props.project.workspaceRoot}+ />+ </View>) : null}<TextclassName={cn(- "flex-1 text-sm font-t3-medium",+ "flex-1 text-base",+ !recede && "font-t3-medium",selected- ? selectedThreadRowColors.mutedForegroundClassName- : rowAppearance.mutedForegroundClassName,+ ? selectedThreadRowColors.foregroundClassName+ : rowAppearance.foregroundClassName,)}- numberOfLines={1}+ numberOfLines={2}>- {props.projectTitle ?? props.project?.title ?? ""}+ {thread.title}</Text>- {props.hasQueuedMessages ? <QueuedMessageIcon selected={selected} /> : null}- {pinnedRow ? (- <SymbolView- name="pin"- size={11}- tintColorClassName={rowAppearance.mutedIconTintClassName}- type="monochrome"- />- ) : null}- {showsWoke ? (- <Pressable- className="-m-2.5 flex-row items-center gap-1 p-2.5"- accessibilityRole="button"- accessibilityLabel="Dismiss Woke notification"- onPress={handleAcknowledgeWoke}- onLongPress={() => undefined}- style={({ pressed }) => ({ opacity: pressed ? 0.6 : 1 })}- >+ <View className="flex-row items-center gap-1.5" style={{ marginTop: 3 }}>+ {props.hasQueuedMessages ? <QueuedMessageIcon selected={selected} /> : null}+ {pinnedRow ? (<SymbolView- name="bell.badge"- size={13}- tintColorClassName={- selected ? selectedThreadRowColors.iconTintClassName : "accent-warning-foreground"- }+ name="pin"+ size={11}+ tintColorClassName={rowAppearance.mutedIconTintClassName}type="monochrome"- weight="semibold"/>- <Text- className={cn(- "text-xs font-t3-bold",- selected ? selectedThreadRowColors.foregroundClassName : "text-warning-foreground",- )}+ ) : null}+ {showsWoke ? (+ <Pressable+ className="-m-2.5 flex-row items-center gap-1 p-2.5"+ accessibilityRole="button"+ accessibilityLabel="Dismiss Woke notification"+ onPress={handleAcknowledgeWoke}+ onLongPress={() => undefined}+ style={({ pressed }) => ({ opacity: pressed ? 0.6 : 1 })}>- Woke- </Text>- </Pressable>- ) : statusLabel ? (- <View className="flex-row items-center gap-1">- <SymbolView- name={statusLabel.icon}- size={13}- tintColorClassName={- selected ? selectedThreadRowColors.iconTintClassName : statusLabel.iconTintClassName- }- type="monochrome"- weight="semibold"- />+ <SymbolView+ name="bell.badge"+ size={13}+ tintColorClassName={+ selected ? selectedThreadRowColors.iconTintClassName : "accent-warning-foreground"+ }+ type="monochrome"+ weight="semibold"+ />+ <Text+ className={cn(+ "text-xs font-t3-bold",+ selected+ ? selectedThreadRowColors.foregroundClassName+ : "text-warning-foreground",+ )}+ >+ Woke+ </Text>+ </Pressable>+ ) : statusLabel ? (+ <View className="flex-row items-center gap-1">+ <SymbolView+ name={statusLabel.icon}+ size={13}+ tintColorClassName={+ selected+ ? selectedThreadRowColors.iconTintClassName+ : statusLabel.iconTintClassName+ }+ type="monochrome"+ weight="semibold"+ />+ <Text+ className={cn(+ "text-xs font-t3-bold",+ (status === "working" || status === "waiting") && "tabular-nums",+ selected ? selectedThreadRowColors.foregroundClassName : statusLabel.className,+ )}+ >+ {statusLabel.label}+ {status === "working" ? (+ <ThreadListV2Duration startedAt={resolveThreadWorkingStartedAt(thread)} />+ ) : status === "waiting" ? (+ <ThreadListV2Duration startedAt={thread.latestRun?.completedAt ?? null} />+ ) : null}+ </Text>+ </View>+ ) : (<TextclassName={cn(- "text-xs font-t3-bold",- (status === "working" || status === "waiting") && "tabular-nums",- selected ? selectedThreadRowColors.foregroundClassName : statusLabel.className,+ "text-xs tabular-nums",+ selected+ ? selectedThreadRowColors.foregroundClassName+ : rowAppearance.tertiaryForegroundClassName,)}>- {statusLabel.label}- {status === "working" ? (- <ThreadListV2Duration startedAt={resolveThreadWorkingStartedAt(thread)} />- ) : status === "waiting" ? (- <ThreadListV2Duration startedAt={thread.latestRun?.completedAt ?? null} />- ) : null}+ {timeLabel}</Text>- </View>- ) : (- <Text- className={cn(- "text-xs tabular-nums",- selected- ? selectedThreadRowColors.foregroundClassName- : rowAppearance.tertiaryForegroundClassName,- )}- >- {timeLabel}- </Text>- )}+ )}+ </View></View>- <Text- className={cn(- "mt-1 text-base",- !recede && "font-t3-medium",- selected- ? selectedThreadRowColors.foregroundClassName- : rowAppearance.foregroundClassName,- )}- numberOfLines={2}- >- {thread.title}- </Text>{props.searchMatch ? (- <View className="mt-1">+ <View className="mt-1" style={{ paddingLeft: titleTextInset }}><ThreadSearchMatchExcerptsidebar={sidebarPane}match={props.searchMatch}@@ -1117,7 +1120,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {/></View>) : null}- <View className="mt-1 flex-row items-center gap-2">+ <View className="mt-1 flex-row items-center gap-2" style={{ paddingLeft: titleTextInset }}>{(status === "failed" || status === "limited") && thread.runtime?.lastError ? (<TextclassName={cn(@@ -1132,45 +1135,9 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {>{thread.runtime.lastError}</Text>- ) : thread.branch || props.environmentLabel ? (+ ) : props.environmentLabel ? (<View className="min-w-0 flex-1 flex-row items-center gap-1">- <Text- className={cn(- "shrink text-xs",- selected- ? selectedThreadRowColors.mutedForegroundClassName- : rowAppearance.mutedForegroundClassName,- )}- numberOfLines={1}- >- {thread.branch ? (- <Text- className={cn(- "text-xs",- selected- ? selectedThreadRowColors.mutedForegroundClassName- : rowAppearance.mutedForegroundClassName,- )}- style={{ fontFamily: MONO_FONT }}- >- {thread.branch}- </Text>- ) : null}- {thread.branch && props.environmentLabel ? " · " : null}- {props.environmentLabel ? (- <Text- className={cn(- "text-xs",- selected- ? selectedThreadRowColors.mutedForegroundClassName- : rowAppearance.tertiaryForegroundClassName,- )}- >- {props.environmentLabel}- </Text>- ) : null}- </Text>- {props.environmentLabel && props.environmentMachine ? (+ {props.environmentMachine ? (<EnvironmentMachineSymbolkind={props.environmentMachine}size={11}@@ -1181,6 +1148,17 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {}/>) : null}+ <Text+ className={cn(+ "shrink text-xs",+ selected+ ? selectedThreadRowColors.mutedForegroundClassName+ : rowAppearance.tertiaryForegroundClassName,+ )}+ numberOfLines={1}+ >+ {props.environmentLabel}+ </Text></View>) : (<View className="flex-1" />