Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review (simplify/altitude): add Drawer subtitle prop instead of body margin hack

[._.]/ Adam Eivy4a344f7ae789
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 4fe0b0abff..3757e46fcc 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -141,4 +141,4 @@
- **[issue-1956] Extracted a shared SIGTERM→grace→SIGKILL kill-escalation helper for spawn-based jobs** — the identical "SIGTERM, then after 8s escalate to SIGKILL if the tracked child hasn't exited" cancel block was copy-pasted across seven job-cancel paths (`musicVideo/render.js`, `videoTimeline/local.js`, `imageGen/local.js`, `imageGen/codex.js`, `videoGen/local.js`, `loraTraining/index.js`, `trackYoutubeImport.js`). It now lives in one place — `killWithEscalation(proc, { label, stillRunning, delayMs=8000 })` (`server/lib/killWithEscalation.js`) — which preserves each site's exact guard (`job.process === proc` / `activeProcess === proc` / `activeProcs.get(id) === proc`), its exit check (`exitCode === null && signalCode === null`), and its emoji-prefixed single-line warning, while wrapping the out-of-request-lifecycle `setTimeout` callback in try/catch and unref'ing the timer (codex passes `delayMs: 5000`). Behavior-preserving consolidation; covered by a new `killWithEscalation.test.js`. (#1956)
- **[issue-1967] The slide-in `Drawer` primitive gained a tabbed, wider, deep-linkable layout** — the shared right-side config drawer (`client/src/components/Drawer.jsx`) was a single flat scroll in a fixed ~520px panel, so large config surfaces (Edit App, Media Generation Settings, CoS task config) became page-length scrolls. It now takes a `size` prop (`sm`/`md`/`lg`/`xl`, the last two using more of a wide viewport via extra breakpoints; the old `widthClass` stays as a back-compat escape hatch), an optional `tabs` layout that renders a sticky `TabPills` bar under the header (collapsing to a `<select>` on mobile) with a per-tab scroll region that resets on switch, and a `bodyClassName` hook for multi-column tab bodies. A new `useDrawerTab(paramName, defaultTab, tabIds?)` hook backs the active tab with a caller-named URL search param so the open section is shareable/bookmarkable and degrades to the default on a stale link. Fully back-compat — omit `tabs` and it's the original flat drawer (existing EditAppDrawer/SyncDetailDrawer tests unchanged). This is the foundation for the drawer-UX epic (#1966); the per-surface migrations (#1968–#1973) build on it. (Closes #1967)
-- **[issue-1972] SyncDetailDrawer now renders through the shared Drawer primitive** — the per-peer sync-status/detail panel (`client/src/components/sync/SyncDetailDrawer.jsx`) hand-rolled the exact drawer shell (its own backdrop, `fixed inset-y-0 right-0` `<aside>`, header/close button, Esc listener, and body scroll-lock) instead of reusing `client/src/components/Drawer.jsx`. It was the only hand-rolled clone left after the #1967 foundation, so it couldn't inherit future width/animation/a11y/mobile changes. It now mounts as `<Drawer open onClose title="Sync Details" size="sm" closeLabel="Close sync details">`, deleting the duplicated markup plus its own Esc/scroll-lock effects and the now-unused `X` import. Adopting the shared `size="sm"` (520px) replaces the old hand-rolled 480px so the drawer family stays consistent; the record-name subtitle moves from the old two-line header into the top of the body since the primitive header is a single title. Content, action buttons, and behavior are otherwise identical (all 42 existing SyncDetailDrawer/SyncView tests pass unchanged). (Closes #1972)
+- **[issue-1972] SyncDetailDrawer now renders through the shared Drawer primitive** — the per-peer sync-status/detail panel (`client/src/components/sync/SyncDetailDrawer.jsx`) hand-rolled the exact drawer shell (its own backdrop, `fixed inset-y-0 right-0` `<aside>`, header/close button, Esc listener, and body scroll-lock) instead of reusing `client/src/components/Drawer.jsx`. It was the only hand-rolled clone left after the #1967 foundation, so it couldn't inherit future width/animation/a11y/mobile changes. It now mounts as `<Drawer open onClose title="Sync Details" size="sm" closeLabel="Close sync details">`, deleting the duplicated markup plus its own Esc/scroll-lock effects and the now-unused `X` import. Adopting the shared `size="sm"` (520px) replaces the old hand-rolled 480px so the drawer family stays consistent. To preserve its two-line header, the `Drawer` primitive gained an optional `subtitle` prop (rendered under the title in the header) — so the record-name stays a header concern instead of being nudged into the scrollable body with a fragile negative margin. Content, action buttons, and behavior are otherwise identical (all existing SyncDetailDrawer/SyncView/Drawer tests pass). (Closes #1972)
diff --git a/client/src/components/Drawer.jsx b/client/src/components/Drawer.jsx
index a07d5891a9..c1e72f4b04 100644
--- a/client/src/components/Drawer.jsx
+++ b/client/src/components/Drawer.jsx
@@ -40,6 +40,7 @@ export default function Drawer({
open,
onClose,
title,
+ subtitle, // optional second header line (e.g. the open record's name)
children,
size = 'sm',
widthClass, // escape hatch: overrides `size` when provided (back-compat)
@@ -88,7 +89,10 @@ export default function Drawer({
className={`fixed inset-y-0 right-0 z-50 w-full ${resolvedWidth} bg-port-card border-l border-port-border shadow-2xl flex flex-col`}
>
<header className="flex items-center justify-between px-4 py-3 border-b border-port-border">
- <h2 className="text-base font-medium text-white truncate min-w-0 pr-2">{title}</h2>
+ <div className="min-w-0 pr-2">
+ <h2 className="text-base font-medium text-white truncate">{title}</h2>
+ {subtitle && <p className="text-xs text-gray-400 truncate">{subtitle}</p>}
+ </div>
<button
type="button"
onClick={onClose}
diff --git a/client/src/components/Drawer.test.jsx b/client/src/components/Drawer.test.jsx
index ff13f6e1ab..30e9afd82b 100644
--- a/client/src/components/Drawer.test.jsx
+++ b/client/src/components/Drawer.test.jsx
@@ -22,6 +22,20 @@ describe('Drawer', () => {
expect(screen.getByText('form body')).toBeInTheDocument();
});
+ it('renders an optional subtitle as a second header line', () => {
+ render(<Drawer open onClose={() => {}} title="Sync Details" subtitle="My Collection">b</Drawer>);
+ // subtitle is a header concern (not smuggled into the scrollable body)
+ expect(screen.getByText('My Collection')).toBeInTheDocument();
+ // aria-label still reflects only the title, not the subtitle
+ expect(screen.getByRole('dialog')).toHaveAttribute('aria-label', 'Sync Details');
+ });
+
+ it('omits the subtitle line when none is provided', () => {
+ render(<Drawer open onClose={() => {}} title="X">b</Drawer>);
+ // header holds only the title (an <h2>), no stray <p>
+ expect(screen.getByRole('heading', { name: 'X' })).toBeInTheDocument();
+ });
+
describe('size variants (back-compat)', () => {
it('defaults to the original sm (~520px) width', () => {
render(<Drawer open onClose={() => {}} title="X">b</Drawer>);
diff --git a/client/src/components/sync/SyncDetailDrawer.jsx b/client/src/components/sync/SyncDetailDrawer.jsx
index c5524f40cc..b6afefea21 100644
--- a/client/src/components/sync/SyncDetailDrawer.jsx
+++ b/client/src/components/sync/SyncDetailDrawer.jsx
@@ -357,25 +357,17 @@ export default function SyncDetailDrawer({ kind, recordId, onClose }) {
// Migrated onto the shared Drawer primitive (backdrop, scroll-lock, Esc,
// and role="dialog"/aria-modal all come from there). `size="sm"` (520px)
// adopts the shared width bracket instead of the old hand-rolled 480px, so
- // future drawer UX changes land here too. The record-name subtitle moves
- // from the old two-line header into the top of the body since the primitive
- // header is a single title.
+ // future drawer UX changes land here too. The record-name subtitle keeps its
+ // header slot via the primitive's `subtitle` prop.
<Drawer
open
onClose={onClose}
title="Sync Details"
+ subtitle={recordName ?? (recordLoading ? 'Loading…' : null)}
size="sm"
bodyClassName="space-y-5"
closeLabel="Close sync details"
>
- {/* Record-name subtitle (was the header's second line) */}
- {recordName && (
- <p className="text-xs text-gray-400 truncate -mt-1">{recordName}</p>
- )}
- {!recordName && recordLoading && (
- <p className="text-xs text-gray-500 -mt-1">Loading…</p>
- )}
-
{/* Collection preview */}
{kind === 'mediaCollection' && (
<section>