Skip to content

Commit f933b2c

Browse files
committed
fix(web): preserve composer model labels before overflow
1 parent 2cef5d6 commit f933b2c

3 files changed

Lines changed: 20 additions & 15 deletions

File tree

apps/web/src/components/ChatView.browser.tsx

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9146,7 +9146,10 @@ describe("ChatView timeline estimator parity (full app)", () => {
91469146
});
91479147

91489148
const footer = await waitForElement(
9149-
() => document.querySelector<HTMLElement>('[data-chat-composer-footer="true"]'),
9149+
() =>
9150+
Array.from(
9151+
document.querySelectorAll<HTMLElement>('[data-chat-composer-footer="true"]'),
9152+
).find((candidate) => candidate.getBoundingClientRect().width > 0) ?? null,
91509153
"Unable to find composer footer.",
91519154
);
91529155
const leftActions = await waitForElement(
@@ -9194,7 +9197,7 @@ describe("ChatView timeline estimator parity (full app)", () => {
91949197
}
91959198
});
91969199

9197-
it("protects model and reasoning labels before shrinking interaction and access", async () => {
9200+
it("keeps model and reasoning labels in the icon-only footer", async () => {
91989201
const mounted = await mountChatView({
91999202
viewport: WIDE_FOOTER_VIEWPORT,
92009203
snapshot: fixture.snapshot,
@@ -9235,28 +9238,30 @@ describe("ChatView timeline estimator parity (full app)", () => {
92359238

92369239
try {
92379240
await waitForServerConfigToApply();
9238-
await mounted.setContainerSize({
9239-
width: 900,
9240-
height: WIDE_FOOTER_VIEWPORT.height,
9241+
await mounted.setViewport({
9242+
...WIDE_FOOTER_VIEWPORT,
9243+
width: 560,
92419244
});
92429245

92439246
const footer = await waitForElement(
92449247
() => document.querySelector<HTMLElement>('[data-chat-composer-footer="true"]'),
92459248
"Unable to find composer footer.",
92469249
);
9250+
await vi.waitFor(() => {
9251+
expect(footer.dataset.chatComposerFooterIconOnly).toBe("true");
9252+
expect(footer.dataset.chatComposerFooterCompact).toBe("false");
9253+
});
92479254
const modelButton = await waitForElement(
9248-
findComposerProviderModelPicker,
9255+
() => footer.querySelector<HTMLButtonElement>('[data-chat-provider-model-picker="true"]'),
92499256
"Unable to find provider model picker.",
92509257
);
92519258
const reasoningButton = await waitForButtonByTextWithin(footer, "Medium");
9252-
const interactionButton = await waitForButtonByTextWithin(footer, "Build");
9253-
const accessButton = await waitForButtonByTextWithin(footer, "Full access");
9254-
9255-
expect(footer.dataset.chatComposerFooterIconOnly).toBe("false");
9259+
expect(modelButton.textContent).toContain("GPT-5");
9260+
expect(reasoningButton.textContent).toBe("Medium");
9261+
expect(modelButton.getBoundingClientRect().width).toBeGreaterThan(32);
9262+
expect(reasoningButton.getBoundingClientRect().width).toBeGreaterThan(32);
92569263
expect(getComputedStyle(modelButton).flexShrink).toBe("0");
92579264
expect(getComputedStyle(reasoningButton).flexShrink).toBe("0");
9258-
expect(getComputedStyle(interactionButton).flexShrink).toBe("1");
9259-
expect(getComputedStyle(accessButton).flexShrink).toBe("1");
92609265
} finally {
92619266
await mounted.cleanup();
92629267
}

apps/web/src/components/chat/ChatComposer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,7 +1498,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
14981498
model: selectedModel,
14991499
models: selectedProviderModels,
15001500
modelOptions: composerModelOptions?.[selectedInstanceId],
1501-
iconOnly: isComposerFooterIconOnly,
1501+
iconOnly: isComposerFooterCompact,
15021502
});
15031503
const pendingPrimaryAction = useMemo(
15041504
() =>
@@ -3622,7 +3622,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
36223622
)}
36233623
>
36243624
<ProviderModelPicker
3625-
compact={isComposerFooterIconOnly}
3625+
compact={isComposerFooterCompact}
36263626
activeInstanceId={selectedInstanceId}
36273627
model={selectedModelForPickerWithCustomFallback}
36283628
lockedProvider={lockedProvider}

apps/web/src/components/chat/ProviderModelPicker.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export const ProviderModelPicker = memo(function ProviderModelPicker(props: {
130130
data-chat-provider-model-picker="true"
131131
className={cn(
132132
"min-w-0 justify-start overflow-hidden whitespace-nowrap px-2 text-muted-foreground/70 hover:text-foreground/80 [&_svg]:mx-0",
133-
props.compact ? "max-w-42 shrink" : "max-w-48 shrink-0 sm:max-w-56 sm:px-3",
133+
props.compact ? "max-w-42 shrink" : "min-w-20 max-w-48 shrink-0 sm:max-w-56 sm:px-3",
134134
props.triggerClassName,
135135
)}
136136
disabled={props.disabled}

0 commit comments

Comments
 (0)