Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 3.8k
fix(desktop): keep page headers clear of the traffic lights#6098
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
ea9a748b3eeca8d5b160675eccb98cbdccf11aa4bfFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -31,6 +31,7 @@ import { | ||
| } from '@sim/emcn' | ||
| import { ArrowUpLeft } from 'lucide-react' | ||
| import { createPortal } from 'react-dom' | ||
| import { TITLE_BAR_LANE_PT } from '@/components/page-header-bar' | ||
| import { InlineRenameInput } from '@/app/workspace/[workspaceId]/components/inline-rename-input' | ||
| import { FloatingOverflowText } from '@/app/workspace/[workspaceId]/components/resource/components/floating-overflow-text' | ||
| @@ -131,7 +132,10 @@ export const ResourceHeader = memo(function ResourceHeader({ | ||
| return ( | ||
| <div | ||
| ref={headerRef} | ||
| className='flex min-h-[48px] items-center border-[var(--border)] border-b px-4 py-[8.5px]' | ||
| className={cn( | ||
| 'flex min-h-[48px] items-center border-[var(--border)] border-b px-4 pb-[8.5px]', | ||
| TITLE_BAR_LANE_PT | ||
| )} | ||
waleedlatif1 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. cursor[bot] marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| > | ||
| <div className='flex min-w-0 flex-1 items-center justify-between gap-3'> | ||
| <div className='flex min-w-0 flex-1 items-center gap-2 overflow-hidden'> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -22,17 +22,26 @@ const SLIDE_TRANSITION = | ||
| * The peek card's floating chrome. | ||
| * | ||
| * Every value is an existing token: `rounded-lg` is `--radius`, matching the content | ||
| * pane it floats beside; `--border` is that pane's border; `shadow-overlay` and | ||
| * `--z-modal` are what the app's other edge-anchored panels use. The card's fill is | ||
| * the sidebar's own `--surface-1`, so docked and floating are the same surface. | ||
| * pane it floats beside; `--border` is that pane's border; `--z-modal` is what the | ||
| * app's other edge-anchored panels use. The card's fill is the sidebar's own | ||
| * `--surface-1`, so docked and floating are the same surface. | ||
| * | ||
| * Deliberately unshadowed. It separates on the same `--border` hairline the content | ||
| * pane beside it uses; `--shadow-overlay` reads as too heavy at this size, where the | ||
| * card abuts the window edge rather than floating over the middle of the page. | ||
| * | ||
| * The card hugs its content and caps at the pane height less the lane and the bottom | ||
| * gutter — pinning both edges left a tall empty slab below short lists. It is a flex | ||
| * column so the shell can shrink inside that cap and the sidebar's own scroll region | ||
| * still bounds itself; see the `[data-peek]` rule in `globals.css`. | ||
| * | ||
| * `w-auto` shrink-wraps the inner shell, which `[data-peek]` has already put at the | ||
| * expanded width. It must not be a length: `width` cannot interpolate to or from | ||
| * `auto`, so entering and leaving the peek snap instead of animating — otherwise the | ||
| * card widens as it appears and leaves a shrinking ghost on retract. | ||
| */ | ||
| const PEEK_CARD_CHROME = | ||
| 'absolute top-[var(--desktop-title-bar-height)] bottom-2 left-2 z-[var(--z-modal)] w-auto origin-top-left rounded-lg border border-[var(--border)] shadow-overlay' | ||
| 'absolute top-[var(--desktop-title-bar-height)] left-2 z-[var(--z-modal)] flex max-h-[calc(100%-var(--desktop-title-bar-height)-8px)] w-auto flex-col origin-top-left rounded-lg border border-[var(--border)]' | ||
waleedlatif1 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| /** | ||
| * Peek card enter/exit — the popper idiom rather than a slide, since the card is | ||
| @@ -57,6 +66,20 @@ const PEEK_CARD_EXIT = cn( | ||
| /** The docked rail: in flow, width-animated by the collapse toggle. */ | ||
| const SIDEBAR_SHELL_IN_FLOW = cn('transition-[width]', SLIDE_TRANSITION) | ||
| /** | ||
| * The content pane's own chrome, dropped when the pane sits flush to the window. | ||
| * | ||
| * Collapsing the sidebar in the desktop shell takes the surrounding padding to `0`, | ||
| * which puts the pane hard against the window edge — and its border and radius then | ||
| * draw a hairline outline with rounded corners inset from the square window frame. | ||
| * | ||
| * Keyed off the ancestor attributes rather than React state on purpose: the title-bar | ||
| * attribute is written pre-paint, so a state-driven rule would flash the border on | ||
| * first paint before hydration settles. | ||
| */ | ||
| const CONTENT_PANE_FLUSH = | ||
| '[[data-sim-desktop-title-bar=inset]_[data-sidebar-collapsed]_&]:rounded-none [[data-sim-desktop-title-bar=inset]_[data-sidebar-collapsed]_&]:border-0' | ||
| interface WorkspaceChromeProps { | ||
| children: React.ReactNode | ||
| /** Cookie-derived collapse state from the server layout; seeds the sidebar's first render. */ | ||
| @@ -295,8 +318,16 @@ export function WorkspaceChrome({ | ||
| isCollapsed && '[[data-sim-desktop-title-bar=inset]_&]:p-0' | ||
| )} | ||
| data-sidebar-collapsed={isCollapsed || undefined} | ||
| /* A fullscreen route slides the sidebar away without collapsing it, so the pane | ||
| inherits the traffic-light lane the same way a collapsed sidebar does. */ | ||
| data-content-fullscreen={isFullscreen || undefined} | ||
| > | ||
| <div className='flex-1 overflow-hidden rounded-[8px] border border-[var(--border)] bg-[var(--bg)]'> | ||
| <div | ||
| className={cn( | ||
| 'flex-1 overflow-hidden rounded-[8px] border border-[var(--border)] bg-[var(--bg)]', | ||
| CONTENT_PANE_FLUSH | ||
| )} | ||
| > | ||
| {children} | ||
| </div> | ||
| </div> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /** | ||
| * Top padding for a bar sitting at the very top of the workspace content pane. | ||
| * | ||
| * Folds in `--workspace-content-title-bar-inset`, the height that pane must leave | ||
| * clear for the desktop shell's inset title bar. That variable is `0px` everywhere | ||
| * except the macOS desktop app with the sidebar collapsed — the one arrangement where | ||
| * the pane, rather than the sidebar, sits beneath the traffic lights and the sidebar | ||
| * expander. Without it a top bar draws underneath both, which hides its controls and | ||
| * can leave them unclickable. | ||
| * | ||
| * Compose this rather than writing `pt-[8.5px]`: the app has two top-bar geometries | ||
| * ({@link PAGE_HEADER_BAR} and the `Resource` header's bordered variant), and the lane | ||
| * math has to stay identical across them. | ||
| */ | ||
| export const TITLE_BAR_LANE_PT = 'pt-[calc(8.5px+var(--workspace-content-title-bar-inset))]' | ||
| /** | ||
| * The top-of-page header bar worn by the surfaces that put a back chip, tab switcher, | ||
| * or page actions above their content. `Resource`-based pages (tables, files, logs, | ||
| * knowledge, scheduled tasks) use their own bordered bar and compose | ||
| * {@link TITLE_BAR_LANE_PT} directly. | ||
| * | ||
| * Single source of truth for this geometry — never re-derive it per page. | ||
| */ | ||
| export const PAGE_HEADER_BAR = `flex flex-shrink-0 items-center bg-[var(--bg)] px-4 ${TITLE_BAR_LANE_PT} pb-[8.5px]` |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.