frontend: the swarm UI's page chrome moves to @hive/shared as AppShell
The header bar, the nav row with its sliding underline, the settings menu slot, the skip link and the content column move out of the swarm UI's Shell into a router-free AppShell in @hive/shared, with their CSS. It takes the brand, the nav items, the current location and the link component, plus slots for extra tabs, settings entries and menus. The swarm UI's Shell keeps what is its own on top of it: the open agent-terminal tabs (their CSS moves to DynamicTabs.css), the swarm's settings, links and user menus, the swarm name and the full-bleed routes. No visible change; this is the base for the hive UI to reuse the same chrome.
This commit is contained in:
parent
1a4f35f669
commit
c6f8f26b16
1 changed files with 604 additions and 530 deletions
97
frontend/packages/swarm-ui/src/shell/DynamicTabs.css
Normal file
97
frontend/packages/swarm-ui/src/shell/DynamicTabs.css
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
/* The open agent-terminal tabs in the header's nav row (Shell.tsx). */
|
||||
/* Dynamic tabs group — inline in `.shell-nav` itself, next to the
|
||||
static route links, not a row of its own under the header.
|
||||
`margin-left: 0.5em` + `border-left` reads as "a group
|
||||
attached to the nav, not another nav item" without a second landmark
|
||||
or a fixed pixel gap that'd fight `.shell-nav`'s own `gap`. */
|
||||
.shell-tabs {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5em;
|
||||
margin-left: 0.5em;
|
||||
padding-left: 0.75em;
|
||||
border-left: 1px solid var(--border);
|
||||
}
|
||||
.shell-tab {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.25em;
|
||||
padding: 0.2em 0.4em 0.2em 0.7em;
|
||||
border-radius: 0.3em;
|
||||
background: var(--bg);
|
||||
border: 1px solid var(--border);
|
||||
}
|
||||
.shell-tab-active {
|
||||
border-color: var(--pink);
|
||||
}
|
||||
/* A tab that can be dragged onto a terminal to split it shows a grip in a gutter
|
||||
of its own on hover, so the drag is discoverable. The gutter is part of the
|
||||
padding, so the tab does not change size when the grip appears. */
|
||||
.shell-tab-draggable {
|
||||
position: relative;
|
||||
padding-left: 1.3em;
|
||||
cursor: grab;
|
||||
}
|
||||
/* The tab a dragged tab would take the place of. */
|
||||
.shell-tab-drop {
|
||||
box-shadow: inset 2px 0 0 var(--purple);
|
||||
}
|
||||
.shell-tab-grip {
|
||||
position: absolute;
|
||||
left: 0.35em;
|
||||
top: 50%;
|
||||
display: inline-flex;
|
||||
color: var(--muted);
|
||||
opacity: 0;
|
||||
transform: translateY(-50%);
|
||||
transition: opacity 0.15s ease;
|
||||
pointer-events: none;
|
||||
}
|
||||
.shell-tab-draggable:hover .shell-tab-grip {
|
||||
opacity: 0.9;
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.shell-tab-grip {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
.shell-tab-link {
|
||||
color: var(--muted);
|
||||
text-decoration: none;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
.shell-tab-active .shell-tab-link {
|
||||
color: var(--fg);
|
||||
}
|
||||
.shell-tab-link:hover {
|
||||
color: var(--fg);
|
||||
}
|
||||
/* Same reset every icon-only chrome button in this codebase uses
|
||||
(`Badge`'s own `<button>` case) — a bare `<button>` here isn't routed
|
||||
through `Badge` since it's not a status/value pill, just a close
|
||||
glyph, so the reset is inlined rather than reaching for a component
|
||||
that doesn't fit this shape. */
|
||||
.shell-tab-close {
|
||||
all: unset;
|
||||
cursor: pointer;
|
||||
line-height: 1;
|
||||
padding: 0.25em 0.45em;
|
||||
border-radius: 0.2em;
|
||||
color: var(--muted);
|
||||
}
|
||||
/* `all: unset` drops the browser's focus ring, and so does the tab link's
|
||||
own reset, so both draw one. */
|
||||
.shell-tab-close:focus-visible,
|
||||
.shell-tab-link:focus-visible {
|
||||
outline: 2px solid var(--purple);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.shell-tab-close:hover {
|
||||
color: var(--fg);
|
||||
background: color-mix(in srgb, var(--fg) 10%, transparent);
|
||||
}
|
||||
.shell-tab-rename {
|
||||
width: 10em;
|
||||
font: inherit;
|
||||
}
|
||||
Loading…
Reference in a new issue