Skip to content

Commit 351b716

Browse files
committed
fix(platform): reserve shell controls when a panel takes over
1 parent 4cd98d8 commit 351b716

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

‎apps/sim/platform/checks/desktop/renderer.spec.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ test('the actual desktop renderer shares product routes, reserves native chrome
3838
)
3939
).toBeCloseTo(1.25, 1)
4040
await page.screenshot({ path: testInfo.outputPath('desktop-chat.png') })
41+
await page.getByRole('button', { name: 'Collapse sidebar' }).click()
42+
await panel.getByRole('button', { name: 'Expand panel' }).click()
43+
const navigation = await page.getByRole('button', { name: 'Expand sidebar' }).boundingBox()
44+
const firstTab = panel.getByRole('tab', { name: 'Terminal' })
45+
const firstTabBox = await firstTab.boundingBox()
46+
if (!navigation || !firstTabBox) throw new Error('The navigation and first tab must be visible')
47+
expect(firstTabBox.x).toBeGreaterThanOrEqual(navigation.x + navigation.width)
48+
await firstTab.click()
49+
await expect(panel.getByRole('region', { name: 'Terminal history' })).toBeVisible()
50+
await panel.getByRole('button', { name: 'Restore split panel' }).click()
4151
await app.evaluate(({ BrowserWindow }) =>
4252
BrowserWindow.getAllWindows()
4353
.find((w) => w.isVisible())

‎apps/sim/platform/design-system/components/panel-tabs.module.css‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
align-items: center;
1515
flex: none;
1616
gap: var(--spacing-4);
17-
padding-inline: var(--spacing-12);
17+
padding-inline: max(var(--ui-navigation-inset), var(--spacing-12)) var(--spacing-12);
1818
min-inline-size: 0;
1919
height: var(--height-nav);
2020
border-block-end: var(--spacing-stroke-default) solid var(--ui-divider);
@@ -26,6 +26,11 @@
2626
.header button {
2727
-webkit-app-region: no-drag;
2828
}
29+
@container panel-frame (width > 48rem) {
30+
.header:not([data-expanded]) {
31+
padding-inline-start: var(--spacing-12);
32+
}
33+
}
2934
.strip {
3035
min-width: 0;
3136
overflow: auto;

‎apps/sim/platform/design-system/components/panel-tabs.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function PanelTabs({
3838
if (typeof value === 'string') onSelect(value)
3939
}}
4040
>
41-
<header className={styles.header}>
41+
<header className={styles.header} data-expanded={expanded || undefined}>
4242
<div className={styles.strip}>
4343
<Tabs.List className={styles.tabs} aria-label='Chat panel tabs' activateOnFocus>
4444
{tabs.map((tab) => (

0 commit comments

Comments
 (0)