Skip to content

Commit a5a4c01

Browse files
committed
fix(mobile): scale leading icons with app and system text
1 parent 197343f commit a5a4c01

1 file changed

Lines changed: 24 additions & 22 deletions

File tree

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

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,10 @@ import {
6565
import { QueuedMessageIcon } from "./queued-message-icon";
6666
import { shouldRecedeThreadRow } from "./thread-row-emphasis";
6767
import { ThreadSearchMatchExcerpt } from "./thread-search-match";
68+
import { useScaledTextRole } from "../settings/appearance/useScaledTextRole";
6869
import { PullRequestGlyph } from "../pull-requests/pullRequestGlyphs";
6970
import { pullRequestStatus } from "../pull-requests/pullRequestStatus";
7071

71-
const TITLE_FAVICON_SIZE = 15;
72-
// Lines below the title start where the title text does.
73-
const TITLE_TEXT_INSET = TITLE_FAVICON_SIZE + 8;
74-
7572
interface StatusLabel {
7673
readonly label: string;
7774
readonly icon: AppSymbolName;
@@ -600,7 +597,12 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
600597
readonly searchQuery?: string;
601598
readonly simultaneousSwipeGesture?: ComponentProps<typeof ThreadSwipeable>["simultaneousWith"];
602599
}) {
603-
const { width: windowWidth } = useWindowDimensions();
600+
const { width: windowWidth, fontScale } = useWindowDimensions();
601+
const titleTypography = useScaledTextRole("body");
602+
const metadataTypography = useScaledTextRole("label");
603+
const projectIconSize = titleTypography.fontSize * 1.25 * fontScale;
604+
const machineIconSize = metadataTypography.fontSize * fontScale;
605+
const titleLineHeight = titleTypography.lineHeight * fontScale;
604606
const {
605607
thread,
606608
variant,
@@ -999,19 +1001,21 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
9991001
? `Opens the thread. Swipe left to ${primaryAction.label.toLowerCase()}.`
10001002
: `Opens the thread. Swipe left for ${primaryAction.label.toLowerCase()} and snooze actions.`;
10011003

1002-
const titleTextInset = props.project ? TITLE_TEXT_INSET : 0;
1004+
const titleTextInset = props.project ? projectIconSize + 8 : 0;
10031005
const cardContent = (
10041006
<>
1005-
<View className="flex-row items-center gap-2">
1007+
<View className="flex-row items-start gap-2">
10061008
{props.project ? (
1007-
<ProjectFavicon
1008-
environmentId={thread.environmentId}
1009-
faviconPath={props.project.faviconPath}
1010-
projectIcon={props.project.projectIcon}
1011-
size={TITLE_FAVICON_SIZE}
1012-
projectTitle={props.project.title}
1013-
workspaceRoot={props.project.workspaceRoot}
1014-
/>
1009+
<View className="justify-center" style={{ height: titleLineHeight }}>
1010+
<ProjectFavicon
1011+
environmentId={thread.environmentId}
1012+
faviconPath={props.project.faviconPath}
1013+
projectIcon={props.project.projectIcon}
1014+
size={projectIconSize}
1015+
projectTitle={props.project.title}
1016+
workspaceRoot={props.project.workspaceRoot}
1017+
/>
1018+
</View>
10151019
) : null}
10161020
<Text
10171021
className={cn(
@@ -1021,11 +1025,11 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
10211025
? selectedThreadRowColors.foregroundClassName
10221026
: rowAppearance.foregroundClassName,
10231027
)}
1024-
numberOfLines={1}
1028+
numberOfLines={2}
10251029
>
10261030
{thread.title}
10271031
</Text>
1028-
<View className="flex-row items-center gap-1.5">
1032+
<View className="flex-row items-center gap-1.5" style={{ minHeight: titleLineHeight }}>
10291033
{props.hasQueuedMessages ? <QueuedMessageIcon selected={selected} /> : null}
10301034
{pinnedRow ? (
10311035
<SymbolView
@@ -1136,7 +1140,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
11361140
{props.environmentMachine ? (
11371141
<EnvironmentMachineSymbol
11381142
kind={props.environmentMachine}
1139-
size={11}
1143+
size={machineIconSize}
11401144
tintColorClassName={
11411145
selected
11421146
? selectedThreadRowColors.mutedIconTintClassName
@@ -1157,9 +1161,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
11571161
</Text>
11581162
</View>
11591163
) : (
1160-
<Text accessible={false} className="flex-1 text-xs">
1161-
{" "}
1162-
</Text>
1164+
<View className="flex-1" />
11631165
)}
11641166
{pr ? (
11651167
<Pressable
@@ -1299,7 +1301,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
12991301
environmentId={thread.environmentId}
13001302
faviconPath={props.project.faviconPath}
13011303
projectIcon={props.project.projectIcon}
1302-
size={15}
1304+
size={projectIconSize}
13031305
projectTitle={props.project.title}
13041306
workspaceRoot={props.project.workspaceRoot}
13051307
/>

0 commit comments

Comments
 (0)