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

fix: give Create index pages one PageHeader frame (#10994)

Adam Eivy953e560aaeca
diff --git a/client/src/components/Layout.test.jsx b/client/src/components/Layout.test.jsx
index 6e1e0afaff..3698ca1a5c 100644
--- a/client/src/components/Layout.test.jsx
+++ b/client/src/components/Layout.test.jsx
@@ -514,17 +514,18 @@ describe('Layout — nav footer', () => {
});
describe('Layout — Game workspace scroll mode', () => {
- it('makes only the Game detail route full-bleed', async () => {
+ it('makes the Game index and detail full-bleed', async () => {
const detail = await renderLayout('/game/example-game');
expect(detail.container.querySelector('#main-content')?.className).toContain('overflow-clip-safe');
detail.unmount();
const index = await renderLayout('/game');
const main = index.container.querySelector('#main-content');
- expect(main?.className).toContain('overflow-auto');
- expect(main?.className).toContain('p-4');
+ expect(main?.className).toContain('overflow-clip-safe');
+ expect(main?.className).not.toContain('p-4');
index.unmount();
+ // A trailing slash is not the registered index path.
const trailingSlashIndex = await renderLayout('/game/');
const trailingSlashMain = trailingSlashIndex.container.querySelector('#main-content');
expect(trailingSlashMain?.className).toContain('overflow-auto');
@@ -616,15 +617,17 @@ describe('Layout — isFullWidthRoute classification', () => {
['/code-animation', true], ['/code-animation/j1', true], ['/code-animation/production/p1', true],
['/code-animations', false], ['/apps', true],
['/eidoverse', true], ['/eidoverse/world', false],
- // Index page stays padded+scrolling; only the DETAIL route is full-width.
- ['/catalog', false], ['/catalog/book/1', true],
- ['/universes', false], ['/universes/u1', true],
- ['/rounds', false], ['/rounds/guide', true],
- ['/story-builder', false], ['/story-builder/s1/step', true],
+ // Create indexes own a PageHeader shell (#10994). Detail routes that
+ // already owned their scroll stay full-width; a different-component
+ // detail that was padded stays padded.
+ ['/catalog', true], ['/catalog/book/1', true],
+ ['/universes', true], ['/universes/u1', true],
+ ['/rounds', true], ['/rounds/guide', true],
+ ['/story-builder', true], ['/story-builder/s1/step', true],
// AI Providers: the index AND its editor sub-routes (a drawer over the same
// page) are full-width, but a sibling path sharing the `/ai` prefix is not.
['/ai', true], ['/ai/presets', true], ['/ai/presets/codex', true], ['/ai/harnesses', true], ['/ai/services/ollama', true], ['/ai/edit/codex', true], ['/airlock', false],
- ['/pipeline', false], ['/pipeline/series/s1', true],
+ ['/pipeline', true], ['/pipeline/series/s1', true], ['/pipeline/editorial-checks', true],
['/local-llm', false], ['/local-llm/m', true],
// Music owns the same full-bleed title/tab/body shell as Media Gen; Music
// Video has its own full-width rule, which a sibling prefix must not hit.
@@ -633,8 +636,21 @@ describe('Layout — isFullWidthRoute classification', () => {
// Media Gen tab shell and must stay full-width with it. `/video-gen` is
// a legacy redirect, not a page with an internal scroller.
['/video', true], ['/video/generate', true], ['/video-gen', false],
- // Game: only a single-segment detail workspace.
- ['/game', false], ['/game/', false], ['/game/g1', true], ['/game/g1/x', false],
+ // Game index is the PageHeader shell; detail stays one segment.
+ ['/game', true], ['/game/', false], ['/game/g1', true], ['/game/g1/x', false],
+ // Create indexes added with #10994. Param siblings of a different
+ // component stay on the padded main.
+ ['/3d', true], ['/3d/m1', false],
+ ['/decks', true], ['/decks/d1', false],
+ ['/fableloom', true], ['/fableloom/l1', true],
+ ['/mood-boards', true], ['/mood-boards/b1', false],
+ ['/sprites', true], ['/sprites/s1', true],
+ ['/authors', true], ['/authors/a1', true],
+ ['/sharing', true], ['/sharing/duplicates', true], ['/sharing/buckets/b1', true],
+ ['/voices', true], ['/voices/v1', true],
+ ['/creative-commission', true], ['/creative-commission/new', true], ['/creative-commission/c1', false],
+ ['/importer', true],
+ ['/start-story', true],
// Apps: detail editor is full-width, but the Add App form is explicitly excluded
// (it has no internal scroll container and would clip below the fold).
['/apps/create', false], ['/apps/create/', false], ['/apps/a1', true], ['/apps/a1/tab', true],
diff --git a/client/src/components/persona/PersonaMasterDetail.jsx b/client/src/components/persona/PersonaMasterDetail.jsx
index 816d437e4b..c6a5c98d99 100644
--- a/client/src/components/persona/PersonaMasterDetail.jsx
+++ b/client/src/components/persona/PersonaMasterDetail.jsx
@@ -15,6 +15,7 @@ const byName = (a, b) => (a.name || '').localeCompare(b.name || '');
export default function PersonaMasterDetail({
basePath, selectedId, title, titleIcon: TitleIcon, intro, singular, plural, fields,
listSecondaryKey, portrait, listRecords, createRecord, updateRecord, deleteRecord, generateImage,
+ hideTitle = false,
}) {
const navigate = useNavigate();
const emptyForm = useMemo(
@@ -169,7 +170,7 @@ export default function PersonaMasterDetail({
return (
<div>
- {title ? (
+ {!hideTitle && (title ? (
<>
<div className="flex items-center justify-between mb-6 flex-wrap gap-3">
<div className="flex items-center gap-3">
@@ -185,7 +186,7 @@ export default function PersonaMasterDetail({
{introBlock}
<CreateButton singular={singular} onClick={() => navigate(`${basePath}/new`)} />
</div>
- )}
+ ))}
<div className="grid grid-cols-1 md:grid-cols-[260px_1fr] gap-4">
<div className="bg-port-card border border-port-border rounded-lg p-2">
diff --git a/client/src/lib/layoutRoutes.js b/client/src/lib/layoutRoutes.js
index 4e64ec8ce0..42aeb20530 100644
--- a/client/src/lib/layoutRoutes.js
+++ b/client/src/lib/layoutRoutes.js
@@ -38,6 +38,24 @@ const EXACT_FULL_WIDTH_PATHS = [
// overflow-auto` scroll region that wraps the centered max-w-4xl
// content — keep it out of the default padded main or it double-pads.
'/timeline',
+ // Create index pages share one PageHeader bar over a `flex-1 overflow-auto`
+ // body (#10994). Exact entries are the indexes whose detail routes are a
+ // different component (and already classified, or intentionally padded).
+ '/catalog',
+ '/universes',
+ '/rounds',
+ '/story-builder',
+ '/pipeline',
+ '/pipeline/editorial-checks',
+ '/game',
+ '/3d',
+ '/decks',
+ '/fableloom',
+ '/mood-boards',
+ '/creative-commission',
+ '/creative-commission/new',
+ '/importer',
+ '/start-story',
];
const FULL_WIDTH_PATH_PREFIXES = [
@@ -49,9 +67,8 @@ const FULL_WIDTH_PATH_PREFIXES = [
'/code-animation/',
'/ask/',
'/calendar',
- // Only the Catalog DETAIL editor (/catalog/{type}/{id}) and the
- // Ingest page (/catalog/ingest) are full-width — they own their
- // own scroll. The /catalog list/index page stays scrolling-default.
+ // Catalog detail (/catalog/{type}/{id}) and Ingest (/catalog/ingest)
+ // own their scroll. The /catalog index is an EXACT full-width entry above.
'/catalog/',
'/cos',
// Both the Creative Director index and its detail editor manage
@@ -77,23 +94,18 @@ const FULL_WIDTH_PATH_PREFIXES = [
'/models',
'/api-reference',
'/settings',
- // Round EDITOR (/rounds/:id) and the Learning Guide (/rounds/guide)
- // are full-width and own their own scroll; the bare /rounds index
- // (list + create form) takes the normal padded+scrolling main.
+ // Round editor (/rounds/:id) and the Learning Guide (/rounds/guide).
+ // The /rounds index is an EXACT full-width entry above.
'/rounds/',
'/wiki',
- // Only the universe EDITOR (/universes/:id, /universes/new) is
- // full-width — it manages its own scroll. The /universes index
- // (list/table) takes the normal padded+scrolling main, mirroring
- // the Series Pipeline index (/pipeline is not full-width either).
+ // Universe editor (/universes/:id, /universes/new). The /universes
+ // index is an EXACT full-width entry above.
'/universes/',
- // Story Builder DETAIL (/story-builder/:id/:step) is a full-width
- // stepper that owns its own scroll; the bare /story-builder index
- // (list + create form) takes the normal padded+scrolling main.
+ // Story Builder detail (/story-builder/:id/:step). The index is an
+ // EXACT full-width entry above.
'/story-builder/',
- // FableLoom EDITOR (/fableloom/:loomId/...) is a full-width canvas that
- // owns its own scroll; the bare /fableloom index takes the normal
- // padded+scrolling main.
+ // FableLoom editor (/fableloom/:loomId/...). The index is an EXACT
+ // full-width entry above.
'/fableloom/',
// The AI Providers editor is a drawer over the same page (/ai/new,
// /ai/:providerId), so its sub-routes need the bare full-width main the
@@ -111,6 +123,12 @@ const FULL_WIDTH_PATH_PREFIXES = [
// its autoscroll container). They share the standard bordered
// PageHeader bar over that scroll region.
'/songbook',
+ // Same component on the index and the :id route, so both own the
+ // PageHeader shell (#10994).
+ '/sprites',
+ '/authors',
+ '/sharing',
+ '/voices',
];
const FULL_WIDTH_PATH_REGEXES = [
@@ -129,8 +147,9 @@ const FULL_WIDTH_PATH_REGEXES = [
// clips the form. Boundary-specific so `/video-gen` (legacy redirect) is
// not swallowed the way a `/video` prefix would.
/^\/video(?:\/|$)/,
- // Only Game DETAIL workspaces own an internal scroll region; the
- // bare /game index stays on the normal padded page layout.
+ // Game detail (/game/:id) owns an internal scroll region. The bare
+ // /game index is an EXACT full-width entry above; this stays
+ // one-segment so /game/:id/:extra is not swallowed.
/^\/game\/[^/]+\/?$/,
// Only the App DETAIL editor (/apps/:id, /apps/:id/:tab) is
// full-width and owns its own scroll; the Add App form
@@ -142,7 +161,7 @@ const FULL_WIDTH_PATH_REGEXES = [
/^\/apps\/(?!create(?:\/|$))[^/]+(?:\/|$)/,
];
-// Exported for the table-driven regression test in Layout.test.jsx — the 41
+// Exported for the table-driven regression test in Layout.test.jsx — the
// classification rules above have no other coverage, and a dropped or retyped
// entry silently changes a page's layout.
export function isFullWidthRoute(pathname) {
diff --git a/client/src/pageShellConventions.test.js b/client/src/pageShellConventions.test.js
index 092f70b53d..abd16028c2 100644
--- a/client/src/pageShellConventions.test.js
+++ b/client/src/pageShellConventions.test.js
@@ -3,9 +3,15 @@ import { readFileSync, existsSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { isFullWidthRoute } from './lib/layoutRoutes.js';
+import { NAV_COMMANDS } from '../../server/lib/navManifest.js';
import { trackedSourceFiles } from './test/trackedFiles.js';
import { maskComments, stringLiterals } from './test/classNameScan.js';
+// Full-bleed editors that intentionally have no title bar. Empty until a
+// Create destination's work surface is the chrome. A hand-rolled <h1> is
+// not an allowlist reason (#10994).
+const CREATE_PAGE_HEADER_ALLOWLIST = new Set();
+
const root = dirname(fileURLToPath(import.meta.url));
// App's lazy imports and Route declarations are the real page inventory. Resolve
@@ -27,6 +33,58 @@ function ownsShell(raw) {
(/(?:^|\s)flex-1(?:\s|$)/.test(value) && /(?:^|\s)overflow-(?:auto|y-auto)(?:\s|$)/.test(value)));
}
+function matchRoute(routeList, pathname) {
+ const parts = pathname.split('/').filter(Boolean);
+ let best = null;
+ let bestScore = -1;
+ for (const route of routeList) {
+ const routeParts = route.path.split('/').filter(Boolean);
+ if (routeParts.length !== parts.length) continue;
+ let score = 0;
+ let ok = true;
+ for (let i = 0; i < routeParts.length; i += 1) {
+ if (routeParts[i].startsWith(':')) score += 1;
+ else if (routeParts[i] === parts[i]) score += 2;
+ else { ok = false; break; }
+ }
+ if (ok && score > bestScore) {
+ best = route;
+ bestScore = score;
+ }
+ }
+ if (best) return best;
+ // Nested outlets (Media Gen's /media/image) are declared as child paths, so
+ // the flat route list only has the parent. The parent owns the title bar.
+ let prefix = null;
+ for (const route of routeList) {
+ if (route.path.includes(':')) continue;
+ if (pathname === route.path || pathname.startsWith(`${route.path}/`)) {
+ if (!prefix || route.path.length > prefix.path.length) prefix = route;
+ }
+ }
+ return prefix;
+}
+
+// Create destinations without a tab group each render the shared title bar.
+// Tab-grouped siblings (Media Gen image, Music artists, …) share their
+// group's shell and are out of this check.
+export function createPagesMissingPageHeader(commands, routeList, readSource, allowlist = CREATE_PAGE_HEADER_ALLOWLIST) {
+ const failures = [];
+ for (const command of commands) {
+ if (command.section !== 'Create' || command.tabGroup) continue;
+ const pathname = String(command.path || '').split('?')[0];
+ if (!pathname || allowlist.has(pathname)) continue;
+ const route = matchRoute(routeList, pathname);
+ if (!route) {
+ failures.push(`${command.path}: no route`);
+ continue;
+ }
+ const source = maskComments(readSource(route));
+ if (!/<PageHeader\b/.test(source)) failures.push(`${pathname}: ${route.component} has no PageHeader`);
+ }
+ return failures;
+}
+
function violations(routes, sourceFor, classify = isFullWidthRoute) {
const failures = [];
for (const route of routes) {
@@ -62,4 +120,25 @@ describe('page shell conventions', () => {
expect(violations(probe, () => '<div className="flex-1 overflow-auto"><PageHeader /></div>', () => true)).toEqual([]);
expect(violations(probe, () => '<div><PageHeader /></div>', () => false)).toEqual([]);
});
+
+ it('gives every Create page without a tab group a PageHeader', () => {
+ expect(createPagesMissingPageHeader(NAV_COMMANDS, routes, sourceFor)).toEqual([]);
+ });
+
+ it('rejects a probe Create page with a bare h1', () => {
+ const commands = [
+ { path: '/probe-create', section: 'Create', label: 'Probe' },
+ { path: '/probe-tab', section: 'Create', tabGroup: 'probe', label: 'Tab' },
+ ];
+ const probeRoutes = [
+ { path: '/probe-create', component: 'ProbeCreate' },
+ { path: '/probe-tab', component: 'ProbeTab' },
+ ];
+ const bare = () => '<main><h1>Probe</h1></main>';
+ expect(createPagesMissingPageHeader(commands, probeRoutes, bare, new Set())).toEqual([
+ '/probe-create: ProbeCreate has no PageHeader',
+ ]);
+ expect(createPagesMissingPageHeader(commands, probeRoutes, () => '<PageHeader title="Probe" />', new Set())).toEqual([]);
+ expect(createPagesMissingPageHeader(commands, probeRoutes, bare, new Set(['/probe-create']))).toEqual([]);
+ });
});
diff --git a/client/src/pages/Authors.jsx b/client/src/pages/Authors.jsx
index 85723dcee3..36def34df7 100644
--- a/client/src/pages/Authors.jsx
+++ b/client/src/pages/Authors.jsx
@@ -1,5 +1,6 @@
-import { FilePen } from 'lucide-react';
-import { useParams } from 'react-router';
+import { FilePen, Plus } from 'lucide-react';
+import { useNavigate, useParams } from 'react-router';
+import PageHeader from '../components/PageHeader';
import PersonaMasterDetail from '../components/persona/PersonaMasterDetail';
import {
listAuthors, createAuthor, updateAuthor, deleteAuthor, generateImage,
@@ -30,6 +31,8 @@ const FIELDS = [
},
];
+const INTRO = 'Author personas are reusable across series — the cover byline plus the writing voice, bio, and the physical description + style used to generate a book-cover author headshot. Link one to a series from the Series Pipeline.';
+
const PORTRAIT = {
label: 'Headshot', fieldLabel: 'Headshot image', imageKey: 'headshotImageUrl',
descriptionKey: 'physicalDescription', styleKey: 'headshotStyle', styleLabel: 'Headshot style',
@@ -46,22 +49,43 @@ const PORTRAIT = {
export default function Authors() {
const { authorId } = useParams();
+ const navigate = useNavigate();
return (
- <PersonaMasterDetail
- basePath="/authors"
- selectedId={authorId}
- title="Authors"
- titleIcon={FilePen}
- intro="Author personas are reusable across series — the cover byline plus the writing voice, bio, and the physical description + style used to generate a book-cover author headshot. Link one to a series from the Series Pipeline."
- singular="Author"
- plural="Authors"
- fields={FIELDS}
- portrait={PORTRAIT}
- listRecords={listAuthors}
- createRecord={createAuthor}
- updateRecord={updateAuthor}
- deleteRecord={deleteAuthor}
- generateImage={generateImage}
- />
+ <div className="flex h-full min-h-0 flex-col">
+ <PageHeader
+ icon={FilePen}
+ title="Authors"
+ subtitle={INTRO}
+ actions={(
+ <button
+ type="button"
+ onClick={() => navigate('/authors/new')}
+ className="inline-flex items-center gap-2 px-3 py-2 rounded-lg bg-port-accent text-white text-sm"
+ >
+ <Plus size={16} aria-hidden="true" />
+ New Author
+ </button>
+ )}
+ />
+ <div className="flex-1 min-h-0 overflow-auto p-4">
+ <PersonaMasterDetail
+ hideTitle
+ basePath="/authors"
+ selectedId={authorId}
+ title="Authors"
+ titleIcon={FilePen}
+ intro={INTRO}
+ singular="Author"
+ plural="Authors"
+ fields={FIELDS}
+ portrait={PORTRAIT}
+ listRecords={listAuthors}
+ createRecord={createAuthor}
+ updateRecord={updateAuthor}
+ deleteRecord={deleteAuthor}
+ generateImage={generateImage}
+ />
+ </div>
+ </div>
);
}
diff --git a/client/src/pages/Catalog.jsx b/client/src/pages/Catalog.jsx
index 481ce851b8..19a77e7aac 100644
--- a/client/src/pages/Catalog.jsx
+++ b/client/src/pages/Catalog.jsx
@@ -20,6 +20,7 @@ import { Link, useNavigate, useLocation } from 'react-router';
import { Sparkles, Plus, Search, FileInput, Loader2, RefreshCw, Wand2, X, LayoutGrid, Library, FolderPlus, Settings as SettingsIcon } from 'lucide-react';
import BrailleSpinner from '../components/BrailleSpinner';
import Drawer from '../components/Drawer';
+import PageHeader from '../components/PageHeader';
import toast from '../components/ui/Toast';
import {
listCatalogIngredients,
@@ -549,24 +550,27 @@ export default function Catalog() {
);
return (
- <>
+ <div className="flex h-full min-h-0 flex-col">
{settingsDrawer}
- {/* Header. The toolbar wraps to its own rows on a phone because the five
- controls together need ~350px and a 320px viewport gives 288px.
- A label too long to survive that (Sync's, at `lg`; the action bar's, at
- `sm`) hides its tail and keeps the full wording in aria-label, so the
+ {/* Toolbar wraps to its own rows on a phone because the five controls
+ together need ~350px and a 320px viewport gives 288px. A label too
+ long to survive that (Sync's, at `lg`; the action bar's, at `sm`)
+ hides its tail and keeps the full wording in aria-label, so the
accessible name never depends on viewport width — the visible text is
always a prefix of it, per WCAG 2.5.3 label-in-name. The reveal
breakpoint differs per button; only the prefix relationship is
invariant (asserted in Catalog.test.jsx). */}
- <div className="flex items-center justify-between mb-4 sm:mb-6 flex-wrap gap-3">
- <div className="flex items-center gap-2 sm:gap-3 min-w-0">
- <Sparkles className="w-6 h-6 shrink-0 text-port-accent" aria-hidden="true" />
- <h1 className="text-xl sm:text-2xl font-bold text-white">Catalog</h1>
- <span className="text-sm text-gray-500 whitespace-nowrap">
- {totalCount} ingredient{totalCount === 1 ? '' : 's'}
+ <PageHeader
+ icon={Sparkles}
+ title={(
+ <span className="inline-flex items-baseline gap-2">
+ Catalog
+ <span className="text-sm font-normal text-gray-500 whitespace-nowrap">
+ {totalCount} ingredient{totalCount === 1 ? '' : 's'}
+ </span>
</span>
- </div>
+ )}
+ actions={(
<div className="flex flex-wrap items-center gap-2 w-full sm:w-auto">
{/* View toggle (Grid ↔ Albums), persisted in the URL. */}
<div className="inline-flex w-full sm:w-auto rounded-lg border border-port-border overflow-hidden" role="group" aria-label="Catalog view">
@@ -628,8 +632,9 @@ export default function Catalog() {
New
</button>
</div>
- </div>
-
+ )}
+ />
+ <div className="flex-1 min-h-0 overflow-auto p-4">
{/* Search sits directly under the header so the primary way to find an
ingredient stays above the fold on a phone, ahead of the filters. */}
<div className="relative mb-4">
@@ -889,7 +894,7 @@ export default function Catalog() {
making the compositor re-sample the area behind the bar on every scroll
frame over a 60-card grid. */}
{selectedIds.size > 0 && (
- <div className="sticky bottom-0 left-0 right-0 mt-4 -mx-4 md:-mx-6 px-4 md:px-6 py-3 bg-port-card/95 sm:backdrop-blur border-t border-port-border flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-3 z-20">
+ <div className="sticky bottom-0 left-0 right-0 mt-4 -mx-4 px-4 py-3 bg-port-card/95 sm:backdrop-blur border-t border-port-border flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-3 z-20">
<span className="text-sm text-white font-medium">
{selectedIds.size} selected
</span>
@@ -1011,7 +1016,8 @@ export default function Catalog() {
</div>
</div>
)}
- </>
+ </div>
+ </div>
);
}
diff --git a/client/src/pages/CatalogIngest.jsx b/client/src/pages/CatalogIngest.jsx
index 8104e84c14..93ba716585 100644
--- a/client/src/pages/CatalogIngest.jsx
+++ b/client/src/pages/CatalogIngest.jsx
@@ -12,6 +12,7 @@ import { Sparkles, Loader2, CheckCircle2, AlertCircle, ArrowLeft, RotateCcw, Cir
import { formatCount } from '../utils/formatters';
import useProviderModels from '../hooks/useProviderModels';
import ProviderModelSelector from '../components/ProviderModelSelector';
+import PageHeader from '../components/PageHeader';
import toast from '../components/ui/Toast';
import FilePickerButton from '../components/ui/FilePickerButton';
import Modal from '../components/ui/Modal';
@@ -607,18 +608,14 @@ export default function CatalogIngest() {
};
return (
- <section className="h-full overflow-y-auto p-4 md:p-6">
- <div className="max-w-4xl mx-auto space-y-5">
- <header className="flex items-start justify-between gap-3 flex-wrap">
- <div className="flex items-start gap-3">
- <Sparkles className="w-7 h-7 text-port-accent mt-1" aria-hidden="true" />
- <div>
- <h1 className="text-2xl font-bold text-white">{babble ? 'Babble and Prune' : 'Catalog Ingest'}</h1>
- <p className="text-sm text-gray-400 mt-1">
- {babble ? 'Write freely first. Then choose an AI provider to refine the useful fragments into catalog suggestions.' : 'Paste prose, notes, or a synopsis. Extract characters, places, objects, ideas, scenes, and concepts; review and commit only what you want to keep.'}
- </p>
- </div>
- </div>
+ <div className="flex h-full min-h-0 flex-col">
+ <PageHeader
+ icon={Sparkles}
+ title={babble ? 'Babble and Prune' : 'Catalog Ingest'}
+ subtitle={babble
+ ? 'Write freely first. Then choose an AI provider to refine the useful fragments into catalog suggestions.'
+ : 'Paste prose, notes, or a synopsis. Extract characters, places, objects, ideas, scenes, and concepts; review and commit only what you want to keep.'}
+ actions={(
<div className="flex items-center gap-2">
<button type="button" onClick={() => navigate('/catalog')}
className="inline-flex items-center gap-1.5 px-3 py-2 rounded-lg text-sm text-gray-400 hover:text-white">
@@ -640,7 +637,10 @@ export default function CatalogIngest() {
</button>
)}
</div>
- </header>
+ )}
+ />
+ <div className="flex-1 min-h-0 overflow-y-auto p-4 md:p-6">
+ <div className="max-w-4xl mx-auto space-y-5">
<Modal open={confirmReset} onClose={() => setConfirmReset(false)} size="sm"
ariaLabelledBy="catalog-reset-title">
@@ -922,7 +922,8 @@ export default function CatalogIngest() {
);
})()}
</div>
- </section>
+ </div>
+ </div>
);
}
diff --git a/client/src/pages/CreativeCommissions.jsx b/client/src/pages/CreativeCommissions.jsx
index 0b2e88b506..82d677cac1 100644
--- a/client/src/pages/CreativeCommissions.jsx
+++ b/client/src/pages/CreativeCommissions.jsx
@@ -16,7 +16,8 @@
import { useEffect, useMemo, useState, useCallback } from 'react';
import { useNavigate, useLocation } from 'react-router';
-import { Plus, Sparkles, Trash2, Clock, Cpu, Pause, Play, Zap } from 'lucide-react';
+import { CalendarClock, Plus, Sparkles, Trash2, Clock, Cpu, Pause, Play, Zap } from 'lucide-react';
+import PageHeader from '../components/PageHeader';
import PageSkeleton from '../components/ui/PageSkeleton';
import EmptyState from '../components/EmptyState';
import toast from '../components/ui/Toast';
@@ -128,118 +129,117 @@ export default function CreativeCommissions() {
);
return (
- <div className="max-w-5xl mx-auto">
- <div className="flex items-center justify-between mb-6">
- <div className="flex items-center gap-3">
- <Sparkles className="w-6 h-6 text-port-accent" />
- <div>
- <h1 className="text-xl font-semibold text-gray-100">Creative Commissions</h1>
- <p className="text-sm text-gray-500">Standing briefs that create on a schedule and steer by your taste</p>
- </div>
- </div>
- <button
- onClick={() => navigate('/creative-commission/new')}
- className="flex items-center gap-2 bg-port-accent hover:bg-blue-600 text-white px-3 py-2 rounded text-sm font-medium"
- >
- <Plus className="w-4 h-4" /> New Commission
- </button>
- </div>
-
- {loading ? (
- <PageSkeleton header="none" label="Loading commissions" cards={3} sidebar={false} />
- ) : sorted.length === 0 ? (
- <EmptyState
- icon={Sparkles}
- title="No commissions yet"
- message="Create a standing brief like “every night at 2am, make me something surreal” and it runs unattended."
- actionTo="/creative-commission/new"
- actionLabel="Create your first commission"
- />
- ) : (
- <div className="space-y-2">
- {sorted.map((c) => (
- <div
- key={c.id}
- className="flex items-center gap-3 bg-port-card border border-port-border rounded-lg p-3 hover:border-port-accent/50 transition-colors"
- >
- <button
- className="flex-1 text-left min-w-0"
- onClick={() => navigate(`/creative-commission/${encodeURIComponent(c.id)}`)}
+ <div className="flex h-full min-h-0 flex-col">
+ <PageHeader
+ icon={CalendarClock}
+ title="Creative Commissions"
+ subtitle="Standing briefs that create on a schedule and steer by your taste"
+ actions={(
+ <button
+ onClick={() => navigate('/creative-commission/new')}
+ className="flex items-center gap-2 bg-port-accent hover:bg-blue-600 text-white px-3 py-2 rounded text-sm font-medium"
+ >
+ <Plus className="w-4 h-4" /> New Commission
+ </button>
+ )}
+ />
+ <div className="flex-1 min-h-0 overflow-auto p-4">
+ {loading ? (
+ <PageSkeleton header="none" label="Loading commissions" cards={3} sidebar={false} />
+ ) : sorted.length === 0 ? (
+ <EmptyState
+ icon={Sparkles}
+ title="No commissions yet"
+ message="Create a standing brief like “every night at 2am, make me something surreal” and it runs unattended."
+ actionTo="/creative-commission/new"
+ actionLabel="Create your first commission"
+ />
+ ) : (
+ <div className="space-y-2">
+ {sorted.map((c) => (
+ <div
+ key={c.id}
+ className="flex items-center gap-3 bg-port-card border border-port-border rounded-lg p-3 hover:border-port-accent/50 transition-colors"
>
- <div className="flex items-center gap-2">
- <span className="text-gray-100 font-medium truncate">{c.name}</span>
- <span className={`text-[10px] uppercase px-1.5 py-0.5 rounded ${c.enabled ? 'bg-port-success/20 text-port-success' : 'bg-gray-700 text-gray-400'}`}>
- {c.enabled ? 'Active' : 'Paused'}
- </span>
- <span className="text-[10px] uppercase px-1.5 py-0.5 rounded bg-port-accent/20 text-port-accent">{c.targetAbility}</span>
- </div>
- <div className="flex items-center gap-3 mt-1 text-xs text-gray-500">
- <span className="flex items-center gap-1"><Clock className="w-3 h-3" /> {describeSchedule(c.schedule)}</span>
- <span className="flex items-center gap-1" title="AI provider that writes the treatment & plan">
- <Cpu className="w-3 h-3" /> {describeAssignment(c.assignment)}
- </span>
- {Array.isArray(c.runs) && c.runs.length > 0 && (
- <span>Last run {timeAgo(c.runs[c.runs.length - 1].ranAt)}</span>
- )}
- </div>
- </button>
- <button
- onClick={() => handleRunNow(c)}
- disabled={runningIds.has(c.id)}
- title="Run now (ignores schedule)"
- aria-label={`Run commission ${c.name} now`}
- className="p-2 text-gray-400 hover:text-port-accent disabled:opacity-50"
- >
- <Zap className={`w-4 h-4 ${runningIds.has(c.id) ? 'animate-pulse text-port-accent' : ''}`} />
- </button>
- <button
- onClick={() => toggleEnabled(c)}
- title={c.enabled ? COMMISSION_STOP_COPY.pauseTitle : COMMISSION_STOP_COPY.resumeTitle}
- aria-label={c.enabled ? 'Pause' : 'Resume'}
- className="p-2 text-gray-400 hover:text-gray-100"
- >
- {c.enabled ? <Pause className="w-4 h-4" /> : <Play className="w-4 h-4" />}
- </button>
- {isConfirming(c.id) ? (
- <ConfirmButtonPair
- prompt="Delete?"
- ariaLabel={`Confirm delete commission ${c.name}`}
- onConfirm={() => confirmDelete(() => handleDelete(c))}
- onCancel={cancelDelete}
- />
- ) : (
<button
- type="button"
- onClick={() => requestDelete(c.id)}
- title={COMMISSION_STOP_COPY.deleteTitle}
- aria-label={`Delete commission ${c.name}`}
- className="p-2 text-gray-400 hover:text-port-error"
+ className="flex-1 text-left min-w-0"
+ onClick={() => navigate(`/creative-commission/${encodeURIComponent(c.id)}`)}
>
- <Trash2 className="w-4 h-4" />
+ <div className="flex items-center gap-2">
+ <span className="text-gray-100 font-medium truncate">{c.name}</span>
+ <span className={`text-[10px] uppercase px-1.5 py-0.5 rounded ${c.enabled ? 'bg-port-success/20 text-port-success' : 'bg-gray-700 text-gray-400'}`}>
+ {c.enabled ? 'Active' : 'Paused'}
+ </span>
+ <span className="text-[10px] uppercase px-1.5 py-0.5 rounded bg-port-accent/20 text-port-accent">{c.targetAbility}</span>
+ </div>
+ <div className="flex items-center gap-3 mt-1 text-xs text-gray-500">
+ <span className="flex items-center gap-1"><Clock className="w-3 h-3" /> {describeSchedule(c.schedule)}</span>
+ <span className="flex items-center gap-1" title="AI provider that writes the treatment & plan">
+ <Cpu className="w-3 h-3" /> {describeAssignment(c.assignment)}
+ </span>
+ {Array.isArray(c.runs) && c.runs.length > 0 && (
+ <span>Last run {timeAgo(c.runs[c.runs.length - 1].ranAt)}</span>
+ )}
+ </div>
</button>
- )}
- </div>
- ))}
- </div>
- )}
+ <button
+ onClick={() => handleRunNow(c)}
+ disabled={runningIds.has(c.id)}
+ title="Run now (ignores schedule)"
+ aria-label={`Run commission ${c.name} now`}
+ className="p-2 text-gray-400 hover:text-port-accent disabled:opacity-50"
+ >
+ <Zap className={`w-4 h-4 ${runningIds.has(c.id) ? 'animate-pulse text-port-accent' : ''}`} />
+ </button>
+ <button
+ onClick={() => toggleEnabled(c)}
+ title={c.enabled ? COMMISSION_STOP_COPY.pauseTitle : COMMISSION_STOP_COPY.resumeTitle}
+ aria-label={c.enabled ? 'Pause' : 'Resume'}
+ className="p-2 text-gray-400 hover:text-gray-100"
+ >
+ {c.enabled ? <Pause className="w-4 h-4" /> : <Play className="w-4 h-4" />}
+ </button>
+ {isConfirming(c.id) ? (
+ <ConfirmButtonPair
+ prompt="Delete?"
+ ariaLabel={`Confirm delete commission ${c.name}`}
+ onConfirm={() => confirmDelete(() => handleDelete(c))}
+ onCancel={cancelDelete}
+ />
+ ) : (
+ <button
+ type="button"
+ onClick={() => requestDelete(c.id)}
+ title={COMMISSION_STOP_COPY.deleteTitle}
+ aria-label={`Delete commission ${c.name}`}
+ className="p-2 text-gray-400 hover:text-port-error"
+ >
+ <Trash2 className="w-4 h-4" />
+ </button>
+ )}
+ </div>
+ ))}
+ </div>
+ )}
- <Drawer
- open={creating}
- onClose={closeDrawer}
- title="New Commission"
- size="md"
- closeOnEsc={false}
- closeOnBackdrop={false}
- >
- <CommissionConfigForm
- form={form}
- patchForm={patchForm}
- saving={saving}
- onSave={handleCreate}
- onCancel={closeDrawer}
- saveLabel="Create"
- />
- </Drawer>
+ <Drawer
+ open={creating}
+ onClose={closeDrawer}
+ title="New Commission"
+ size="md"
+ closeOnEsc={false}
+ closeOnBackdrop={false}
+ >
+ <CommissionConfigForm
+ form={form}
+ patchForm={patchForm}
+ saving={saving}
+ onSave={handleCreate}
+ onCancel={closeDrawer}
+ saveLabel="Create"
+ />
+ </Drawer>
+ </div>
</div>
);
}
diff --git a/client/src/pages/Decks.jsx b/client/src/pages/Decks.jsx
index 5b445e1fe2..85c72b21ff 100644
--- a/client/src/pages/Decks.jsx
+++ b/client/src/pages/Decks.jsx
@@ -10,6 +10,7 @@
import { useCallback, useEffect, useState } from 'react';
import { Link, useNavigate } from 'react-router';
import { Globe, Plus, Spade, Trash2 } from 'lucide-react';
+import PageHeader from '../components/PageHeader';
import PageSkeleton from '../components/ui/PageSkeleton';
import ProgressBar from '../components/ui/ProgressBar';
import toast from '../components/ui/Toast';
@@ -74,107 +75,106 @@ export default function Decks() {
const universeName = (id) => universes.find((u) => u.id === id)?.name || null;
return (
- <div className="max-w-5xl mx-auto">
- <div className="flex items-center gap-2 mb-4">
- <Spade className="w-6 h-6 text-port-accent" aria-hidden="true" />
- <h1 className="text-xl font-semibold text-white">Decks</h1>
- </div>
- <p className="text-sm text-gray-400 mb-4">
- Design a deck of playing cards or tarot cards: analyze a sample design into a style guide, write or generate a prompt per card, and render single cards or the whole deck with any image backend.
- </p>
-
- <form onSubmit={handleCreate} className="bg-port-card border border-port-border rounded-md p-3 mb-5 grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-[1fr_160px_1fr_auto] lg:items-end">
- <div>
- <label htmlFor="deck-new-name" className="block text-xs text-gray-400 mb-1">Deck name</label>
- <input id="deck-new-name" value={name} onChange={(e) => setName(e.target.value)} maxLength={120} placeholder="Swarm Safe" className={INPUT_CLASS} />
- </div>
- <div>
- <label htmlFor="deck-new-kind" className="block text-xs text-gray-400 mb-1">Kind</label>
- <select id="deck-new-kind" value={kind} onChange={(e) => setKind(e.target.value)} className={INPUT_CLASS}>
- {DECK_KINDS.map((k) => <option key={k} value={k}>{DECK_KIND_LABELS[k]}</option>)}
- </select>
- </div>
- <div>
- <label htmlFor="deck-new-universe" className="block text-xs text-gray-400 mb-1">Universe (optional)</label>
- <select id="deck-new-universe" value={universeId} onChange={(e) => setUniverseId(e.target.value)} className={INPUT_CLASS}>
- <option value="">— none —</option>
- {universes.map((u) => <option key={u.id} value={u.id}>{u.name}</option>)}
- </select>
- {universeId ? (
- <label htmlFor="deck-new-seed" className="mt-1.5 flex items-center gap-2 text-xs text-gray-400">
- <input id="deck-new-seed" type="checkbox" checked={seedStyle} onChange={(e) => setSeedStyle(e.target.checked)} />
- Seed the style guide from this universe
- </label>
- ) : null}
- </div>
- <button
- type="submit"
- disabled={creating || !name.trim()}
- className="flex min-h-[44px] items-center justify-center gap-1.5 px-3 py-2 text-sm rounded bg-port-accent text-white hover:bg-port-accent/80 disabled:opacity-50 transition-colors"
- >
- <Plus className="w-4 h-4" aria-hidden="true" />
- New Deck
- </button>
- </form>
+ <div className="flex h-full min-h-0 flex-col">
+ <PageHeader
+ icon={Spade}
+ title="Decks"
+ subtitle="Design a deck of playing cards or tarot cards: analyze a sample design into a style guide, write or generate a prompt per card, and render single cards or the whole deck with any image backend."
+ />
+ <div className="flex-1 min-h-0 overflow-auto p-4">
+ <form onSubmit={handleCreate} className="bg-port-card border border-port-border rounded-md p-3 mb-5 grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-[1fr_160px_1fr_auto] lg:items-end">
+ <div>
+ <label htmlFor="deck-new-name" className="block text-xs text-gray-400 mb-1">Deck name</label>
+ <input id="deck-new-name" value={name} onChange={(e) => setName(e.target.value)} maxLength={120} placeholder="Swarm Safe" className={INPUT_CLASS} />
+ </div>
+ <div>
+ <label htmlFor="deck-new-kind" className="block text-xs text-gray-400 mb-1">Kind</label>
+ <select id="deck-new-kind" value={kind} onChange={(e) => setKind(e.target.value)} className={INPUT_CLASS}>
+ {DECK_KINDS.map((k) => <option key={k} value={k}>{DECK_KIND_LABELS[k]}</option>)}
+ </select>
+ </div>
+ <div>
+ <label htmlFor="deck-new-universe" className="block text-xs text-gray-400 mb-1">Universe (optional)</label>
+ <select id="deck-new-universe" value={universeId} onChange={(e) => setUniverseId(e.target.value)} className={INPUT_CLASS}>
+ <option value="">— none —</option>
+ {universes.map((u) => <option key={u.id} value={u.id}>{u.name}</option>)}
+ </select>
+ {universeId ? (
+ <label htmlFor="deck-new-seed" className="mt-1.5 flex items-center gap-2 text-xs text-gray-400">
+ <input id="deck-new-seed" type="checkbox" checked={seedStyle} onChange={(e) => setSeedStyle(e.target.checked)} />
+ Seed the style guide from this universe
+ </label>
+ ) : null}
+ </div>
+ <button
+ type="submit"
+ disabled={creating || !name.trim()}
+ className="flex min-h-[44px] items-center justify-center gap-1.5 px-3 py-2 text-sm rounded bg-port-accent text-white hover:bg-port-accent/80 disabled:opacity-50 transition-colors"
+ >
+ <Plus className="w-4 h-4" aria-hidden="true" />
+ New Deck
+ </button>
+ </form>
- {loading ? (
- <PageSkeleton header="none" label="Loading decks" cards={3} sidebar={false} />
- ) : decks.length === 0 ? (
- <EmptyState
- icon={Spade}
- title="No decks yet"
- message="Name a deck above, pick playing cards or tarot, and optionally link a universe so its cast lands on the cards."
- />
- ) : (
- <ul className="space-y-2">
- {decks.map((deck) => {
- const c = deck.completion || {};
- const linked = universeName(deck.universeId);
- return (
- <li key={deck.id} className="bg-port-card border border-port-border rounded-md overflow-hidden">
- {confirmingId === deck.id ? (
- <InlineConfirmRow
- variant="separator"
- question={`Delete "${deck.name}"? Its cards and prompts are removed; rendered images stay in the gallery.`}
- onConfirm={() => handleDelete(deck.id)}
- onCancel={() => setConfirmingId(null)}
- />
- ) : null}
- <div className="flex items-center gap-3 p-3">
- <Link to={`/decks/${deck.id}`} className="flex-1 min-w-0">
- <div className="flex items-center gap-2 flex-wrap">
- <span className="text-white font-medium truncate">{deck.name}</span>
- <Pill tone="context" size="xs">{DECK_KIND_LABELS[deck.kind] || deck.kind}</Pill>
- {linked ? (
- <span className="inline-flex items-center gap-1 text-xs text-gray-400"><Globe className="w-3 h-3" aria-hidden="true" />{linked}</span>
- ) : null}
- </div>
- <div className="mt-2 max-w-md">
- <ProgressBar percent={c.percent || 0} label={`${deck.name} render progress`} tone={c.percent === 100 ? 'success' : 'accent'} />
- </div>
- <div className="flex items-center gap-3 mt-1 text-xs text-gray-500 flex-wrap">
- <span>{c.rendered ?? 0}/{c.total ?? 0} rendered</span>
- <span>{c.prompted ?? 0} prompted</span>
- {c.inFlight ? <span className="text-port-accent">{c.inFlight} rendering</span> : null}
- {c.failed ? <span className="text-port-error">{c.failed} failed</span> : null}
- <span>· {timeAgo(deck.updatedAt)}</span>
- </div>
- </Link>
- <button
- type="button"
- onClick={() => setConfirmingId(deck.id)}
- title="Delete deck"
- aria-label={`Delete ${deck.name}`}
- className="min-h-[44px] min-w-[44px] inline-flex items-center justify-center p-1.5 text-gray-500 hover:text-port-error transition-colors"
- >
- <Trash2 className="w-4 h-4" aria-hidden="true" />
- </button>
- </div>
- </li>
- );
- })}
- </ul>
- )}
+ {loading ? (
+ <PageSkeleton header="none" label="Loading decks" cards={3} sidebar={false} />
+ ) : decks.length === 0 ? (
+ <EmptyState
+ icon={Spade}
+ title="No decks yet"
+ message="Name a deck above, pick playing cards or tarot, and optionally link a universe so its cast lands on the cards."
+ />
+ ) : (
+ <ul className="space-y-2">
+ {decks.map((deck) => {
+ const c = deck.completion || {};
+ const linked = universeName(deck.universeId);
+ return (
+ <li key={deck.id} className="bg-port-card border border-port-border rounded-md overflow-hidden">
+ {confirmingId === deck.id ? (
+ <InlineConfirmRow
+ variant="separator"
+ question={`Delete "${deck.name}"? Its cards and prompts are removed; rendered images stay in the gallery.`}
+ onConfirm={() => handleDelete(deck.id)}
+ onCancel={() => setConfirmingId(null)}
+ />
+ ) : null}
+ <div className="flex items-center gap-3 p-3">
+ <Link to={`/decks/${deck.id}`} className="flex-1 min-w-0">
+ <div className="flex items-center gap-2 flex-wrap">
+ <span className="text-white font-medium truncate">{deck.name}</span>
+ <Pill tone="context" size="xs">{DECK_KIND_LABELS[deck.kind] || deck.kind}</Pill>
+ {linked ? (
+ <span className="inline-flex items-center gap-1 text-xs text-gray-400"><Globe className="w-3 h-3" aria-hidden="true" />{linked}</span>
+ ) : null}
+ </div>
+ <div className="mt-2 max-w-md">
+ <ProgressBar percent={c.percent || 0} label={`${deck.name} render progress`} tone={c.percent === 100 ? 'success' : 'accent'} />
+ </div>
+ <div className="flex items-center gap-3 mt-1 text-xs text-gray-500 flex-wrap">
+ <span>{c.rendered ?? 0}/{c.total ?? 0} rendered</span>
+ <span>{c.prompted ?? 0} prompted</span>
+ {c.inFlight ? <span className="text-port-accent">{c.inFlight} rendering</span> : null}
+ {c.failed ? <span className="text-port-error">{c.failed} failed</span> : null}
+ <span>· {timeAgo(deck.updatedAt)}</span>
+ </div>
+ </Link>
+ <button
+ type="button"
+ onClick={() => setConfirmingId(deck.id)}
+ title="Delete deck"
+ aria-label={`Delete ${deck.name}`}
+ className="min-h-[44px] min-w-[44px] inline-flex items-center justify-center p-1.5 text-gray-500 hover:text-port-error transition-colors"
+ >
+ <Trash2 className="w-4 h-4" aria-hidden="true" />
+ </button>
+ </div>
+ </li>
+ );
+ })}
+ </ul>
+ )}
+ </div>
</div>
);
}
diff --git a/client/src/pages/FableLoom.jsx b/client/src/pages/FableLoom.jsx
index 3ce30d9da0..2bb2ebb74d 100644
--- a/client/src/pages/FableLoom.jsx
+++ b/client/src/pages/FableLoom.jsx
@@ -10,6 +10,7 @@
import { useEffect, useMemo, useState } from 'react';
import { useNavigate } from 'react-router';
import { Plus, Sparkles, Trash2, Waypoints } from 'lucide-react';
+import PageHeader from '../components/PageHeader';
import ProviderModelSelector from '../components/ProviderModelSelector';
import ConfirmButtonPair from '../components/ui/ConfirmButtonPair';
import SyncToPeerButton from '../components/sharing/SyncToPeerButton';
@@ -99,246 +100,243 @@ export default function FableLoom() {
};
return (
- <div className="max-w-5xl mx-auto space-y-6">
- <div className="flex items-center justify-between gap-3 flex-wrap">
- <div>
- <h1 className="text-xl font-semibold flex items-center gap-2">
- <Waypoints size={20} className="text-port-accent" /> FableLoom
- </h1>
- <p className="text-sm text-port-text-muted mt-1">
- Branching narratives readers play through by chatting their intents — every episode is a
- graph of scenes with multiple endings.
- </p>
- </div>
- <button
- type="button"
- onClick={() => setShowForm((v) => !v)}
- className="flex items-center gap-1.5 px-3 py-2 rounded bg-port-accent text-white text-sm"
- >
- <Plus size={15} /> New loom
- </button>
- </div>
-
- {showForm && (
- <form onSubmit={handleCreate} className="bg-port-card border border-port-border rounded-lg p-4 space-y-3">
- <div className="grid gap-3 md:grid-cols-2">
- <FormField label="Name" labelClassName={labelClass}>
- <input
- className={fieldClass}
- value={form.name}
- onChange={(e) => setForm((p) => ({ ...p, name: e.target.value }))}
- placeholder="e.g. The Hollow Crown"
- required
- />
- </FormField>
- <FormField label="Logline" labelClassName={labelClass}>
- <input
- className={fieldClass}
- value={form.logline}
- onChange={(e) => setForm((p) => ({ ...p, logline: e.target.value }))}
- placeholder="One sentence of premise"
- />
- </FormField>
- <FormField label="Scene format" labelClassName={labelClass}>
- <select
- className={fieldClass}
- value={form.format}
- onChange={(e) => setForm((p) => ({ ...p, format: e.target.value }))}
- >
- {LOOM_FORMATS.map((f) => <option key={f.id} value={f.id}>{f.label}</option>)}
- </select>
- </FormField>
- <FormField label="Audience role" labelClassName={labelClass}>
- <select
- className={fieldClass}
- value={form.participationMode}
- onChange={(e) => setForm((p) => ({ ...p, participationMode: e.target.value }))}
- >
- {FABLELOOM_PARTICIPATION_MODES.map((mode) => (
- <option key={mode} value={mode}>
- {mode === 'helper' ? 'Audience helps the protagonist' : 'Audience acts as the protagonist'}
- </option>
- ))}
- </select>
- </FormField>
- {form.participationMode === 'helper' && (
- <FormField label="Audience communication medium" labelClassName={labelClass}>
- <textarea
- rows={2}
+ <div className="flex h-full min-h-0 flex-col">
+ <PageHeader
+ icon={Waypoints}
+ title="FableLoom"
+ subtitle="Branching narratives readers play through by chatting their intents — every episode is a graph of scenes with multiple endings."
+ actions={(
+ <button
+ type="button"
+ onClick={() => setShowForm((v) => !v)}
+ className="flex items-center gap-1.5 px-3 py-2 rounded bg-port-accent text-white text-sm"
+ >
+ <Plus size={15} /> New loom
+ </button>
+ )}
+ />
+ <div className="flex-1 min-h-0 overflow-auto p-4 space-y-6">
+ {showForm && (
+ <form onSubmit={handleCreate} className="bg-port-card border border-port-border rounded-lg p-4 space-y-3">
+ <div className="grid gap-3 md:grid-cols-2">
+ <FormField label="Name" labelClassName={labelClass}>
+ <input
className={fieldClass}
- value={form.audienceCommunicationMedium}
- onChange={(e) => setForm((p) => ({ ...p, audienceCommunicationMedium: e.target.value }))}
- placeholder="e.g. a cracked field radio the protagonist activates in the opening"
+ value={form.name}
+ onChange={(e) => setForm((p) => ({ ...p, name: e.target.value }))}
+ placeholder="e.g. The Hollow Crown"
required
/>
</FormField>
- )}
- <FormField label="Universe (canon + style for AI)" labelClassName={labelClass}>
- <select
+ <FormField label="Logline" labelClassName={labelClass}>
+ <input
+ className={fieldClass}
+ value={form.logline}
+ onChange={(e) => setForm((p) => ({ ...p, logline: e.target.value }))}
+ placeholder="One sentence of premise"
+ />
+ </FormField>
+ <FormField label="Scene format" labelClassName={labelClass}>
+ <select
+ className={fieldClass}
+ value={form.format}
+ onChange={(e) => setForm((p) => ({ ...p, format: e.target.value }))}
+ >
+ {LOOM_FORMATS.map((f) => <option key={f.id} value={f.id}>{f.label}</option>)}
+ </select>
+ </FormField>
+ <FormField label="Audience role" labelClassName={labelClass}>
+ <select
+ className={fieldClass}
+ value={form.participationMode}
+ onChange={(e) => setForm((p) => ({ ...p, participationMode: e.target.value }))}
+ >
+ {FABLELOOM_PARTICIPATION_MODES.map((mode) => (
+ <option key={mode} value={mode}>
+ {mode === 'helper' ? 'Audience helps the protagonist' : 'Audience acts as the protagonist'}
+ </option>
+ ))}
+ </select>
+ </FormField>
+ {form.participationMode === 'helper' && (
+ <FormField label="Audience communication medium" labelClassName={labelClass}>
+ <textarea
+ rows={2}
+ className={fieldClass}
+ value={form.audienceCommunicationMedium}
+ onChange={(e) => setForm((p) => ({ ...p, audienceCommunicationMedium: e.target.value }))}
+ placeholder="e.g. a cracked field radio the protagonist activates in the opening"
+ required
+ />
+ </FormField>
+ )}
+ <FormField label="Universe (canon + style for AI)" labelClassName={labelClass}>
+ <select
+ className={fieldClass}
+ value={form.universeId}
+ onChange={(e) => setForm((p) => ({ ...p, universeId: e.target.value }))}
+ >
+ <option value="">No universe</option>
+ {universes.map((u) => <option key={u.id} value={u.id}>{u.name}</option>)}
+ </select>
+ </FormField>
+ <FormField label="Part of series (optional)" labelClassName={labelClass}>
+ <select
+ className={fieldClass}
+ value={form.seriesId}
+ onChange={(e) => setForm((p) => ({ ...p, seriesId: e.target.value }))}
+ >
+ <option value="">Standalone</option>
+ {series.map((s) => <option key={s.id} value={s.id}>{s.name}</option>)}
+ </select>
+ </FormField>
+ </div>
+ <FormField label="Premise" labelClassName={labelClass}>
+ <textarea
+ rows={3}
className={fieldClass}
- value={form.universeId}
- onChange={(e) => setForm((p) => ({ ...p, universeId: e.target.value }))}
- >
- <option value="">No universe</option>
- {universes.map((u) => <option key={u.id} value={u.id}>{u.name}</option>)}
- </select>
+ value={form.premise}
+ onChange={(e) => setForm((p) => ({ ...p, premise: e.target.value }))}
+ placeholder="The setup, stakes, and tone the AI should weave from"
+ />
</FormField>
- <FormField label="Part of series (optional)" labelClassName={labelClass}>
- <select
+ <FormField label="Image style notes (appended to every scene render prompt)" labelClassName={labelClass}>
+ <textarea
+ rows={2}
className={fieldClass}
- value={form.seriesId}
- onChange={(e) => setForm((p) => ({ ...p, seriesId: e.target.value }))}
- >
- <option value="">Standalone</option>
- {series.map((s) => <option key={s.id} value={s.id}>{s.name}</option>)}
- </select>
+ value={form.styleNotes}
+ onChange={(e) => setForm((p) => ({ ...p, styleNotes: e.target.value }))}
+ placeholder="e.g. painterly, muted palette, storybook illustration"
+ />
</FormField>
- </div>
- <FormField label="Premise" labelClassName={labelClass}>
- <textarea
- rows={3}
- className={fieldClass}
- value={form.premise}
- onChange={(e) => setForm((p) => ({ ...p, premise: e.target.value }))}
- placeholder="The setup, stakes, and tone the AI should weave from"
- />
- </FormField>
- <FormField label="Image style notes (appended to every scene render prompt)" labelClassName={labelClass}>
- <textarea
- rows={2}
- className={fieldClass}
- value={form.styleNotes}
- onChange={(e) => setForm((p) => ({ ...p, styleNotes: e.target.value }))}
- placeholder="e.g. painterly, muted palette, storybook illustration"
- />
- </FormField>
- <section className="border-t border-port-border pt-3 space-y-2">
- <div>
- <h2 className="text-sm font-semibold flex items-center gap-1.5">
- <Sparkles size={14} className="text-port-accent" /> AI series-plan draft
- </h2>
- <p className="text-xs text-port-text-muted mt-1">
- Optionally draft the complete arc, ordered plot points, and side quests from
- these story details and the linked universe canon.
- </p>
+ <section className="border-t border-port-border pt-3 space-y-2">
+ <div>
+ <h2 className="text-sm font-semibold flex items-center gap-1.5">
+ <Sparkles size={14} className="text-port-accent" /> AI series-plan draft
+ </h2>
+ <p className="text-xs text-port-text-muted mt-1">
+ Optionally draft the complete arc, ordered plot points, and side quests from
+ these story details and the linked universe canon.
+ </p>
+ </div>
+ <ProviderModelSelector
+ providers={providers}
+ selectedProviderId={planRoute.providerId}
+ selectedModel={planRoute.model}
+ availableModels={effortAwareModelOptions(planProvider, planRoute.model)}
+ onProviderChange={(providerId) => setPlanRoute({ providerId, model: '', effort: '' })}
+ onModelChange={(model) => setPlanRoute((current) => ({ ...current, model }))}
+ effort={planRoute.effort}
+ onEffortChange={(effort) => setPlanRoute((current) => ({ ...current, effort }))}
+ label="Plan AI provider"
+ disabled={creating || providersLoading}
+ modelDisabled={creating || providersLoading}
+ loading={providersLoading}
+ emptyProviderOption="Default (series-plan stage or active provider)"
+ emptyModelOption="Default model"
+ alwaysShowModel={!!planRoute.providerId}
+ />
+ {planProvider ? (
+ <p className="text-xs text-port-text-muted">
+ The draft will use {planProvider.name}{effectiveModelFor(planProvider, planRoute.model) ? ` (${effectiveModelFor(planProvider, planRoute.model)})` : ''}.
+ </p>
+ ) : null}
+ </section>
+ <div className="flex flex-col-reverse sm:flex-row sm:justify-end gap-2">
+ <button
+ type="submit"
+ value="empty"
+ disabled={creating || !form.name.trim() || (form.participationMode === 'helper' && !form.audienceCommunicationMedium.trim())}
+ className="px-4 py-2 rounded border border-port-border text-sm hover:border-port-accent disabled:opacity-50"
+ >
+ {creating ? 'Creating…' : 'Create loom'}
+ </button>
+ <button
+ type="submit"
+ value="draft"
+ disabled={creating || providersLoading || !form.name.trim() || (form.participationMode === 'helper' && !form.audienceCommunicationMedium.trim())}
+ className="flex items-center justify-center gap-1.5 px-4 py-2 rounded bg-port-accent text-white text-sm disabled:opacity-50"
+ >
+ <Sparkles size={14} /> {creating ? 'Creating…' : 'Create & draft plan'}
+ </button>
</div>
- <ProviderModelSelector
- providers={providers}
- selectedProviderId={planRoute.providerId}
- selectedModel={planRoute.model}
- availableModels={effortAwareModelOptions(planProvider, planRoute.model)}
- onProviderChange={(providerId) => setPlanRoute({ providerId, model: '', effort: '' })}
- onModelChange={(model) => setPlanRoute((current) => ({ ...current, model }))}
- effort={planRoute.effort}
- onEffortChange={(effort) => setPlanRoute((current) => ({ ...current, effort }))}
- label="Plan AI provider"
- disabled={creating || providersLoading}
- modelDisabled={creating || providersLoading}
- loading={providersLoading}
- emptyProviderOption="Default (series-plan stage or active provider)"
- emptyModelOption="Default model"
- alwaysShowModel={!!planRoute.providerId}
- />
- {planProvider ? (
- <p className="text-xs text-port-text-muted">
- The draft will use {planProvider.name}{effectiveModelFor(planProvider, planRoute.model) ? ` (${effectiveModelFor(planProvider, planRoute.model)})` : ''}.
- </p>
- ) : null}
- </section>
- <div className="flex flex-col-reverse sm:flex-row sm:justify-end gap-2">
- <button
- type="submit"
- value="empty"
- disabled={creating || !form.name.trim() || (form.participationMode === 'helper' && !form.audienceCommunicationMedium.trim())}
- className="px-4 py-2 rounded border border-port-border text-sm hover:border-port-accent disabled:opacity-50"
- >
- {creating ? 'Creating…' : 'Create loom'}
- </button>
+ </form>
+ )}
+
+ {looms === null ? (
+ <PageSkeleton header="none" label="Loading branching narratives" cards={4} sidebar={false} layout="grid" />
+ ) : looms.length === 0 ? (
+ <div className="text-center py-16 border border-dashed border-port-border rounded-lg">
+ <Waypoints size={32} className="mx-auto text-port-text-muted mb-3" />
+ <p className="text-sm text-port-text-muted">
+ No branching narratives yet. Create a loom, shape its series plan, then weave its episodes.
+ </p>
<button
- type="submit"
- value="draft"
- disabled={creating || providersLoading || !form.name.trim() || (form.participationMode === 'helper' && !form.audienceCommunicationMedium.trim())}
- className="flex items-center justify-center gap-1.5 px-4 py-2 rounded bg-port-accent text-white text-sm disabled:opacity-50"
+ type="button"
+ onClick={() => setShowForm(true)}
+ className="mt-4 inline-flex items-center gap-1.5 px-3 py-2 rounded bg-port-accent text-white text-sm"
>
- <Sparkles size={14} /> {creating ? 'Creating…' : 'Create & draft plan'}
+ <Plus size={15} /> Create your first loom
</button>
</div>
- </form>
- )}
-
- {looms === null ? (
- <PageSkeleton header="none" label="Loading branching narratives" cards={4} sidebar={false} layout="grid" />
- ) : looms.length === 0 ? (
- <div className="text-center py-16 border border-dashed border-port-border rounded-lg">
- <Waypoints size={32} className="mx-auto text-port-text-muted mb-3" />
- <p className="text-sm text-port-text-muted">
- No branching narratives yet. Create a loom, shape its series plan, then weave its episodes.
- </p>
- <button
- type="button"
- onClick={() => setShowForm(true)}
- className="mt-4 inline-flex items-center gap-1.5 px-3 py-2 rounded bg-port-accent text-white text-sm"
- >
- <Plus size={15} /> Create your first loom
- </button>
- </div>
- ) : (
- <div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
- {looms.map((loom) => (
- <div
- key={loom.id}
- className="min-w-0 bg-port-card border border-port-border rounded-lg p-4 hover:border-port-accent transition-colors cursor-pointer"
- role="link"
- tabIndex={0}
- onClick={() => navigate(`/fableloom/${loom.id}`)}
- onKeyDown={(e) => { if (e.key === 'Enter') navigate(`/fableloom/${loom.id}`); }}
- >
- <div className="flex min-w-0 items-start justify-between gap-2">
- <div className="min-w-0 flex-1 break-words">
- <h2 className="font-medium break-words">{loom.name}</h2>
- {loom.logline && <p className="text-xs text-port-text-muted mt-0.5 line-clamp-2 break-words">{loom.logline}</p>}
- </div>
- <div className="shrink-0" onClick={(e) => e.stopPropagation()} onKeyDown={(e) => e.stopPropagation()} role="none">
- <div className="flex items-center gap-1">
- <SyncToPeerButton recordKind="fableLoom" recordId={loom.id} compact />
- {del.isConfirming(loom.id) ? (
- <ConfirmButtonPair
- prompt="Delete?"
- onConfirm={() => handleDelete(loom.id)}
- onCancel={del.cancelDelete}
- largeTouchTargets
- />
- ) : (
- <button
- type="button"
- aria-label={`Delete ${loom.name}`}
- onClick={() => del.requestDelete(loom.id)}
- className="min-h-[44px] min-w-[44px] inline-flex items-center justify-center text-port-text-muted hover:text-port-error p-1"
- >
- <Trash2 size={15} />
- </button>
- )}
+ ) : (
+ <div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
+ {looms.map((loom) => (
+ <div
+ key={loom.id}
+ className="min-w-0 bg-port-card border border-port-border rounded-lg p-4 hover:border-port-accent transition-colors cursor-pointer"
+ role="link"
+ tabIndex={0}
+ onClick={() => navigate(`/fableloom/${loom.id}`)}
+ onKeyDown={(e) => { if (e.key === 'Enter') navigate(`/fableloom/${loom.id}`); }}
+ >
+ <div className="flex min-w-0 items-start justify-between gap-2">
+ <div className="min-w-0 flex-1 break-words">
+ <h2 className="font-medium break-words">{loom.name}</h2>
+ {loom.logline && <p className="text-xs text-port-text-muted mt-0.5 line-clamp-2 break-words">{loom.logline}</p>}
+ </div>
+ <div className="shrink-0" onClick={(e) => e.stopPropagation()} onKeyDown={(e) => e.stopPropagation()} role="none">
+ <div className="flex items-center gap-1">
+ <SyncToPeerButton recordKind="fableLoom" recordId={loom.id} compact />
+ {del.isConfirming(loom.id) ? (
+ <ConfirmButtonPair
+ prompt="Delete?"
+ onConfirm={() => handleDelete(loom.id)}
+ onCancel={del.cancelDelete}
+ largeTouchTargets
+ />
+ ) : (
+ <button
+ type="button"
+ aria-label={`Delete ${loom.name}`}
+ onClick={() => del.requestDelete(loom.id)}
+ className="min-h-[44px] min-w-[44px] inline-flex items-center justify-center text-port-text-muted hover:text-port-error p-1"
+ >
+ <Trash2 size={15} />
+ </button>
+ )}
+ </div>
</div>
</div>
+ <div className="flex items-center gap-3 mt-3 text-xs text-port-text-muted flex-wrap">
+ <span>{loom.episodeCount} episode{loom.episodeCount === 1 ? '' : 's'}</span>
+ <span>{loom.sceneCount} scene{loom.sceneCount === 1 ? '' : 's'}</span>
+ <span>{loom.endingCount} ending{loom.endingCount === 1 ? '' : 's'}</span>
+ {universeNames.has(loom.universeId) && (
+ <Pill tone="accent" bordered={false}>{universeNames.get(loom.universeId)}</Pill>
+ )}
+ {seriesNames.has(loom.seriesId) && (
+ <Pill tone="muted">{seriesNames.get(loom.seriesId)}</Pill>
+ )}
+ {loom.participationMode === 'helper' && <Pill tone="accent" bordered={false}>Audience helper</Pill>}
+ {isTeleplayFormat(loom.format) && <Pill tone="muted">{loomFormatLabel(loom.format)}</Pill>}
+ <span className="ml-auto">{timeAgo(loom.updatedAt)}</span>
+ </div>
</div>
- <div className="flex items-center gap-3 mt-3 text-xs text-port-text-muted flex-wrap">
- <span>{loom.episodeCount} episode{loom.episodeCount === 1 ? '' : 's'}</span>
- <span>{loom.sceneCount} scene{loom.sceneCount === 1 ? '' : 's'}</span>
- <span>{loom.endingCount} ending{loom.endingCount === 1 ? '' : 's'}</span>
- {universeNames.has(loom.universeId) && (
- <Pill tone="accent" bordered={false}>{universeNames.get(loom.universeId)}</Pill>
- )}
- {seriesNames.has(loom.seriesId) && (
- <Pill tone="muted">{seriesNames.get(loom.seriesId)}</Pill>
- )}
- {loom.participationMode === 'helper' && <Pill tone="accent" bordered={false}>Audience helper</Pill>}
- {isTeleplayFormat(loom.format) && <Pill tone="muted">{loomFormatLabel(loom.format)}</Pill>}
- <span className="ml-auto">{timeAgo(loom.updatedAt)}</span>
- </div>
- </div>
- ))}
- </div>
- )}
+ ))}
+ </div>
+ )}
+ </div>
</div>
);
}
diff --git a/client/src/pages/Game.jsx b/client/src/pages/Game.jsx
index e651789bc5..9b5f4835b4 100644
--- a/client/src/pages/Game.jsx
+++ b/client/src/pages/Game.jsx
@@ -1,6 +1,7 @@
import { useCallback, useEffect, useMemo, useState } from 'react';
import { ArrowLeft, Boxes, Gamepad2, Images, MessageSquare, Plus } from 'lucide-react';
import { Link, useNavigate, useParams } from 'react-router';
+import PageHeader from '../components/PageHeader';
import PageSkeleton from '../components/ui/PageSkeleton';
import toast from '../components/ui/Toast';
import AppContextPicker from '../components/AppContextPicker.jsx';
@@ -260,9 +261,10 @@ export default function Game() {
};
if (loading) {
- // The detail workspace is a full-bleed h-full shell with its own bordered
- // bar; the index is a plain padded page. `id` is known before the fetch
- // settles, so each reserves the chrome its own loaded state renders.
+ // Detail and index are both full-bleed PageHeader shells. `id` is known
+ // before the fetch settles, so each reserves the chrome its loaded state
+ // renders. The index passes fullHeight so it is not clipped in the
+ // overflow-hidden main.
return id ? (
<PageSkeleton
header="bar"
@@ -279,6 +281,8 @@ export default function Game() {
) : (
<PageSkeleton
label="Loading Game studio"
+ fullHeight
+ padded
titleWidthClass="w-32"
showSubtitle
showAction={false}
@@ -290,27 +294,33 @@ export default function Game() {
if (id && !game) {
return (
- <div className="mx-auto max-w-3xl rounded-xl border border-port-border bg-port-card p-8 text-center">
- <h1 className="text-xl font-semibold text-white">Game not found</h1>
- <p className="mt-2 text-sm text-gray-400">This Game record may have been deleted.</p>
- <Link to="/game" className="mt-4 inline-flex min-h-[44px] items-center text-port-accent hover:underline">
- Back to Games
- </Link>
+ <div className="flex h-full min-h-0 flex-col">
+ <PageHeader
+ icon={Gamepad2}
+ title="Game"
+ subtitle="This Game record may have been deleted."
+ actions={(
+ <Link to="/game" className="inline-flex min-h-[44px] items-center text-port-accent hover:underline">
+ Back to Games
+ </Link>
+ )}
+ />
+ <div className="flex min-h-0 flex-1 items-center justify-center overflow-auto p-4">
+ <p className="text-center text-sm text-gray-400">This Game record may have been deleted.</p>
+ </div>
</div>
);
}
if (!game) {
return (
- <div className="mx-auto max-w-5xl">
- <div className="mb-5 flex items-center gap-3">
- <Gamepad2 className="h-7 w-7 text-port-accent" aria-hidden="true" />
- <div>
- <h1 className="text-2xl font-bold text-white">Game</h1>
- <p className="text-sm text-gray-400">Bind reusable art and music to a managed app.</p>
- </div>
- </div>
-
+ <div className="flex h-full min-h-0 flex-col">
+ <PageHeader
+ icon={Gamepad2}
+ title="Game"
+ subtitle="Bind reusable art and music to a managed app."
+ />
+ <div className="flex-1 min-h-0 overflow-auto p-4">
<form onSubmit={create} className="mb-6 rounded-xl border border-port-border bg-port-card p-4">
<h2 className="mb-3 font-semibold text-white">Create a Game workspace</h2>
<div className="grid gap-3 md:grid-cols-2">
@@ -370,6 +380,7 @@ export default function Game() {
No Game workspaces yet.
</div>
)}
+ </div>
</div>
);
}
@@ -379,30 +390,28 @@ export default function Game() {
const bindingBusy = /^(un)?bind-|^artwork-|^music-/.test(busy);
return (
<div className="flex h-full min-h-0 flex-col">
- <header className="flex shrink-0 flex-col justify-between gap-2 border-b border-port-border px-4 py-3 sm:flex-row sm:items-center">
- <div className="flex min-w-0 items-center gap-3">
- <Link
- to="/game"
- className="inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-lg text-gray-400 hover:bg-port-card hover:text-white"
- aria-label="All Games"
- title="All Games"
- >
- <ArrowLeft className="h-4 w-4" aria-hidden="true" />
- </Link>
- <Gamepad2 className="h-6 w-6 shrink-0 text-port-accent" aria-hidden="true" />
- <div className="min-w-0">
- <h1 className="line-clamp-2 break-words text-xl font-bold text-white" title={game.name}>{game.name}</h1>
- <p className="truncate text-xs text-gray-400">{app?.name || 'Managed app unavailable'}</p>
- </div>
- </div>
- <div className="flex items-center gap-2 text-xs text-gray-400">
- <span>{game.spriteBindings.length} sprites</span>
- <span aria-hidden="true">·</span>
- <span>{game.musicBindings.length} {game.musicBindings.length === 1 ? 'music track' : 'music tracks'}</span>
- <span aria-hidden="true">·</span>
- <span>{game.artworkBindings?.length || 0} artwork</span>
- </div>
- </header>
+ <PageHeader
+ icon={Gamepad2}
+ title={game.name}
+ subtitle={app?.name || 'Managed app unavailable'}
+ actions={(
+ <>
+ <Link
+ to="/game"
+ className="inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-lg text-gray-400 hover:bg-port-card hover:text-white"
+ aria-label="All Games"
+ title="All Games"
+ >
+ <ArrowLeft className="h-4 w-4" aria-hidden="true" />
+ </Link>
+ <span className="text-xs text-gray-400">{game.spriteBindings.length} sprites</span>
+ <span aria-hidden="true" className="text-xs text-gray-400">·</span>
+ <span className="text-xs text-gray-400">{game.musicBindings.length} {game.musicBindings.length === 1 ? 'music track' : 'music tracks'}</span>
+ <span aria-hidden="true" className="text-xs text-gray-400">·</span>
+ <span className="text-xs text-gray-400">{game.artworkBindings?.length || 0} artwork</span>
+ </>
+ )}
+ />
<TabPills
tabs={DETAIL_TABS.map((tab) => ({ ...tab, count: tab.count?.(game) }))}
@@ -415,7 +424,6 @@ export default function Game() {
/>
<div className="min-h-0 flex-1 overflow-y-auto p-4">
- <div className="mx-auto max-w-6xl">
{activeTab === 'bundle' && (
<div id="game-panel-bundle" role="tabpanel" aria-labelledby="tab-bundle">
<GameCompilePanel
@@ -478,7 +486,6 @@ export default function Game() {
<GameFeedback history={game.feedbackHistory} submitting={busy === 'feedback'} onSubmit={feedback} />
</div>
)}
- </div>
</div>
</div>
);
diff --git a/client/src/pages/Game.test.jsx b/client/src/pages/Game.test.jsx
index d9ee0e42f6..aa45614e6d 100644
--- a/client/src/pages/Game.test.jsx
+++ b/client/src/pages/Game.test.jsx
@@ -142,8 +142,8 @@ describe('Game page', () => {
expect(back.className).toContain('h-11');
expect(back.className).toContain('w-11');
expect(back).toHaveAttribute('title', 'All Games');
- expect(back.closest('header')?.className).toContain('shrink-0');
- expect(screen.getByRole('tabpanel').parentElement?.parentElement?.className)
+ expect(back.closest('[class*="border-b"]')?.className).toContain('shrink-0');
+ expect(screen.getByRole('tabpanel').parentElement?.className)
.toContain('overflow-y-auto');
});
diff --git a/client/src/pages/Importer.jsx b/client/src/pages/Importer.jsx
index ffded6c8e7..ce909b62e4 100644
--- a/client/src/pages/Importer.jsx
+++ b/client/src/pages/Importer.jsx
@@ -1,6 +1,7 @@
import { memo, useEffect, useMemo, useRef, useState } from 'react';
import { useNavigate, useSearchParams } from 'react-router';
import { FileInput, Loader2, ArrowLeft, CheckCircle2, AlertTriangle, ChevronDown, ChevronRight, Wand2, Sparkles } from 'lucide-react';
+import PageHeader from '../components/PageHeader';
import toast from '../components/ui/Toast';
import { useAsyncAction } from '../hooks/useAsyncAction';
import { useImporterProgress, stageStatusIcon } from '../hooks/useImporterProgress';
@@ -482,18 +483,14 @@ export default function Importer() {
}, { errorMessage: 'Failed to retry issue split' });
return (
- <div className="space-y-6">
- <header className="flex items-start gap-3">
- <FileInput className="w-7 h-7 text-port-accent mt-1" />
- <div>
- <h1 className="text-2xl font-bold text-white">Importer</h1>
- <p className="text-sm text-port-text-muted mt-1">
- Reverse-engineer a finished story, novel, screenplay, or comic script into the pipeline.
- The LLM extracts universe canon, the story arc, and a proposed issue split; you review,
- edit, and commit.
- </p>
- </div>
- </header>
+ <div className="flex h-full min-h-0 flex-col">
+ <PageHeader
+ icon={FileInput}
+ title="Importer"
+ subtitle="Reverse-engineer a finished story, novel, screenplay, or comic script into the pipeline. The LLM extracts universe canon, the story arc, and a proposed issue split; you review, edit, and commit."
+ />
+ <div className="flex-1 min-h-0 overflow-auto p-4">
+ <div className="space-y-6">
{phase === 'intake' && (
<IntakeForm
@@ -550,6 +547,8 @@ export default function Importer() {
retryingIssues={retryingIssues}
/>
)}
+ </div>
+ </div>
</div>
);
}
diff --git a/client/src/pages/Media3D.jsx b/client/src/pages/Media3D.jsx
index aaa02d2487..4c3a4eeb0e 100644
--- a/client/src/pages/Media3D.jsx
+++ b/client/src/pages/Media3D.jsx
@@ -1,6 +1,7 @@
import { useCallback, useEffect, useMemo, useState } from 'react';
import { Link } from 'react-router';
import { Boxes, CheckCircle2, AlertTriangle, Loader2, ImagePlus, Sparkles, Settings2, ChevronDown } from 'lucide-react';
+import PageHeader from '../components/PageHeader';
import { createImageTo3dModel, getImageTo3dModel, listImageTo3dModels } from '../services/api';
import { useModelLifecycle } from '../hooks/useModelLifecycle';
import { useImageTo3dTargets } from '../hooks/useImageTo3dTargets';
@@ -177,226 +178,223 @@ export default function Media3D() {
const gatedHfModels = selectedTarget?.available ? selectedTarget.gatedRepos : null;
return (
- <div className="mx-auto max-w-4xl">
- <header className="mb-5">
- <div className="flex items-center gap-2">
- <Boxes className="h-5 w-5 text-port-accent" />
- <h1 className="text-lg font-semibold text-white">3D</h1>
- </div>
- <p className="mt-1 text-sm text-gray-400">
- Turn a rendered image into a 3D mesh. Pick a source image and model, then render on-device.
- </p>
- </header>
-
- {/* Generation workspace — source image + target selection → on-device render. */}
- <section className="mb-6 grid gap-4 rounded-xl border border-port-border bg-port-card p-4 sm:grid-cols-[200px_1fr]">
- <button
- type="button"
- onClick={() => setPickerOpen(true)}
- className="group relative aspect-square overflow-hidden rounded-lg border border-dashed border-port-border bg-port-bg hover:border-port-accent"
- >
- {selectedImage ? (
- <MediaImage
- src={selectedImage.previewUrl}
- alt="Selected source image"
- className="h-full w-full object-cover"
- />
- ) : (
- <span className="flex h-full flex-col items-center justify-center gap-2 text-sm text-gray-500 group-hover:text-port-accent">
- <ImagePlus className="h-7 w-7" /> Pick source image
- </span>
- )}
- {selectedImage && (
- <span className="port-media-overlay-strong absolute inset-x-2 bottom-2 rounded px-2 py-1 text-center text-xs font-medium">
- Change image
- </span>
- )}
- </button>
-
- <div className="flex flex-col gap-3">
- <div>
- <span className="mb-1 block text-xs text-gray-400">Model</span>
- {loading ? (
- <span className="text-xs text-gray-500">Loading models…</span>
- ) : targets.length === 0 ? (
- <span className="text-xs text-gray-500">No image-to-3D models registered.</span>
+ <div className="flex h-full min-h-0 flex-col">
+ <PageHeader
+ icon={Boxes}
+ title="3D"
+ subtitle="Turn a rendered image into a 3D mesh. Pick a source image and model, then render on-device."
+ />
+ <div className="flex-1 min-h-0 overflow-auto p-4">
+ {/* Generation workspace — source image + target selection → on-device render. */}
+ <section className="mb-6 grid gap-4 rounded-xl border border-port-border bg-port-card p-4 sm:grid-cols-[200px_1fr]">
+ <button
+ type="button"
+ onClick={() => setPickerOpen(true)}
+ className="group relative aspect-square overflow-hidden rounded-lg border border-dashed border-port-border bg-port-bg hover:border-port-accent"
+ >
+ {selectedImage ? (
+ <MediaImage
+ src={selectedImage.previewUrl}
+ alt="Selected source image"
+ className="h-full w-full object-cover"
+ />
) : (
- <div className="flex flex-wrap gap-2">
- {targets.map((t) => {
- const active = selectedTarget?.id === t.id;
- return (
- <button
- key={t.id}
- type="button"
- onClick={() => updateParams({ target: t.id })}
- className={`rounded-lg border px-3 py-1.5 text-xs ${active
- ? 'border-port-accent bg-port-accent/10 text-white'
- : 'border-port-border bg-port-bg text-gray-300 hover:border-port-accent'}`}
- >
- {t.label}
- {isTargetReady(t) && <CheckCircle2 className="ml-1.5 inline h-3 w-3 text-port-success" />}
- </button>
- );
- })}
- </div>
+ <span className="flex h-full flex-col items-center justify-center gap-2 text-sm text-gray-500 group-hover:text-port-accent">
+ <ImagePlus className="h-7 w-7" /> Pick source image
+ </span>
)}
- </div>
-
- <div className="flex flex-col items-start gap-2">
- <button
- type="button"
- onClick={handleGenerate}
- disabled={!!generateGatedReason || generating}
- title={generateGatedReason || undefined}
- className="inline-flex items-center gap-2 rounded-lg bg-port-accent px-4 py-2 text-sm text-white hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-40"
- >
- {generating
- ? <><Loader2 className="h-4 w-4 animate-spin" /> Generating{Number.isFinite(genPercent) ? ` ${Math.round(genPercent)}%` : '…'}</>
- : <><Sparkles className="h-4 w-4" /> Generate 3D</>}
- </button>
- {genError ? (
- <p className="flex items-start gap-1.5 text-xs text-port-error">
- <AlertTriangle className="mt-0.5 h-3.5 w-3.5 shrink-0" /> {genError}
- </p>
- ) : (
- <p className="text-xs text-gray-500">
- {generating ? 'Rendering on-device — this takes a few minutes.' : (generateGatedReason || 'Ready to render on-device.')}
- </p>
+ {selectedImage && (
+ <span className="port-media-overlay-strong absolute inset-x-2 bottom-2 rounded px-2 py-1 text-center text-xs font-medium">
+ Change image
+ </span>
)}
- </div>
+ </button>
- {gatedHfModels?.length > 0 && (
- <Image3dHfAccessNotice
- models={gatedHfModels}
- tokenPresent={hfTokenPresent}
- tokenSource={hfTokenSource}
- onSaved={refreshHfToken}
- />
- )}
-
- <details
- open={optionsOpen}
- onToggle={(event) => setOptionsOpen(event.currentTarget.open)}
- className="group min-w-0"
- >
- <summary className="flex min-h-[44px] cursor-pointer list-none items-center justify-between rounded-lg border border-port-border px-3 py-2 text-sm font-medium text-gray-300 hover:bg-port-border/30 lg:hidden">
- Render options
- <ChevronDown className="h-4 w-4 transition-transform group-open:rotate-180" aria-hidden="true" />
- </summary>
- <div className="mt-3 min-w-0 lg:mt-0">
- <ImageTo3dRenderOptions
- stepsSupported={selectedTarget?.supportsRenderOptions?.steps !== false}
- detailSupported={selectedTarget?.supportsRenderOptions?.detail !== false}
- alphaModeSupported={selectedTarget?.supportsRenderOptions?.alphaMode !== false}
- detail={detail}
- onDetailChange={setDetail}
- alphaMode={alphaMode}
- onAlphaModeChange={setAlphaMode}
- normalMapSupported={selectedTarget?.supportsRenderOptions?.normalMap !== false}
- normalMap={normalMap}
- onNormalMapChange={setNormalMap}
- steps={steps}
- onStepsChange={setSteps}
- seed={seed}
- onSeedChange={setSeed}
- keyBackground={keyBackground}
- onKeyBackgroundChange={setKeyBackground}
- subjectScale={subjectScale}
- onSubjectScaleChange={setSubjectScale}
- sourcePreviewUrl={selectedImage?.previewUrl || null}
- disabled={generating}
- />
+ <div className="flex flex-col gap-3">
+ <div>
+ <span className="mb-1 block text-xs text-gray-400">Model</span>
+ {loading ? (
+ <span className="text-xs text-gray-500">Loading models…</span>
+ ) : targets.length === 0 ? (
+ <span className="text-xs text-gray-500">No image-to-3D models registered.</span>
+ ) : (
+ <div className="flex flex-wrap gap-2">
+ {targets.map((t) => {
+ const active = selectedTarget?.id === t.id;
+ return (
+ <button
+ key={t.id}
+ type="button"
+ onClick={() => updateParams({ target: t.id })}
+ className={`rounded-lg border px-3 py-1.5 text-xs ${active
+ ? 'border-port-accent bg-port-accent/10 text-white'
+ : 'border-port-border bg-port-bg text-gray-300 hover:border-port-accent'}`}
+ >
+ {t.label}
+ {isTargetReady(t) && <CheckCircle2 className="ml-1.5 inline h-3 w-3 text-port-success" />}
+ </button>
+ );
+ })}
+ </div>
+ )}
</div>
- </details>
- </div>
- </section>
-
- {/* Generated-mesh preview. Driven by `?glb=` so a finished render is a
- shareable, reload-safe deep link; empty until one lands. */}
- {glbFromRoute && (
- <section className="mb-6">
- <h2 className="mb-2 text-xs font-medium uppercase tracking-wide text-gray-400">Mesh preview</h2>
- <GlbViewer src={glbFromRoute} />
- </section>
- )}
-
- {/* Library of existing renders — each opens its `/3d/:id` detail
- view (GLB viewer + download). URL is the source of truth for what's
- open, so every card is a deep link. */}
- {records.length > 0 && (
- <section className="mb-6">
- <h2 className="mb-2 text-xs font-medium uppercase tracking-wide text-gray-400">Your 3D models</h2>
- <div className="grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-4">
- {records.map((record) => {
- const status = imageTo3dStatusMeta(record.status);
- return (
- <Link
- key={record.id}
- to={`/3d/${record.id}`}
- className="group overflow-hidden rounded-lg border border-port-border bg-port-card hover:border-port-accent"
- >
- <div className="relative aspect-square bg-port-bg">
- {record.sourceImage?.path && (
- <MediaImage
- src={record.sourceImage.path}
- alt={record.name || 'Source image'}
- className="h-full w-full object-cover opacity-90 group-hover:opacity-100"
- />
- )}
- {record.status === 'ready' && (
- <span className="port-media-overlay-strong absolute right-1.5 top-1.5 rounded p-1 text-port-success">
- <Boxes className="h-3.5 w-3.5" />
- </span>
- )}
- </div>
- <div className="p-2">
- <p className="truncate text-xs font-medium text-white" title={record.name}>{record.name || 'Untitled'}</p>
- <div className="mt-0.5 flex items-center justify-between gap-1">
- <span className={`text-[11px] ${status.className}`}>{status.label}</span>
- <span className="text-[11px] text-gray-500">{timeAgo(record.updatedAt)}</span>
- </div>
- </div>
- </Link>
- );
- })}
- </div>
- </section>
- )}
- {/* Install/repair lives under Models → 3D — these are on-device runtimes, not
- renders — so the generate flow just names the state and links there (#4728). */}
- <section className="rounded-xl border border-port-border bg-port-card p-4">
- <div className="flex flex-wrap items-center justify-between gap-3">
- <div className="min-w-0">
- <h2 className="text-sm font-semibold text-white">Runtimes</h2>
- <p className={`mt-1 text-xs ${error ? 'text-port-error' : 'text-gray-400'}`}>{runtimeSummary}</p>
- </div>
- <div className="flex shrink-0 items-center gap-2">
- {/* A failed registry read also gates Generate (no target resolves), so
- the recovery has to be reachable from here — not only by reloading
- the page. */}
- {error && !loading && (
+ <div className="flex flex-col items-start gap-2">
<button
type="button"
- onClick={reloadTargets}
- className="rounded-md border border-port-error/50 px-3 py-1.5 text-xs text-port-error hover:bg-port-error/20"
+ onClick={handleGenerate}
+ disabled={!!generateGatedReason || generating}
+ title={generateGatedReason || undefined}
+ className="inline-flex items-center gap-2 rounded-lg bg-port-accent px-4 py-2 text-sm text-white hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-40"
>
- Retry
+ {generating
+ ? <><Loader2 className="h-4 w-4 animate-spin" /> Generating{Number.isFinite(genPercent) ? ` ${Math.round(genPercent)}%` : '…'}</>
+ : <><Sparkles className="h-4 w-4" /> Generate 3D</>}
</button>
+ {genError ? (
+ <p className="flex items-start gap-1.5 text-xs text-port-error">
+ <AlertTriangle className="mt-0.5 h-3.5 w-3.5 shrink-0" /> {genError}
+ </p>
+ ) : (
+ <p className="text-xs text-gray-500">
+ {generating ? 'Rendering on-device — this takes a few minutes.' : (generateGatedReason || 'Ready to render on-device.')}
+ </p>
+ )}
+ </div>
+
+ {gatedHfModels?.length > 0 && (
+ <Image3dHfAccessNotice
+ models={gatedHfModels}
+ tokenPresent={hfTokenPresent}
+ tokenSource={hfTokenSource}
+ onSaved={refreshHfToken}
+ />
)}
- <Link
- to="/models/3d"
- className="inline-flex items-center gap-1.5 rounded-md border border-port-border px-3 py-1.5 text-xs text-gray-300 hover:border-port-accent hover:text-white"
+
+ <details
+ open={optionsOpen}
+ onToggle={(event) => setOptionsOpen(event.currentTarget.open)}
+ className="group min-w-0"
>
- <Settings2 className="h-3.5 w-3.5" /> Manage runtimes
- </Link>
+ <summary className="flex min-h-[44px] cursor-pointer list-none items-center justify-between rounded-lg border border-port-border px-3 py-2 text-sm font-medium text-gray-300 hover:bg-port-border/30 lg:hidden">
+ Render options
+ <ChevronDown className="h-4 w-4 transition-transform group-open:rotate-180" aria-hidden="true" />
+ </summary>
+ <div className="mt-3 min-w-0 lg:mt-0">
+ <ImageTo3dRenderOptions
+ stepsSupported={selectedTarget?.supportsRenderOptions?.steps !== false}
+ detailSupported={selectedTarget?.supportsRenderOptions?.detail !== false}
+ alphaModeSupported={selectedTarget?.supportsRenderOptions?.alphaMode !== false}
+ detail={detail}
+ onDetailChange={setDetail}
+ alphaMode={alphaMode}
+ onAlphaModeChange={setAlphaMode}
+ normalMapSupported={selectedTarget?.supportsRenderOptions?.normalMap !== false}
+ normalMap={normalMap}
+ onNormalMapChange={setNormalMap}
+ steps={steps}
+ onStepsChange={setSteps}
+ seed={seed}
+ onSeedChange={setSeed}
+ keyBackground={keyBackground}
+ onKeyBackgroundChange={setKeyBackground}
+ subjectScale={subjectScale}
+ onSubjectScaleChange={setSubjectScale}
+ sourcePreviewUrl={selectedImage?.previewUrl || null}
+ disabled={generating}
+ />
+ </div>
+ </details>
</div>
- </div>
- </section>
+ </section>
+
+ {/* Generated-mesh preview. Driven by `?glb=` so a finished render is a
+ shareable, reload-safe deep link; empty until one lands. */}
+ {glbFromRoute && (
+ <section className="mb-6">
+ <h2 className="mb-2 text-xs font-medium uppercase tracking-wide text-gray-400">Mesh preview</h2>
+ <GlbViewer src={glbFromRoute} />
+ </section>
+ )}
+
+ {/* Library of existing renders — each opens its `/3d/:id` detail
+ view (GLB viewer + download). URL is the source of truth for what's
+ open, so every card is a deep link. */}
+ {records.length > 0 && (
+ <section className="mb-6">
+ <h2 className="mb-2 text-xs font-medium uppercase tracking-wide text-gray-400">Your 3D models</h2>
+ <div className="grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-4">
+ {records.map((record) => {
+ const status = imageTo3dStatusMeta(record.status);
+ return (
+ <Link
+ key={record.id}
+ to={`/3d/${record.id}`}
+ className="group overflow-hidden rounded-lg border border-port-border bg-port-card hover:border-port-accent"
+ >
+ <div className="relative aspect-square bg-port-bg">
+ {record.sourceImage?.path && (
+ <MediaImage
+ src={record.sourceImage.path}
+ alt={record.name || 'Source image'}
+ className="h-full w-full object-cover opacity-90 group-hover:opacity-100"
+ />
+ )}
+ {record.status === 'ready' && (
+ <span className="port-media-overlay-strong absolute right-1.5 top-1.5 rounded p-1 text-port-success">
+ <Boxes className="h-3.5 w-3.5" />
+ </span>
+ )}
+ </div>
+ <div className="p-2">
+ <p className="truncate text-xs font-medium text-white" title={record.name}>{record.name || 'Untitled'}</p>
+ <div className="mt-0.5 flex items-center justify-between gap-1">
+ <span className={`text-[11px] ${status.className}`}>{status.label}</span>
+ <span className="text-[11px] text-gray-500">{timeAgo(record.updatedAt)}</span>
+ </div>
+ </div>
+ </Link>
+ );
+ })}
+ </div>
+ </section>
+ )}
+
+ {/* Install/repair lives under Models → 3D — these are on-device runtimes, not
+ renders — so the generate flow just names the state and links there (#4728). */}
+ <section className="rounded-xl border border-port-border bg-port-card p-4">
+ <div className="flex flex-wrap items-center justify-between gap-3">
+ <div className="min-w-0">
+ <h2 className="text-sm font-semibold text-white">Runtimes</h2>
+ <p className={`mt-1 text-xs ${error ? 'text-port-error' : 'text-gray-400'}`}>{runtimeSummary}</p>
+ </div>
+ <div className="flex shrink-0 items-center gap-2">
+ {/* A failed registry read also gates Generate (no target resolves), so
+ the recovery has to be reachable from here — not only by reloading
+ the page. */}
+ {error && !loading && (
+ <button
+ type="button"
+ onClick={reloadTargets}
+ className="rounded-md border border-port-error/50 px-3 py-1.5 text-xs text-port-error hover:bg-port-error/20"
+ >
+ Retry
+ </button>
+ )}
+ <Link
+ to="/models/3d"
+ className="inline-flex items-center gap-1.5 rounded-md border border-port-border px-3 py-1.5 text-xs text-gray-300 hover:border-port-accent hover:text-white"
+ >
+ <Settings2 className="h-3.5 w-3.5" /> Manage runtimes
+ </Link>
+ </div>
+ </div>
+ </section>
- {/* Searchable render-history picker (reused from Image Gen). Selecting an
- image drives `?image=` so the choice is deep-linkable. */}
- <GalleryImagePicker open={pickerOpen} onClose={() => setPickerOpen(false)} onSelect={handlePick} allowUpload />
+ {/* Searchable render-history picker (reused from Image Gen). Selecting an
+ image drives `?image=` so the choice is deep-linkable. */}
+ <GalleryImagePicker open={pickerOpen} onClose={() => setPickerOpen(false)} onSelect={handlePick} allowUpload />
+ </div>
</div>
);
}
diff --git a/client/src/pages/MediaGen.jsx b/client/src/pages/MediaGen.jsx
index 17b7a3e6a0..76d169ff0e 100644
--- a/client/src/pages/MediaGen.jsx
+++ b/client/src/pages/MediaGen.jsx
@@ -1,5 +1,6 @@
import { useNavigate, useLocation, Outlet } from 'react-router';
import { Layers, Image as ImageIcon, Film, History, Scissors, FolderOpen, Box, Pencil, ScanEye } from 'lucide-react';
+import PageHeader from '../components/PageHeader';
import TabPills from '../components/ui/TabPills';
import { getPageNavTabs } from '../../../server/lib/navManifest.js';
import { buildPageNavTabs } from '../lib/pageNavTabs.js';
@@ -33,10 +34,7 @@ export default function MediaGen() {
return (
<div className="flex min-w-0 flex-col h-full">
- <div className="flex min-w-0 items-center gap-3 p-3 sm:p-4 border-b border-port-border">
- <Layers className="w-6 h-6 text-port-accent" />
- <h1 className="min-w-0 truncate text-2xl font-bold text-white">Media Gen</h1>
- </div>
+ <PageHeader icon={Layers} title="Media Gen" />
<TabPills
tabs={TABS}
diff --git a/client/src/pages/MoodBoards.jsx b/client/src/pages/MoodBoards.jsx
index b17395d005..fb84a277de 100644
--- a/client/src/pages/MoodBoards.jsx
+++ b/client/src/pages/MoodBoards.jsx
@@ -11,6 +11,7 @@
import { useEffect, useState, useCallback, useMemo } from 'react';
import { Link, useNavigate } from 'react-router';
import { Plus, Palette, Trash2, ImageIcon, FileText, Film } from 'lucide-react';
+import PageHeader from '../components/PageHeader';
import PageSkeleton from '../components/ui/PageSkeleton';
import toast from '../components/ui/Toast';
import InlineConfirmRow from '../components/ui/InlineConfirmRow';
@@ -217,51 +218,49 @@ export default function MoodBoards() {
};
return (
- <div className="max-w-6xl mx-auto space-y-4">
- <div className="flex items-center justify-between mb-4">
- <div className="flex items-center gap-2">
- <Palette className="w-6 h-6 text-port-accent" aria-hidden="true" />
- <h1 className="text-xl font-semibold text-white">Mood Boards</h1>
- </div>
- <button
- type="button"
- onClick={handleCreate}
- disabled={creating}
- className="flex items-center gap-1.5 px-3 py-1.5 text-sm rounded bg-port-accent text-white hover:bg-port-accent/80 disabled:opacity-50 transition-colors"
- >
- <Plus className="w-4 h-4" aria-hidden="true" />
- New Board
- </button>
+ <div className="flex h-full min-h-0 flex-col">
+ <PageHeader
+ icon={Palette}
+ title="Mood Boards"
+ subtitle="Collect visual and textual references for your universes, scenes, and treatments."
+ actions={(
+ <button
+ type="button"
+ onClick={handleCreate}
+ disabled={creating}
+ className="flex items-center gap-1.5 px-3 py-1.5 text-sm rounded bg-port-accent text-white hover:bg-port-accent/80 disabled:opacity-50 transition-colors"
+ >
+ <Plus className="w-4 h-4" aria-hidden="true" />
+ New Board
+ </button>
+ )}
+ />
+ <div className="flex-1 min-h-0 overflow-auto p-4">
+ {loading ? (
+ <PageSkeleton header="none" label="Loading mood boards" cards={4} sidebar={false} />
+ ) : boards.length === 0 ? (
+ <EmptyState
+ icon={Palette}
+ title="No mood boards yet"
+ message="A board is a canvas of image and text references that feeds the Create suite. Make one to start pinning."
+ actionLabel="Create your first board"
+ onAction={handleCreate}
+ />
+ ) : (
+ <ul className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
+ {boards.map((board) => (
+ <MoodBoardCard
+ key={board.id}
+ board={board}
+ onDelete={(id) => setConfirmingId(id)}
+ isConfirming={confirmingId === board.id}
+ onConfirmDelete={handleDelete}
+ onCancelDelete={() => setConfirmingId(null)}
+ />
+ ))}
+ </ul>
+ )}
</div>
-
- <p className="text-sm text-gray-400 mb-4">
- Collect visual and textual references for your universes, scenes, and treatments.
- </p>
-
- {loading ? (
- <PageSkeleton header="none" label="Loading mood boards" cards={4} sidebar={false} />
- ) : boards.length === 0 ? (
- <EmptyState
- icon={Palette}
- title="No mood boards yet"
- message="A board is a canvas of image and text references that feeds the Create suite. Make one to start pinning."
- actionLabel="Create your first board"
- onAction={handleCreate}
- />
- ) : (
- <ul className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
- {boards.map((board) => (
- <MoodBoardCard
- key={board.id}
- board={board}
- onDelete={(id) => setConfirmingId(id)}
- isConfirming={confirmingId === board.id}
- onConfirmDelete={handleDelete}
- onCancelDelete={() => setConfirmingId(null)}
- />
- ))}
- </ul>
- )}
</div>
);
}
diff --git a/client/src/pages/Music.jsx b/client/src/pages/Music.jsx
index 03a32df909..0d40aea6b7 100644
--- a/client/src/pages/Music.jsx
+++ b/client/src/pages/Music.jsx
@@ -11,7 +11,8 @@
*/
import { useParams, useNavigate, Navigate } from 'react-router';
-import { Music as MusicIcon, Mic, Disc3, AudioLines, Wand2 } from 'lucide-react';
+import { Mic, Disc3, AudioLines, Wand2 } from 'lucide-react';
+import PageHeader from '../components/PageHeader';
import ArtistsManager from '../components/music/ArtistsManager';
import AlbumsManager from '../components/music/AlbumsManager';
import TracksManager from '../components/music/TracksManager';
@@ -45,10 +46,7 @@ export default function Music() {
return (
<div className="flex h-full flex-col">
- <div className="flex items-center gap-3 border-b border-port-border p-4">
- <MusicIcon className="w-6 h-6 text-port-accent" />
- <h1 className="text-2xl font-bold text-white">Music</h1>
- </div>
+ <PageHeader icon={Mic} title="Music" />
{/* Selection lives in the URL (`/music/:tab`) — TabPills drives onChange
callbacks rather than links, so we navigate() to keep the route canonical
diff --git a/client/src/pages/Pipeline.jsx b/client/src/pages/Pipeline.jsx
index 262d3ae60d..cd5de4ad29 100644
--- a/client/src/pages/Pipeline.jsx
+++ b/client/src/pages/Pipeline.jsx
@@ -11,6 +11,7 @@ import { useEffect, useMemo, useRef, useState } from 'react';
import { useConfirmDelete } from '../hooks/useConfirmDelete';
import { Link, useNavigate, useSearchParams } from 'react-router';
import { Plus, Workflow as WorkflowIcon, Trash2, Loader2, Globe2, FileInput, Sparkles, BookOpen, Waypoints } from 'lucide-react';
+import PageHeader from '../components/PageHeader';
import toast from '../components/ui/Toast';
import ConfirmButtonPair from '../components/ui/ConfirmButtonPair';
import ImageThumb from '../components/ui/ImageThumb';
@@ -289,37 +290,33 @@ export default function Pipeline() {
});
return (
- <div>
- <div className="flex items-center justify-between mb-6 flex-wrap gap-3">
- <div className="flex items-center gap-3">
- <WorkflowIcon className="w-6 h-6 text-port-accent" />
- <h1 className="text-2xl font-bold text-white">Series Pipeline</h1>
- </div>
- <div className="flex items-center gap-2">
- <Link
- to="/importer"
- className="inline-flex items-center gap-2 px-3 py-2 rounded-lg border border-port-border text-gray-300 hover:text-white hover:border-port-accent/50 text-sm font-medium"
- title="Reverse-engineer an existing manuscript, novel, screenplay, or comic script into a series"
- >
- <FileInput size={16} aria-hidden="true" />
- Import
- </Link>
- <button
- type="button"
- onClick={() => setShowForm((v) => !v)}
- className="inline-flex items-center gap-2 px-3 py-2 rounded-lg bg-port-accent hover:bg-port-accent/90 text-white text-sm font-medium"
- >
- <Plus size={16} aria-hidden="true" />
- New Series
- </button>
- </div>
- </div>
-
- <p className="text-sm text-gray-400 mb-6">
- Each series carries a shared bible — logline, premise, characters, style, optional World — that
- every issue/episode below inherits into its stage prompts. Pipeline runs an idea seed through prose →
- comic script + teleplay (text), and hands off to image gen / Creative Director for the visual stages.
- </p>
+ <div className="flex h-full min-h-0 flex-col">
+ <PageHeader
+ icon={WorkflowIcon}
+ title="Series Pipeline"
+ subtitle="Each series carries a shared bible — logline, premise, characters, style, optional World — that every issue/episode below inherits into its stage prompts. Pipeline runs an idea seed through prose → comic script + teleplay (text), and hands off to image gen / Creative Director for the visual stages."
+ actions={(
+ <div className="flex items-center gap-2">
+ <Link
+ to="/importer"
+ className="inline-flex items-center gap-2 px-3 py-2 rounded-lg border border-port-border text-gray-300 hover:text-white hover:border-port-accent/50 text-sm font-medium"
+ title="Reverse-engineer an existing manuscript, novel, screenplay, or comic script into a series"
+ >
+ <FileInput size={16} aria-hidden="true" />
+ Import
+ </Link>
+ <button
+ type="button"
+ onClick={() => setShowForm((v) => !v)}
+ className="inline-flex items-center gap-2 px-3 py-2 rounded-lg bg-port-accent hover:bg-port-accent/90 text-white text-sm font-medium"
+ >
+ <Plus size={16} aria-hidden="true" />
+ New Series
+ </button>
+ </div>
+ )}
+ />
+ <div className="flex-1 min-h-0 overflow-auto p-4">
{showForm && (
<form onSubmit={handleCreate} className="mb-6 p-4 bg-port-card border border-port-border rounded-lg space-y-3">
@@ -616,6 +613,7 @@ export default function Pipeline() {
})}
</ul>
)}
+ </div>
</div>
);
}
diff --git a/client/src/pages/PipelineEditorialChecks.jsx b/client/src/pages/PipelineEditorialChecks.jsx
index be2256b0c4..8f985ef2f3 100644
--- a/client/src/pages/PipelineEditorialChecks.jsx
+++ b/client/src/pages/PipelineEditorialChecks.jsx
@@ -21,6 +21,7 @@ import EditorialFindingsTriage from '../components/pipeline/editorial/EditorialF
import EditorialHealthPanel from '../components/pipeline/editorial/EditorialHealthPanel';
import SeriesSeverityConfig from '../components/pipeline/editorial/SeriesSeverityConfig';
import ProviderModelSelector from '../components/ProviderModelSelector';
+import PageHeader from '../components/PageHeader';
import TabPills from '../components/ui/TabPills';
import { groupChecksByScope, groupFindingsByCheck, normCategory, canonEntitiesFromUniverse } from '../lib/editorialChecks';
import { usePipelineProgress } from '../hooks/usePipelineProgress';
@@ -626,61 +627,64 @@ export default function PipelineEditorialChecks() {
const runDisabled = !seriesId || runActive || runStarting || anySaving || formSaving || savingSeriesIds.size > 0 || severitySaving;
return (
- <div className="mx-auto max-w-6xl space-y-4">
- {/* Header */}
- <div className="space-y-2">
- <Link to="/pipeline" className="inline-flex items-center gap-1 text-xs text-gray-400 hover:text-gray-200">
- <ArrowLeft size={13} /> Series Pipeline
- </Link>
- <div className="flex flex-wrap items-center justify-between gap-3">
- <h1 className="flex items-center gap-2 text-xl font-semibold text-gray-100">
- <ListChecks size={20} className="text-port-accent" /> Editorial Checks
- </h1>
- <div className="flex w-full flex-wrap items-center gap-2 sm:w-auto">
- <label htmlFor="ec-series" className="sr-only">Series</label>
- <select
- id="ec-series"
- value={seriesId}
- onChange={(e) => onSeriesChange(e.target.value)}
- className="w-full rounded border border-port-border bg-port-card px-2 py-1.5 text-sm text-gray-100 focus:border-port-accent focus:outline-none sm:w-auto"
- >
- <option value="">Select a series…</option>
- {series.map((s) => (
- <option key={s.id} value={s.id}>{s.title || s.name || s.id}</option>
- ))}
- </select>
- {runActive ? (
- <button
- type="button"
- onClick={cancelRun}
- className="inline-flex flex-1 items-center justify-center gap-1.5 rounded bg-port-error/20 px-3 py-1.5 text-sm text-rose-300 hover:bg-port-error/30 sm:flex-none"
+ <div className="flex h-full min-h-0 flex-col">
+ <PageHeader
+ icon={ListChecks}
+ title="Editorial Checks"
+ actions={(
+ <>
+ <Link to="/pipeline" className="inline-flex items-center gap-1 text-xs text-gray-400 hover:text-gray-200">
+ <ArrowLeft size={13} /> Series Pipeline
+ </Link>
+ <div className="flex w-full flex-wrap items-center gap-2 sm:w-auto">
+ <label htmlFor="ec-series" className="sr-only">Series</label>
+ <select
+ id="ec-series"
+ value={seriesId}
+ onChange={(e) => onSeriesChange(e.target.value)}
+ className="w-full rounded border border-port-border bg-port-card px-2 py-1.5 text-sm text-gray-100 focus:border-port-accent focus:outline-none sm:w-auto"
>
- <Square size={14} /> Cancel
- </button>
- ) : (
- <button
- type="button"
- onClick={() => runChecks(null)}
- disabled={runDisabled || enabledCount === 0}
- title={enabledCount === 0 ? 'No checks enabled' : undefined}
- className="inline-flex flex-1 items-center justify-center gap-1.5 rounded bg-port-accent px-3 py-1.5 text-sm text-white hover:bg-port-accent/90 disabled:cursor-not-allowed disabled:opacity-50 sm:flex-none"
- >
- {runStarting ? <Loader2 size={14} className="animate-spin" /> : <Play size={14} />}
- Run all enabled ({enabledCount})
- </button>
- )}
- {!runActive && selectedIds.size > 0 ? (
- <button
- type="button"
- onClick={() => runChecks([...selectedIds])}
- disabled={runDisabled}
- className="inline-flex flex-1 items-center justify-center gap-1.5 rounded border border-port-accent px-3 py-1.5 text-sm text-port-accent hover:bg-port-accent/10 disabled:cursor-not-allowed disabled:opacity-50 sm:flex-none"
- >
- <Play size={14} /> Run selected ({selectedIds.size})
- </button>
- ) : null}
- </div>
- </div>
+ <option value="">Select a series…</option>
+ {series.map((s) => (
+ <option key={s.id} value={s.id}>{s.title || s.name || s.id}</option>
+ ))}
+ </select>
+ {runActive ? (
+ <button
+ type="button"
+ onClick={cancelRun}
+ className="inline-flex flex-1 items-center justify-center gap-1.5 rounded bg-port-error/20 px-3 py-1.5 text-sm text-rose-300 hover:bg-port-error/30 sm:flex-none"
+ >
+ <Square size={14} /> Cancel
+ </button>
+ ) : (
+ <button
+ type="button"
+ onClick={() => runChecks(null)}
+ disabled={runDisabled || enabledCount === 0}
+ title={enabledCount === 0 ? 'No checks enabled' : undefined}
+ className="inline-flex flex-1 items-center justify-center gap-1.5 rounded bg-port-accent px-3 py-1.5 text-sm text-white hover:bg-port-accent/90 disabled:cursor-not-allowed disabled:opacity-50 sm:flex-none"
+ >
+ {runStarting ? <Loader2 size={14} className="animate-spin" /> : <Play size={14} />}
+ Run all enabled ({enabledCount})
+ </button>
+ )}
+ {!runActive && selectedIds.size > 0 ? (
+ <button
+ type="button"
+ onClick={() => runChecks([...selectedIds])}
+ disabled={runDisabled}
+ className="inline-flex flex-1 items-center justify-center gap-1.5 rounded border border-port-accent px-3 py-1.5 text-sm text-port-accent hover:bg-port-accent/10 disabled:cursor-not-allowed disabled:opacity-50 sm:flex-none"
+ >
+ <Play size={14} /> Run selected ({selectedIds.size})
+ </button>
+ ) : null}
+ </div>
+ </>
+ )}
+ />
+ <div className="flex-1 min-h-0 overflow-auto p-4">
+ <div className="mx-auto max-w-6xl space-y-4">
{/* AI provider/model override for the editorial pass. Empty = use the
active/stage provider; disabled while a run is in flight or starting. */}
<div className="flex flex-wrap items-center gap-2">
@@ -710,7 +714,6 @@ export default function PipelineEditorialChecks() {
{!seriesId ? (
<p className="text-xs text-gray-500">Pick a series to run checks and triage findings. The catalog below applies to every series.</p>
) : null}
- </div>
{selectedSeries ? (
<SeriesSeverityConfig
@@ -832,6 +835,8 @@ export default function PipelineEditorialChecks() {
</div>
</div>
)}
+ </div>
+ </div>
</div>
);
}
diff --git a/client/src/pages/Rounds.jsx b/client/src/pages/Rounds.jsx
index dbf8398c17..6aef61fc05 100644
--- a/client/src/pages/Rounds.jsx
+++ b/client/src/pages/Rounds.jsx
@@ -4,13 +4,14 @@
* Lists every round the user is writing or learning and lets them create, open,
* or delete any of them. The heavy editor lives at `/rounds/:id`; the learning
* reference (dirge rhythm shapes, the layer ladder, notation help) lives at
- * `/rounds/guide`. Mirrors the Universes index — a plain padded+scrolling page
- * (NOT full-width), one card/row per round.
+ * `/rounds/guide`. The index is a full-width PageHeader shell that owns its
+ * scroll (the editor and guide still live at their own routes).
*/
import { useEffect, useState, useCallback } from 'react';
import { useNavigate, Link } from 'react-router';
import { Music, Plus, Trash2, BookOpen, CheckCircle2, Circle, Wand2 } from 'lucide-react';
+import PageHeader from '../components/PageHeader';
import toast from '../components/ui/Toast';
import ConfirmButtonPair from '../components/ui/ConfirmButtonPair';
import { timeAgo } from '../utils/formatters';
@@ -77,24 +78,22 @@ export default function Rounds() {
), [confirmDelete]);
return (
- <div>
- <div className="flex items-center justify-between gap-3 mb-2">
- <div className="flex items-center gap-3">
- <Music className="w-6 h-6 text-port-accent" />
- <h1 className="text-2xl font-bold text-white">Rounds</h1>
- </div>
- <Link
- to="/rounds/guide"
- className="flex items-center gap-2 px-3 py-2 text-sm rounded-lg border border-port-border text-gray-300 hover:text-white hover:bg-port-border/50"
- >
- <BookOpen size={16} />
- Learning Guide
- </Link>
- </div>
- <p className="text-sm text-gray-400 mb-6">
- Write and learn a cappella rounds — dirges, ballads, and harmonies. Track lyrics,
- rhythm shapes, and the voice layers you're stacking.
- </p>
+ <div className="flex h-full min-h-0 flex-col">
+ <PageHeader
+ icon={Music}
+ title="Rounds"
+ subtitle="Write and learn a cappella rounds — dirges, ballads, and harmonies. Track lyrics, rhythm shapes, and the voice layers you're stacking."
+ actions={(
+ <Link
+ to="/rounds/guide"
+ className="flex items-center gap-2 px-3 py-2 text-sm rounded-lg border border-port-border text-gray-300 hover:text-white hover:bg-port-border/50"
+ >
+ <BookOpen size={16} />
+ Learning Guide
+ </Link>
+ )}
+ />
+ <div className="flex-1 min-h-0 overflow-auto p-4">
{/* Create form */}
<form
@@ -205,6 +204,7 @@ export default function Rounds() {
})}
</ul>
)}
+ </div>
</div>
);
}
diff --git a/client/src/pages/Sharing.jsx b/client/src/pages/Sharing.jsx
index ff48784569..3fccf8ba18 100644
--- a/client/src/pages/Sharing.jsx
+++ b/client/src/pages/Sharing.jsx
@@ -12,6 +12,7 @@ import { useParams, useNavigate } from 'react-router';
import {
Share2, Plus, Trash2, Folder, Inbox, History, Save, Loader2, Check, X, Users, AlertCircle, RefreshCw, Copy, GitMerge,
} from 'lucide-react';
+import PageHeader from '../components/PageHeader';
import PageSkeleton from '../components/ui/PageSkeleton';
import toast from '../components/ui/Toast';
import InlineConfirmRow from '../components/ui/InlineConfirmRow';
@@ -73,17 +74,17 @@ const BUCKET_TABS = [
{ id: 'settings', label: 'Settings', icon: Save },
];
-function SharingHeader({ active }) {
+function SharingHeader({ active, children }) {
return (
- <>
- <div className="flex items-center gap-3 mb-4">
- <Share2 className="w-6 h-6 text-port-accent" />
- <h1 className="text-2xl font-bold text-white">Sharing</h1>
- </div>
- <div className="mb-6">
+ <div className="flex h-full min-h-0 flex-col">
+ <PageHeader icon={Share2} title="Sharing" />
+ <div className="shrink-0">
<RouteTabsHeader tabs={SECTIONS} activeTab={active} ariaLabel="Sharing sections" />
</div>
- </>
+ <div className="flex-1 min-h-0 overflow-auto p-4">
+ {children}
+ </div>
+ </div>
);
}
@@ -95,13 +96,12 @@ export default function Sharing() {
// tab id that doesn't exist (#7420).
const activeTabLabel = SECTIONS.find((item) => item.id === section)?.label;
return (
- <div>
- <SharingHeader active={section} />
+ <SharingHeader active={section}>
<div role="tabpanel" aria-labelledby="sharing-panel-heading">
<h2 id="sharing-panel-heading" className="sr-only">{activeTabLabel}</h2>
{section === 'duplicates' ? <DuplicatesTab /> : <ConflictsTab />}
</div>
- </div>
+ </SharingHeader>
);
}
return <SharingBuckets selectedId={bucketId || null} />;
@@ -292,8 +292,7 @@ function SharingBuckets({ selectedId }) {
const displayNameDirty = sharingDisplayName !== savedDisplayName || sharingBio !== savedBio;
return (
- <div>
- <SharingHeader active="buckets" />
+ <SharingHeader active="buckets">
{/* RouteTabsHeader passes no `controlsIdPrefix`, so the panel names
itself with its own heading rather than an `aria-labelledby`
borrowed from a tab id that doesn't exist (#7420). */}
@@ -556,7 +555,7 @@ function SharingBuckets({ selectedId }) {
</section>
</div>
</div>
- </div>
+ </SharingHeader>
);
}
diff --git a/client/src/pages/Sprites.jsx b/client/src/pages/Sprites.jsx
index 65633dd420..f9fc9d29e7 100644
--- a/client/src/pages/Sprites.jsx
+++ b/client/src/pages/Sprites.jsx
@@ -1,6 +1,7 @@
import { useEffect, useState, useCallback, useMemo, useRef } from 'react';
import { useParams, useNavigate, useSearchParams } from 'react-router';
import { PersonStanding, LayoutGrid, Images, Scissors, Film } from 'lucide-react';
+import PageHeader from '../components/PageHeader';
import PageSkeleton from '../components/ui/PageSkeleton';
import EmptyState from '../components/EmptyState';
import toast from '../components/ui/Toast';
@@ -436,44 +437,47 @@ export default function Sprites() {
}, [detail, walkRenders.pendingJobs, referenceRenders.pendingJobs, generateWalk, generateAnchor, hasImageBackend, imageMode, openTrimmer]);
return (
- <div className="space-y-4">
- {/* Header owns identity (left) plus every library-wide control (right):
- a "Library" link back to the catalog (only while a sprite is open),
- search, and the create/import actions — no left sidebar, so the
- catalog/detail pane below runs full width. */}
- <div className="flex flex-wrap items-center gap-3">
- <div className="flex items-center gap-3 mr-auto">
- <PersonStanding className="w-6 h-6 text-port-accent" />
- <h1 className="text-2xl font-bold text-white">Sprite Manager</h1>
- </div>
- {id && (
- <button
- type="button"
- onClick={() => navigate('/sprites')}
- className="flex items-center gap-2 px-3 py-1.5 bg-port-card border border-port-border hover:border-port-accent text-gray-300 rounded text-sm"
- >
- <LayoutGrid className="w-4 h-4" /> Library
- </button>
+ <div className="flex h-full min-h-0 flex-col">
+ {/* Library-wide controls sit in the title bar: a "Library" link back to
+ the catalog (only while a sprite is open), search, and the
+ create/import actions — no left sidebar, so the catalog/detail pane
+ below runs full width. */}
+ <PageHeader
+ icon={PersonStanding}
+ title="Sprite Manager"
+ actions={(
+ <>
+ {id && (
+ <button
+ type="button"
+ onClick={() => navigate('/sprites')}
+ className="flex items-center gap-2 px-3 py-1.5 bg-port-card border border-port-border hover:border-port-accent text-gray-300 rounded text-sm"
+ >
+ <LayoutGrid className="w-4 h-4" /> Library
+ </button>
+ )}
+ {records?.length > 0 && <SpriteSearch records={records} onSelect={goto} />}
+ {/* Library-wide, so it sits beside create/import and is reachable from
+ the bare /sprites catalog as well as an open record. */}
+ <button
+ type="button"
+ onClick={() => setAnimationTypesOpen(true)}
+ className="flex items-center gap-2 px-3 py-1.5 bg-port-card border border-port-border hover:border-port-accent text-gray-300 rounded text-sm"
+ >
+ <Film className="w-4 h-4" /> Animation types
+ </button>
+ <NewSpritePanel
+ open={newSpriteOpen}
+ onOpenChange={setNewSpriteOpen}
+ onCreated={(record) => { refresh(); navigate(`/sprites/${record.id}`); }}
+ />
+ {/* Re-import while a sprite is open must refresh the open detail too,
+ not just the library list. */}
+ <ImportPanel onImported={() => { refresh(); if (id) refreshDetail(); }} />
+ </>
)}
- {records?.length > 0 && <SpriteSearch records={records} onSelect={goto} />}
- {/* Library-wide, so it sits beside create/import and is reachable from
- the bare /sprites catalog as well as an open record. */}
- <button
- type="button"
- onClick={() => setAnimationTypesOpen(true)}
- className="flex items-center gap-2 px-3 py-1.5 bg-port-card border border-port-border hover:border-port-accent text-gray-300 rounded text-sm"
- >
- <Film className="w-4 h-4" /> Animation types
- </button>
- <NewSpritePanel
- open={newSpriteOpen}
- onOpenChange={setNewSpriteOpen}
- onCreated={(record) => { refresh(); navigate(`/sprites/${record.id}`); }}
- />
- {/* Re-import while a sprite is open must refresh the open detail too,
- not just the library list. */}
- <ImportPanel onImported={() => { refresh(); if (id) refreshDetail(); }} />
- </div>
+ />
+ <div className="flex-1 min-h-0 overflow-auto p-4">
<div>
<section className="min-w-0">
{!id ? (
@@ -642,6 +646,7 @@ export default function Sprites() {
)}
</section>
</div>
+ </div>
{/* Rendered last so the slide-in panel layers over the catalog/detail pane.
A newly-authored type only reaches an OPEN record's workflow list on the
next detail fetch — so refetch when the drawer reports a change, and skip
diff --git a/client/src/pages/StartStory.jsx b/client/src/pages/StartStory.jsx
index 9674125969..5f1d3a704d 100644
--- a/client/src/pages/StartStory.jsx
+++ b/client/src/pages/StartStory.jsx
@@ -1,6 +1,7 @@
import { useEffect, useState } from 'react';
import { useNavigate } from 'react-router';
import { Rocket, Lightbulb, FileInput, NotebookPen } from 'lucide-react';
+import PageHeader from '../components/PageHeader';
import { listUniverseNames } from '../services/api';
import toast from '../components/ui/Toast';
@@ -80,92 +81,91 @@ export default function StartStory() {
};
return (
- <div className="max-w-4xl mx-auto space-y-6">
- <header>
- <h1 className="text-2xl font-bold flex items-center gap-2">
- <Rocket className="w-6 h-6 text-port-accent" /> Start a Story
- </h1>
- <p className="text-gray-400 mt-1">
- How do you want to begin? Every path lands in the same place — a universe, a series, and the
- production pipeline — so pick whichever door fits where your story is today.
- </p>
- </header>
+ <div className="flex h-full min-h-0 flex-col">
+ <PageHeader
+ icon={Rocket}
+ title="Start a Story"
+ subtitle="How do you want to begin? Every path lands in the same place — a universe, a series, and the production pipeline — so pick whichever door fits where your story is today."
+ />
+ <div className="flex-1 min-h-0 overflow-auto p-4">
+ <div className="max-w-4xl mx-auto space-y-6">
+ {/* Universe choice, asked up front for all three modes. */}
+ <section className="bg-port-card border border-port-border rounded-lg p-4 space-y-3">
+ <h2 className="text-sm font-semibold text-gray-200">Which universe?</h2>
+ <div className="flex flex-col sm:flex-row sm:items-center gap-3">
+ <label className="flex items-center gap-2 text-sm text-gray-300 cursor-pointer">
+ <input
+ type="radio"
+ name="universe-choice"
+ checked={!useExisting}
+ onChange={() => { setUseExisting(false); setUniverseId(''); }}
+ className="accent-port-accent"
+ />
+ Start fresh
+ </label>
+ <label className="flex items-center gap-2 text-sm text-gray-300 cursor-pointer">
+ <input
+ type="radio"
+ name="universe-choice"
+ checked={useExisting}
+ onChange={() => setUseExisting(true)}
+ className="accent-port-accent"
+ disabled={namedUniverses.length === 0}
+ />
+ Use an existing universe
+ </label>
+ {useExisting && (
+ <select
+ id="start-story-universe"
+ aria-label="Existing universe"
+ value={universeId}
+ onChange={(e) => setUniverseId(e.target.value)}
+ className="bg-port-bg border border-port-border rounded px-3 py-1.5 text-sm text-gray-200 sm:ml-auto"
+ >
+ <option value="">Select a universe…</option>
+ {namedUniverses.map((u) => (
+ <option key={u.id} value={u.id}>{u.name}</option>
+ ))}
+ </select>
+ )}
+ </div>
+ {needsUniversePick && (
+ <p className="text-xs text-port-warning">Pick a universe above to continue, or switch to “Start fresh.”</p>
+ )}
+ </section>
- {/* Universe choice, asked up front for all three modes. */}
- <section className="bg-port-card border border-port-border rounded-lg p-4 space-y-3">
- <h2 className="text-sm font-semibold text-gray-200">Which universe?</h2>
- <div className="flex flex-col sm:flex-row sm:items-center gap-3">
- <label className="flex items-center gap-2 text-sm text-gray-300 cursor-pointer">
- <input
- type="radio"
- name="universe-choice"
- checked={!useExisting}
- onChange={() => { setUseExisting(false); setUniverseId(''); }}
- className="accent-port-accent"
- />
- Start fresh
- </label>
- <label className="flex items-center gap-2 text-sm text-gray-300 cursor-pointer">
- <input
- type="radio"
- name="universe-choice"
- checked={useExisting}
- onChange={() => setUseExisting(true)}
- className="accent-port-accent"
- disabled={namedUniverses.length === 0}
- />
- Use an existing universe
- </label>
- {useExisting && (
- <select
- id="start-story-universe"
- aria-label="Existing universe"
- value={universeId}
- onChange={(e) => setUniverseId(e.target.value)}
- className="bg-port-bg border border-port-border rounded px-3 py-1.5 text-sm text-gray-200 sm:ml-auto"
- >
- <option value="">Select a universe…</option>
- {namedUniverses.map((u) => (
- <option key={u.id} value={u.id}>{u.name}</option>
- ))}
- </select>
- )}
+ {/* The three intake modes. */}
+ <section className="grid gap-4 sm:grid-cols-3">
+ {MODES.map((mode) => {
+ const Icon = mode.icon;
+ const attaches = attachUniverseId && mode.consumesUniverse;
+ return (
+ <button
+ key={mode.id}
+ type="button"
+ onClick={() => go(mode)}
+ disabled={needsUniversePick}
+ className={`text-left bg-port-card border border-port-border rounded-lg p-4 space-y-2 transition-colors ${
+ needsUniversePick
+ ? 'opacity-50 cursor-not-allowed'
+ : 'hover:border-port-accent'
+ }`}
+ >
+ <Icon className="w-6 h-6 text-port-accent" />
+ <h3 className="font-semibold text-gray-100">{mode.title}</h3>
+ <p className="text-sm text-gray-400">{mode.desc}</p>
+ {attaches && (
+ <p className="text-xs text-port-success">Will attach to the selected universe.</p>
+ )}
+ {attachUniverseId && !attaches && (
+ <p className="text-xs text-gray-500">Universe linking for prose drafts is coming in a later phase.</p>
+ )}
+ </button>
+ );
+ })}
+ </section>
</div>
- {needsUniversePick && (
- <p className="text-xs text-port-warning">Pick a universe above to continue, or switch to “Start fresh.”</p>
- )}
- </section>
-
- {/* The three intake modes. */}
- <section className="grid gap-4 sm:grid-cols-3">
- {MODES.map((mode) => {
- const Icon = mode.icon;
- const attaches = attachUniverseId && mode.consumesUniverse;
- return (
- <button
- key={mode.id}
- type="button"
- onClick={() => go(mode)}
- disabled={needsUniversePick}
- className={`text-left bg-port-card border border-port-border rounded-lg p-4 space-y-2 transition-colors ${
- needsUniversePick
- ? 'opacity-50 cursor-not-allowed'
- : 'hover:border-port-accent'
- }`}
- >
- <Icon className="w-6 h-6 text-port-accent" />
- <h3 className="font-semibold text-gray-100">{mode.title}</h3>
- <p className="text-sm text-gray-400">{mode.desc}</p>
- {attaches && (
- <p className="text-xs text-port-success">Will attach to the selected universe.</p>
- )}
- {attachUniverseId && !attaches && (
- <p className="text-xs text-gray-500">Universe linking for prose drafts is coming in a later phase.</p>
- )}
- </button>
- );
- })}
- </section>
+ </div>
</div>
);
}
diff --git a/client/src/pages/StoryBuilder.jsx b/client/src/pages/StoryBuilder.jsx
index d3b7a0a8ff..305669a91b 100644
--- a/client/src/pages/StoryBuilder.jsx
+++ b/client/src/pages/StoryBuilder.jsx
@@ -1,5 +1,6 @@
import { useState, useEffect, useCallback, useId, useMemo, useRef } from 'react';
import { useParams, useNavigate, useSearchParams, useLocation, Link } from 'react-router';
+import PageHeader from '../components/PageHeader';
import PageSkeleton from '../components/ui/PageSkeleton';
import { filterSelectableModels } from '../utils/providers';
import { composeCanonStyledPrompt } from '../lib/composeStyledPrompt';
@@ -251,22 +252,19 @@ function StoryBuilderIndex() {
const intake = useStoryImportIntake(onCreated);
return (
- // Wide two-column shell when the container fits: create form left, "Continue a story" list
- // right (mirrors the POST launcher redesign, #1986). In narrow containers the grid
- // collapses to a single stacked column so mobile is unchanged. The 22rem
- // sidebar track is reserved even with no sessions so the form keeps a
- // comfortable ~48rem width instead of stretching the full shell.
- <div className="@container/page min-w-0 max-w-6xl mx-auto space-y-6">
- <header>
- <h1 className="text-2xl font-bold flex items-center gap-2">
- <Sparkles className="w-6 h-6 text-port-accent" /> Story Builder
- </h1>
- <p className="text-gray-400 mt-1">
- One guided path from idea to video — start from a seed idea or import a finished work, then review and
- lock each stage (aesthetic → plot arc → reader map → characters → issues) before moving on.
- </p>
- </header>
-
+ <div className="flex h-full min-h-0 flex-col">
+ <PageHeader
+ icon={Wand2}
+ title="Story Builder"
+ subtitle="One guided path from idea to video — start from a seed idea or import a finished work, then review and lock each stage (aesthetic → plot arc → reader map → characters → issues) before moving on."
+ />
+ <div className="flex-1 min-h-0 overflow-auto p-4">
+ {/* Wide two-column shell when the container fits: create form left, "Continue a story" list
+ right (mirrors the POST launcher redesign, #1986). In narrow containers the grid
+ collapses to a single stacked column so mobile is unchanged. The 22rem
+ sidebar track is reserved even with no sessions so the form keeps a
+ comfortable ~48rem width instead of stretching the full shell. */}
+ <div className="@container/page min-w-0 max-w-6xl mx-auto">
<div className="grid grid-cols-1 @5xl/page:grid-cols-[minmax(0,1fr)_22rem] gap-6 items-start">
<section className="bg-port-card border border-port-border rounded-lg">
<TabPills
@@ -371,6 +369,8 @@ function StoryBuilderIndex() {
</section>
)}
</div>
+ </div>
+ </div>
</div>
);
}
@@ -1343,7 +1343,13 @@ function StoryBuilderDetail({ storyId, stepParam }) {
</div>
);
}
- if (sessionMissing) return <div className="p-6 text-gray-400">Session not found. <Link to="/story-builder" className="text-port-accent">Back to Story Builder</Link></div>;
+ if (sessionMissing) {
+ return (
+ <div className="h-full overflow-y-auto p-6 text-gray-400">
+ Session not found. <Link to="/story-builder" className="text-port-accent">Back to Story Builder</Link>
+ </div>
+ );
+ }
if (!session || !steps) return (
<div className="h-full overflow-y-auto p-4 md:p-6">
@@ -1352,18 +1358,19 @@ function StoryBuilderDetail({ storyId, stepParam }) {
);
return (
- <div className="story-builder-workspace h-full min-h-0 p-3">
- <div className="max-w-5xl mx-auto w-full min-w-0 min-h-0 h-full flex flex-col">
+ <div className="story-builder-workspace flex h-full min-h-0 flex-col">
+ <PageHeader
+ icon={Wand2}
+ title={session.title}
+ actions={(
+ <Link to="/story-builder" aria-label="All stories" className="inline-flex min-h-[44px] items-center text-xs text-gray-500 hover:text-port-accent">
+ ← All stories
+ </Link>
+ )}
+ />
+ <div className="flex-1 min-h-0 overflow-hidden">
+ <div className="max-w-5xl mx-auto w-full min-w-0 min-h-0 h-full flex flex-col p-3">
{readNotice}
- <header className="mb-3 shrink-0 min-w-0">
- <div className="min-w-0 max-w-full">
- <Link to="/story-builder" className="text-xs text-gray-500 hover:text-port-accent">← All stories</Link>
- <h1 className="text-2xl font-bold flex items-start gap-2 mt-1 min-w-0">
- <Sparkles className="w-6 h-6 text-port-accent shrink-0 mt-1" />
- <span className="min-w-0 [overflow-wrap:anywhere]">{session.title}</span>
- </h1>
- </div>
- </header>
{/* Live runs — own kickoffs and ones adopted after a reload / second tab —
stay visible whichever step is open, with a way back to the step. */}
@@ -1539,6 +1546,7 @@ function StoryBuilderDetail({ storyId, stepParam }) {
</div>
</section>
</div>
+ </div>
</div>
</div>
);
diff --git a/client/src/pages/Universes.jsx b/client/src/pages/Universes.jsx
index 16bf08348a..4842d98d17 100644
--- a/client/src/pages/Universes.jsx
+++ b/client/src/pages/Universes.jsx
@@ -11,6 +11,7 @@
import { useEffect, useMemo, useState, useCallback } from 'react';
import { Link, useNavigate } from 'react-router';
import { Plus, Globe, Trash2, Users, Workflow as WorkflowIcon, Copy, BadgeCheck } from 'lucide-react';
+import PageHeader from '../components/PageHeader';
import toast from '../components/ui/Toast';
import ConfirmButtonPair from '../components/ui/ConfirmButtonPair';
import ImageThumb from '../components/ui/ImageThumb';
@@ -218,25 +219,22 @@ export default function Universes() {
});
return (
- <div>
- <div className="flex items-center justify-between mb-6 flex-wrap gap-3">
- <div className="flex items-center gap-3">
- <Globe className="w-6 h-6 text-port-accent" />
- <h1 className="text-2xl font-bold text-white">Universes</h1>
- </div>
- <Link
- to="/universes/new"
- className="inline-flex items-center gap-2 px-3 py-2 rounded-lg bg-port-accent hover:bg-port-accent/90 text-white text-sm font-medium"
- >
- <Plus size={16} aria-hidden="true" />
- New Universe
- </Link>
- </div>
-
- <p className="text-sm text-gray-400 mb-6">
- A universe holds the shared style, influences, and canon (characters, places, objects) that every
- pipeline series and batch render inherits. Build one here, then link series to it from the Series Pipeline.
- </p>
+ <div className="flex h-full min-h-0 flex-col">
+ <PageHeader
+ icon={Globe}
+ title="Universes"
+ subtitle="A universe holds the shared style, influences, and canon (characters, places, objects) that every pipeline series and batch render inherits. Build one here, then link series to it from the Series Pipeline."
+ actions={(
+ <Link
+ to="/universes/new"
+ className="inline-flex items-center gap-2 px-3 py-2 rounded-lg bg-port-accent hover:bg-port-accent/90 text-white text-sm font-medium"
+ >
+ <Plus size={16} aria-hidden="true" />
+ New Universe
+ </Link>
+ )}
+ />
+ <div className="flex-1 min-h-0 overflow-auto p-4">
{visibleDupes.length > 0 && (
<div className="mb-6 border border-port-warning/40 bg-port-warning/10 rounded-lg p-4 space-y-3">
@@ -363,6 +361,7 @@ export default function Universes() {
onAIMerge={runAIMerge} onUpdateOverride={updateOverride}
/>
)}
+ </div>
</div>
);
}
diff --git a/client/src/pages/VoiceStudio.jsx b/client/src/pages/VoiceStudio.jsx
index cb0c877099..4542bca9fb 100644
--- a/client/src/pages/VoiceStudio.jsx
+++ b/client/src/pages/VoiceStudio.jsx
@@ -1,6 +1,7 @@
import { useCallback, useState } from 'react';
import { Link, useNavigate, useParams, useSearchParams } from 'react-router';
import { AudioLines, Plus, Loader2, ArrowLeft, Check } from 'lucide-react';
+import PageHeader from '../components/PageHeader';
import { usePagedCollection } from '../hooks/usePagedCollection';
import InfiniteScrollFooter from '../components/ui/InfiniteScrollFooter';
import { useSocketResource } from '../hooks/useSocketResource';
@@ -126,12 +127,16 @@ export default function VoiceStudio() {
if (key === 'universeId') next.delete('characterId');
setParams(next);
};
- return <div className="@container space-y-4 min-w-0">
- <header className="flex flex-wrap items-center justify-between gap-3">
- <h1 className="flex items-center gap-2 text-2xl font-semibold"><AudioLines /> Voice Studio</h1>
- <Link to={`/voices/new?${newVoiceParams}`} className={buttonClass}><Plus size={16} /> Create voice</Link>
- </header>
- <p className="text-sm text-gray-400">Create voices once, audition them, and cast characters across your universes and stories.</p>
+ return (
+ <div className="flex h-full min-h-0 flex-col">
+ <PageHeader
+ icon={AudioLines}
+ title="Voice Studio"
+ subtitle="Create voices once, audition them, and cast characters across your universes and stories."
+ actions={<Link to={`/voices/new?${newVoiceParams}`} className={buttonClass}><Plus size={16} /> Create voice</Link>}
+ />
+ <div className="@container min-w-0 flex-1 min-h-0 overflow-auto p-4">
+ <div className="space-y-4">
{engine.error && <p role="alert" className="text-port-error">{engine.error.message} <button onClick={engine.refetch} className="underline">Retry</button></p>}
{library.loading && <p role="status">Loading voice library…</p>}
{status && <section aria-label="Voice engine" className="rounded border border-port-border p-3 flex flex-wrap items-center gap-3">
@@ -190,5 +195,8 @@ export default function VoiceStudio() {
<p className="text-sm text-gray-400">Select a voice to listen and assign, or create a new character voice.</p>}
</section>
</div>
- </div>;
+ </div>
+ </div>
+ </div>
+ );
}
diff --git a/client/src/pages/WritersRoom.jsx b/client/src/pages/WritersRoom.jsx
index abbcb4176f..097ba64f01 100644
--- a/client/src/pages/WritersRoom.jsx
+++ b/client/src/pages/WritersRoom.jsx
@@ -1,6 +1,7 @@
import { useEffect, useState, useCallback } from 'react';
import { useParams, useNavigate, Link } from 'react-router';
import { NotebookPen, PanelLeftOpen, BookOpen, ChevronUp, ChevronDown } from 'lucide-react';
+import PageHeader from '../components/PageHeader';
import LibraryPane from '../components/writers-room/LibraryPane';
import WorkEditor from '../components/writers-room/WorkEditor';
import ExercisePanel from '../components/writers-room/ExercisePanel';
@@ -127,44 +128,48 @@ export default function WritersRoom() {
return (
<div className="flex flex-col h-full">
- <div className="flex items-center gap-2 px-3 py-1.5 border-b border-port-border bg-port-card shrink-0">
- {libraryCollapsed && (
- <button
- onClick={toggleLibrary}
- className="min-h-[44px] min-w-[44px] inline-flex items-center justify-center p-1 text-gray-400 hover:text-white transition-colors"
- title="Show library"
- aria-label="Show library"
- >
- <PanelLeftOpen size={16} />
- </button>
- )}
- <NotebookPen className="w-4 h-4 shrink-0 text-port-accent" />
- <h1 className="text-sm font-semibold text-white">Writers Room</h1>
- <Link
- to="/writers-room/guide"
- className="ml-auto min-h-[44px] min-w-[44px] flex items-center justify-center gap-1 text-xs text-gray-400 hover:text-port-accent transition-colors"
- title="Writing guide: length targets & craft rules"
- aria-label="Writing guide"
- >
- <BookOpen size={14} />
- <span className="hidden sm:inline">Guide</span>
- </Link>
- {activeWork && (
- <button
- type="button"
- onClick={() => {
- if (!headerCollapsed) setLibraryCollapsed(true);
- toggleHeader();
- }}
- aria-expanded={!headerCollapsed}
- aria-label={headerCollapsed ? 'Expand writing header' : 'Collapse writing header'}
- title={headerCollapsed ? 'Expand writing header' : 'Collapse writing header'}
- className="shrink-0 min-h-[44px] min-w-[44px] flex items-center justify-center text-gray-400 hover:text-white"
- >
- {headerCollapsed ? <ChevronDown size={18} /> : <ChevronUp size={18} />}
- </button>
+ <PageHeader
+ icon={NotebookPen}
+ title="Writers Room"
+ actions={(
+ <>
+ {libraryCollapsed && (
+ <button
+ onClick={toggleLibrary}
+ className="min-h-[44px] min-w-[44px] inline-flex items-center justify-center p-1 text-gray-400 hover:text-white transition-colors"
+ title="Show library"
+ aria-label="Show library"
+ >
+ <PanelLeftOpen size={16} />
+ </button>
+ )}
+ <Link
+ to="/writers-room/guide"
+ className="min-h-[44px] min-w-[44px] flex items-center justify-center gap-1 text-xs text-gray-400 hover:text-port-accent transition-colors"
+ title="Writing guide: length targets & craft rules"
+ aria-label="Writing guide"
+ >
+ <BookOpen size={14} />
+ <span className="hidden sm:inline">Guide</span>
+ </Link>
+ {activeWork && (
+ <button
+ type="button"
+ onClick={() => {
+ if (!headerCollapsed) setLibraryCollapsed(true);
+ toggleHeader();
+ }}
+ aria-expanded={!headerCollapsed}
+ aria-label={headerCollapsed ? 'Expand writing header' : 'Collapse writing header'}
+ title={headerCollapsed ? 'Expand writing header' : 'Collapse writing header'}
+ className="shrink-0 min-h-[44px] min-w-[44px] flex items-center justify-center text-gray-400 hover:text-white"
+ >
+ {headerCollapsed ? <ChevronDown size={18} /> : <ChevronUp size={18} />}
+ </button>
+ )}
+ </>
)}
- </div>
+ />
<div
className="flex-1 flex flex-col md:grid min-h-0 transition-[grid-template-columns] duration-200"
diff --git a/client/src/pages/WritersRoomGuide.jsx b/client/src/pages/WritersRoomGuide.jsx
index 4399572e8c..49b82e2735 100644
--- a/client/src/pages/WritersRoomGuide.jsx
+++ b/client/src/pages/WritersRoomGuide.jsx
@@ -1,5 +1,6 @@
import { Link } from 'react-router';
import { NotebookPen, ArrowLeft, Ruler, BookOpen, Lightbulb, Sparkles } from 'lucide-react';
+import PageHeader from '../components/PageHeader';
import {
WRITING_LENGTH_TARGETS,
BOOK_LENGTH_ESTIMATES,
@@ -59,21 +60,22 @@ function PrincipleCard({ group }) {
export default function WritersRoomGuide() {
return (
<div className="flex flex-col h-full">
- <div className="flex items-center gap-3 px-4 py-3 border-b border-port-border bg-port-card shrink-0">
- <Link
- to="/writers-room"
- className="p-1 text-gray-400 hover:text-white transition-colors"
- title="Back to Writers Room"
- aria-label="Back to Writers Room"
- >
- <ArrowLeft size={18} />
- </Link>
- <NotebookPen className="w-5 h-5 text-port-accent" />
- <h1 className="text-xl font-bold text-white">Writers Room Guide</h1>
- <span className="text-xs text-gray-500 hidden md:inline ml-auto">
- Length targets, craft principles, and the analyses we apply to your prose
- </span>
- </div>
+ <PageHeader
+ icon={NotebookPen}
+ title="Writers Room Guide"
+ subtitle="Length targets, craft principles, and the analyses we apply to your prose"
+ className="bg-port-card"
+ actions={(
+ <Link
+ to="/writers-room"
+ className="inline-flex items-center justify-center min-h-[44px] min-w-[44px] p-1 text-gray-400 hover:text-white transition-colors"
+ title="Back to Writers Room"
+ aria-label="Back to Writers Room"
+ >
+ <ArrowLeft size={18} />
+ </Link>
+ )}
+ />
<div className="flex-1 overflow-y-auto px-4 py-5 md:px-6 md:py-6">
<div className="max-w-5xl mx-auto space-y-10">