Skip to content

Commit a40bdee

Browse files
author
Waleed Latif
committed
fix(desktop): cover the Resource header bar too
The first pass found its surfaces by grepping one exact class string, which turned up the minority header. `ResourceHeader` is the same bar written as `px-4 py-[8.5px]`, and it is the one logs, files, tables, knowledge and scheduled tasks use — plus every loading fallback. Those all still drew under the traffic lights, and on the breadcrumb surfaces the occluded element is an interactive popover button, not just a title. Share the lane math as TITLE_BAR_LANE_PT and compose it from both bar geometries, which genuinely differ (the Resource bar is bordered and has a min height). Nothing nests one bar inside the other, so no reset is needed: the only out-of-pane render is the landing tables preview. Move the variable's `0px` default to `:root` alongside the other desktop-title-bar vars, so it is defined for bars outside `.workspace-content-shell` — the standalone settings shell and that landing preview — where an undefined var() inside calc() would be invalid at computed-value time and drop padding-top entirely. That replaces the per-call fallback, leaving one default instead of two that can drift. Fold the assertions into the existing desktop title-bar surface audit rather than a second audit file with its own conventions. The standalone guard is gone: it keyed on one spelling of the geometry, so it was blind to `px-4 py-[8.5px]` — the very re-derivation that made this pass necessary.
1 parent 4fdffed commit a40bdee

5 files changed

Lines changed: 53 additions & 70 deletions

File tree

apps/sim/app/_shell/desktop-title-bar-surfaces.test.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ const workspaceChrome = read(
1414
)
1515
const sidebar = read('../workspace/[workspaceId]/w/components/sidebar/sidebar.tsx')
1616
const globalStyles = read('../_styles/globals.css')
17+
const pageHeaderBar = read('../../components/page-header-bar.ts')
18+
const resourceHeader = read(
19+
'../workspace/[workspaceId]/components/resource/components/resource-header/resource-header.tsx'
20+
)
1721

