Skip to content

Commit 066a2d7

Browse files
committed
fix(mobile): preserve ACP labels across thread layouts
1 parent 30201c2 commit 066a2d7

3 files changed

Lines changed: 40 additions & 4 deletions

File tree

‎apps/mobile/src/components/ComposerModelControl.tsx‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,24 @@ export function ComposerModelControl(props: {
7979
/>
8080
)
8181
}
82-
label={providerNameLabel ? `${providerNameLabel} · ${shortLabel}` : shortLabel}
82+
label={providerNameLabel ?? shortLabel}
83+
labelEllipsizeMode={providerNameLabel ? "middle" : undefined}
8384
iconOnly={props.iconOnly}
85+
suffixWidth={providerNameLabel ? 96 : undefined}
8486
suffix={
85-
summary ? (
87+
providerNameLabel ? (
88+
<Text
89+
className={
90+
props.size === "large"
91+
? "text-sm text-foreground-muted"
92+
: "text-xs text-foreground-muted"
93+
}
94+
numberOfLines={1}
95+
>
96+
{shortLabel}
97+
{summary ? ` · ${summary}` : ""}
98+
</Text>
99+
) : summary ? (
86100
<Text
87101
className={
88102
props.size === "large"

‎apps/mobile/src/components/ComposerToolbar.tsx‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ export function ComposerInlineControl(props: {
3232
readonly icon?: ComponentProps<typeof SymbolView>["name"];
3333
readonly renderIcon?: (size: number) => ReactNode;
3434
readonly label: string;
35+
readonly labelEllipsizeMode?: ComponentProps<typeof Text>["ellipsizeMode"];
3536
readonly suffix?: ReactNode;
37+
readonly suffixWidth?: number;
3638
/** Show only the icon and chevron; the label still names the control for accessibility. */
3739
readonly iconOnly?: boolean;
3840
readonly maxWidth?: ViewStyle["maxWidth"];
@@ -94,13 +96,19 @@ export function ComposerInlineControl(props: {
9496
props.emphasized || props.selected ? "text-foreground" : "text-foreground-muted",
9597
)}
9698
numberOfLines={1}
99+
ellipsizeMode={props.labelEllipsizeMode}
97100
>
98101
{props.label}
99102
</Text>
100103
</Animated.View>
101104
)}
102105
{!props.iconOnly && props.suffix ? (
103-
<View className="min-w-0 shrink">{props.suffix}</View>
106+
<View
107+
className={cn("min-w-0", props.suffixWidth === undefined ? "shrink" : "shrink-0")}
108+
style={{ width: props.suffixWidth }}
109+
>
110+
{props.suffix}
111+
</View>
104112
) : null}
105113
{props.showChevron === false ? null : (
106114
<SymbolView

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
758758
: workingLabel) ?? (isUnread ? DONE_STATUS_LABEL : undefined);
759759
const recede = shouldRecedeThreadRow({ status, selected });
760760
const isRegeneratingTitle = thread.titleRegeneration != null;
761-
const rowAccessibilityLabel = `${thread.title}${props.hasQueuedMessages ? ", messages queued to send" : ""}${isRegeneratingTitle ? ", regenerating title" : ""}`;
761+
const rowAccessibilityLabel = `${thread.title}${providerNameLabel ? `, ${providerNameLabel}` : ""}${props.hasQueuedMessages ? ", messages queued to send" : ""}${isRegeneratingTitle ? ", regenerating title" : ""}`;
762762
const timeLabel = props.timeLabel;
763763

764764
const visitThread = useAtomCommand(threadEnvironment.visit, { reportFailure: false });
@@ -1478,6 +1478,20 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
14781478
>
14791479
{thread.title}
14801480
</Text>
1481+
{providerNameLabel ? (
1482+
<Text
1483+
className={cn(
1484+
"text-xs",
1485+
selected
1486+
? selectedThreadRowColors.mutedForegroundClassName
1487+
: rowAppearance.tertiaryForegroundClassName,
1488+
)}
1489+
ellipsizeMode="middle"
1490+
numberOfLines={1}
1491+
>
1492+
{providerNameLabel}
1493+
</Text>
1494+
) : null}
14811495
{props.searchMatch ? (
14821496
<ThreadSearchMatchExcerpt
14831497
sidebar={sidebarPane}

0 commit comments

Comments
 (0)