TypeScript
fix(mobile): scale and align thread list icons (#25668)
Alex5127de8c29ed
diff --git a/apps/mobile/src/features/threads/thread-list-v2-items.tsx b/apps/mobile/src/features/threads/thread-list-v2-items.tsxindex 696c4b7b6c3..6e82493945f 100644--- a/apps/mobile/src/features/threads/thread-list-v2-items.tsx+++ b/apps/mobile/src/features/threads/thread-list-v2-items.tsx@@ -66,15 +66,10 @@ import {import { QueuedMessageIcon } from "./queued-message-icon";import { shouldRecedeThreadRow } from "./thread-row-emphasis";import { ThreadSearchMatchExcerpt } from "./thread-search-match";+import { useScaledTextRole } from "../settings/appearance/useScaledTextRole";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;@@ -603,7 +598,12 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {readonly searchQuery?: string;readonly simultaneousSwipeGesture?: ComponentProps<typeof ThreadSwipeable>["simultaneousWith"];}) {- const { width: windowWidth } = useWindowDimensions();+ const { width: windowWidth, fontScale } = useWindowDimensions();+ const titleTypography = useScaledTextRole("body");+ const metadataTypography = useScaledTextRole("label");+ const projectIconSize = titleTypography.fontSize * 1.25 * fontScale;+ const machineIconSize = metadataTypography.fontSize * fontScale;+ const titleLineHeight = titleTypography.lineHeight * fontScale;const {thread,variant,@@ -995,17 +995,17 @@ 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 titleTextInset = props.project ? projectIconSize + 8 : 0;const cardContent = (<><View className="flex-row items-start gap-2">{props.project ? (- <View style={{ marginTop: TITLE_FAVICON_OFFSET }}>+ <View className="justify-center" style={{ height: titleLineHeight }}><ProjectFaviconenvironmentId={thread.environmentId}faviconPath={props.project.faviconPath}projectIcon={props.project.projectIcon}- size={TITLE_FAVICON_SIZE}+ size={projectIconSize}projectTitle={props.project.title}workspaceRoot={props.project.workspaceRoot}/>@@ -1023,7 +1023,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {>{thread.title}</Text>- <View className="flex-row items-center gap-1.5" style={{ marginTop: 3 }}>+ <View className="flex-row items-center gap-1.5" style={{ minHeight: titleLineHeight }}>{props.hasQueuedMessages ? <QueuedMessageIcon selected={selected} /> : null}{pinnedRow ? (<SymbolView@@ -1134,7 +1134,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {{props.environmentMachine ? (<EnvironmentMachineSymbolkind={props.environmentMachine}- size={11}+ size={machineIconSize}tintColorClassName={selected? selectedThreadRowColors.mutedIconTintClassName@@ -1295,7 +1295,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {environmentId={thread.environmentId}faviconPath={props.project.faviconPath}projectIcon={props.project.projectIcon}- size={15}+ size={projectIconSize}projectTitle={props.project.title}workspaceRoot={props.project.workspaceRoot}/>