Skip to content

Commit 3354415

Browse files
committed
fix(app): stop the provider row slots squeezing the name on a narrow pane
The fixed trailing slots that keep the row from shifting when the default changes reserve 220px, which is more than a narrow pane can spare: at 360px that left the target name with nothing. Below the sm breakpoint the kind badge and the set-default button now drop out and the name takes the width back. Nothing is lost, since the description already names the adapter and the row itself is the control that sets the default, so the button was only ever a hover affordance for pointer users.
1 parent e02e44f commit 3354415

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

packages/browseros-agent/apps/app/screens/ai-settings/ConfiguredTargetRow.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ export interface ConfiguredTargetRowProps {
3636
* The default marker and the kind badge sit in fixed-width slots. Without
3737
* them, promoting a row adds a DEFAULT badge and drops the "Set as default"
3838
* button, which resizes the row and shifts every other row's badges sideways.
39+
*
40+
* Those slots reserve 220px, which is more than a narrow pane can spare, so
41+
* below `sm` the kind badge and the set-default button drop out and the name
42+
* takes the width back. Nothing is lost: the description already names the
43+
* adapter, and the row itself is the control that sets the default, so the
44+
* button was only ever a hover affordance for pointer users.
3945
*/
4046
export const ConfiguredTargetRow: FC<ConfiguredTargetRowProps> = ({
4147
id,
@@ -93,7 +99,7 @@ export const ConfiguredTargetRow: FC<ConfiguredTargetRowProps> = ({
9399
</span>
94100
</label>
95101

96-
<span className="flex w-[72px] shrink-0 justify-start">
102+
<span className="hidden w-[72px] shrink-0 justify-start sm:flex">
97103
<Badge
98104
variant="secondary"
99105
className="rounded font-semibold text-[10px] uppercase tracking-wide"
@@ -102,7 +108,7 @@ export const ConfiguredTargetRow: FC<ConfiguredTargetRowProps> = ({
102108
</Badge>
103109
</span>
104110

105-
<span className="flex w-[116px] shrink-0 justify-end">
111+
<span className="flex shrink-0 justify-end sm:w-[116px]">
106112
{isSelected ? (
107113
<Badge
108114
variant="secondary"
@@ -114,7 +120,7 @@ export const ConfiguredTargetRow: FC<ConfiguredTargetRowProps> = ({
114120
<Button
115121
variant="outline"
116122
size="sm"
117-
className="opacity-0 transition-opacity focus-visible:opacity-100 group-focus-within:opacity-100 group-hover:opacity-100"
123+
className="hidden opacity-0 transition-opacity focus-visible:opacity-100 group-focus-within:opacity-100 group-hover:opacity-100 sm:inline-flex"
118124
onClick={() => actions[0]?.onSelect()}
119125
>
120126
Set as default

packages/browseros-agent/apps/app/screens/ai-settings/ConfiguredTargetsList.test.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,16 @@ describe('ConfiguredTargetsList', () => {
132132
expect(html).not.toContain('aria-label="Actions for BrowserOS"')
133133
})
134134

135+
// Asserting utility classes rather than layout because the reserved width
136+
// only exists once CSS is applied, which static markup cannot show. The
137+
// guard is here because dropping these turns the row back into 220px of
138+
// reserved trailing slots with nothing left for the name on a narrow pane.
139+
it('does not reserve the trailing slots on a narrow pane', () => {
140+
const html = render()
141+
expect(html).toContain('hidden w-[72px] shrink-0 justify-start sm:flex')
142+
expect(html).toContain('flex shrink-0 justify-end sm:w-[116px]')
143+
})
144+
135145
it('surfaces a list-level error when the agent controller reports one', () => {
136146
const html = render({
137147
coding: { ...coding, pageError: 'agent server unreachable' } as never,

0 commit comments

Comments
 (0)