1822
describe('desktop title-bar surface audit', () => {
1923
it('applies the safe-area shell only when the auth route is login', () => {
@@ -65,4 +69,26 @@ describe('desktop title-bar surface audit', () => {
6569
expect(sidebar).toContain('[[data-sim-desktop-title-bar=inset]_&]:pt-[var(')
6670
expect(sidebar).not.toMatch(/\[\[data-sim-desktop-title-bar=inset\]_&\]:pt-\d/)
6771
})
72+
73+
it('defines the content-pane lane once, defaulting to zero', () => {
74+
// A `:root` default keeps the variable defined for bars that render outside
75+
// `.workspace-content-shell` (the standalone settings shell at /account,
76+
// /organization/[id], /selfhost; the landing tables preview). An undefined var()
77+
// inside calc() is invalid at computed-value time and drops padding-top entirely.
78+
expect(globalStyles).toMatch(/:root\s*\{[^}]*--workspace-content-title-bar-inset:\s*0px/s)
79+
expect(globalStyles).toContain(
80+
'.workspace-content-shell[data-sidebar-collapsed] {\n --workspace-content-title-bar-inset: var(--desktop-title-bar-height);'
81+
)
82+
})
83+
84+
it('reserves that lane in every top-of-pane header bar', () => {
85+
// Both top-bar geometries must compose the shared lane padding. A bare
86+
// `pt-`/`py-[8.5px]` in either is the bug: the bar then draws under the traffic
87+
// lights and the sidebar expander whenever the sidebar is collapsed on desktop.
88+
expect(pageHeaderBar).toContain('pt-[calc(8.5px+var(--workspace-content-title-bar-inset))]')
89+
expect(pageHeaderBar).toContain('TITLE_BAR_LANE_PT')
90+
91+
expect(resourceHeader).toContain('TITLE_BAR_LANE_PT')
92+
expect(resourceHeader).not.toMatch(/py-\[8\.5px\]/)
93+
})
6894
})

apps/sim/app/_styles/globals.css

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
--sidebar-collapsed-width: 51px; /* icon rail on web; desktop overrides to 0 before first paint */
1515
--sidebar-expanded-width: 248px; /* SIDEBAR_WIDTH.DEFAULT; the width to restore to, held even while collapsed */
1616
--desktop-title-bar-height: 0px; /* macOS traffic-light lane; desktop overrides before first paint */
17+
--workspace-content-title-bar-inset: 0px; /* lane the content pane must leave clear; only non-zero when the pane, not the sidebar, sits under it */
1718
--desktop-title-bar-inset-x: 0px; /* clearance past the traffic lights; desktop overrides */
1819
--desktop-title-bar-control-offset: 0px; /* centres a lane control; desktop overrides */
1920
--desktop-title-bar-control-size: 0px; /* control seated in the lane; desktop overrides */
@@ -122,10 +123,6 @@ html[data-sim-desktop-title-bar="inset"]
122123
letter-spacing: 0.02em;
123124
}
124125

125-
.workspace-content-shell {
126-
--workspace-content-title-bar-inset: 0px;
127-
}
128-
129126
.workspace-content-shell[data-sidebar-collapsed] {
130127
--workspace-content-title-bar-inset: var(--desktop-title-bar-height);
131128
}

apps/sim/app/workspace/[workspaceId]/components/resource/components/resource-header/resource-header.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import {
3131
} from '@sim/emcn'
3232
import { ArrowUpLeft } from 'lucide-react'
3333
import { createPortal } from 'react-dom'
34+
import { TITLE_BAR_LANE_PT } from '@/components/page-header-bar'
3435
import { InlineRenameInput } from '@/app/workspace/[workspaceId]/components/inline-rename-input'
3536
import { FloatingOverflowText } from '@/app/workspace/[workspaceId]/components/resource/components/floating-overflow-text'
3637

@@ -131,7 +132,10 @@ export const ResourceHeader = memo(function ResourceHeader({
131132
return (
132133
<div
133134
ref={headerRef}
134-
className='flex min-h-[48px] items-center border-[var(--border)] border-b px-4 py-[8.5px]'
135+
className={cn(
136+
'flex min-h-[48px] items-center border-[var(--border)] border-b px-4 pb-[8.5px]',
137+
TITLE_BAR_LANE_PT
138+
)}
135139
>
136140
<div className='flex min-w-0 flex-1 items-center justify-between gap-3'>
137141
<div className='flex min-w-0 flex-1 items-center gap-2 overflow-hidden'>

apps/sim/components/page-header-bar.test.ts

Lines changed: 0 additions & 51 deletions
This file was deleted.
Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
/**
2-
* The canonical top-of-page header bar worn by every workspace surface that puts a
3-
* back chip, tab switcher, or page actions above its content (settings, integrations,
4-
* skills, credential and block detail, upgrade).
2+
* Top padding for a bar sitting at the very top of the workspace content pane.
53
*
6-
* Single source of truth for that chrome — never re-derive the geometry per page. It
7-
* was previously copied verbatim into seven files, which is how every one of them came
8-
* to overlap the macOS traffic lights at once.
4+
* Folds in `--workspace-content-title-bar-inset`, the height that pane must leave
5+
* clear for the desktop shell's inset title bar. That variable is `0px` everywhere
6+
* except the macOS desktop app with the sidebar collapsed — the one arrangement where
7+
* the pane, rather than the sidebar, sits beneath the traffic lights and the sidebar
8+
* expander. Without it a top bar draws underneath both, which hides its controls and
9+
* can leave them unclickable.
910
*
10-
* The top padding folds in `--workspace-content-title-bar-inset`, the height the
11-
* workspace content pane must leave clear for the desktop shell's inset title bar.
12-
* That variable is `0px` everywhere except the macOS desktop app with the sidebar
13-
* collapsed — the only arrangement where the content pane, rather than the sidebar,
14-
* sits beneath the traffic lights and the sidebar expander — so this is inert on the
15-
* web and costs consumers nothing.
11+
* Compose this rather than writing `pt-[8.5px]`: the app has two top-bar geometries
12+
* ({@link PAGE_HEADER_BAR} and the `Resource` header's bordered variant), and the lane
13+
* math has to stay identical across them.
1614
*/
17-
export const PAGE_HEADER_BAR =
18-
'flex flex-shrink-0 items-center bg-[var(--bg)] px-[16px] pt-[calc(8.5px+var(--workspace-content-title-bar-inset))] pb-[8.5px]'
15+
export const TITLE_BAR_LANE_PT = 'pt-[calc(8.5px+var(--workspace-content-title-bar-inset))]'
16+
17+
/**
18+
* The top-of-page header bar worn by the surfaces that put a back chip, tab switcher,
19+
* or page actions above their content. `Resource`-based pages (tables, files, logs,
20+
* knowledge, scheduled tasks) use their own bordered bar and compose
21+
* {@link TITLE_BAR_LANE_PT} directly.
22+
*
23+
* Single source of truth for this geometry — never re-derive it per page.
24+
*/
25+
export const PAGE_HEADER_BAR = `flex flex-shrink-0 items-center bg-[var(--bg)] px-4 ${TITLE_BAR_LANE_PT} pb-[8.5px]`

0 commit comments

Comments
 (0)