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: split the WorkEditor header into two compact mobile rows so the prose textarea clears the fold (#3568)

[._.]/ Adam Eivy4c1c0ba9db83
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 432a7ee3d0..24f51d36b2 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -192,3 +192,4 @@
- **[issue-3578] Image-to-3D renders no longer stall the progress bar on a stage banner that lands across two chunks.** The shared generate driver split each `data` chunk from the generator on its own, with nothing carried between them — but a child process hands out its output on arbitrary byte boundaries, so a banner like "Baking textures at 2048px" could arrive as two halves, neither of which matched any stage signature. The percent then sat where the previous banner left it until the next one happened to land whole, which on the long sampling phase reads as a hung render. Both lanes now feed their output through the same buffered line reader the rest of the app's subprocess streams use, which stitches the partial line back together and flushes whatever is left when the child exits — so a generator that writes its final "Saved:" line without a trailing newline still has its asset path read. stdout and stderr keep separate buffers, since a shared one would splice a partial line from one stream onto a chunk from the other. Tqdm's carriage-return redraws still surface as individual frames, and the raw output kept for classifying a non-zero exit is unchanged, so an out-of-memory or gated-model failure is still named the same way.
- **[issue-3565] Three Writers Room controls are now big enough to hit on a phone.** The Edit pencil on every Cast/Places/Objects bible row was an 11px icon with no padding around it — an ~11x11px tap target sitting next to the row text, so a thumb aiming for it selected the entry description instead. The snapshot Revert button in the Polish panel was 11px text and a matching icon on a row with no vertical padding of its own (~16px tall), and the World style Clear button in the Storyboard config tab was bare 9px text (~10x22px). All three now clear the 44px floor the rest of the app uses. Each one bleeds into the padding its own row already had rather than adding height on top of it, so the bible list and the snapshot list keep their density and the Clear button stays inside its stack gap instead of overlapping the style dropdown beneath it.
- **[issue-3579] Refusing a 3D model install on unsupported hardware now says why in English, and a new reason code can no longer go label-less.** The image-to-3D registry answers "can this host run that target?" with stable codes like `requires-linux-host` and `cuda-probe-failed`; the 3D page turned those into sentences from a hand-written table of its own, and the install endpoint had no table at all — so asking to install a target this machine can't run streamed back "This host cannot run TRELLIS.2 (CUDA) (requires-linux-host)", handing the user the internal code instead of the one thing they could act on. Both sides now render the same shared map, which lives next to the function that returns the codes and is mirrored to the client the way the catalog type registry already is. A parity test asserts the two copies never drift, and — the reason the drift was worth fixing rather than just re-syncing — it also reads the resolver's source and asserts the labelled set still *equals* the codes it can actually return. The previous arrangement failed silently: the CUDA lane added three codes by hand on each side, and a fourth that someone forgot to mirror would have rendered as the generic "Unsupported on this host" with every test still green.
+- **[issue-3568] The Writers Room prose editor starts above the fold on a phone again.** The work header laid out every control in one wrapping row, so at ~375px the title field, status dropdown, Edit/Read/Review toggle, Save, Snapshot and the Work menu stacked into four or five rows and ate 250-300px of a 667px screen — the textarea you came to write in began below the fold before the keyboard even opened. The header is now two compact rows on a phone: title, Save and the Work menu on the first, and the three secondary controls on a sub-bar of their own beneath it, with the view toggle collapsing to its three icons so that row stays single-line. Nothing moved into the overflow menu — every control is still one tap away — and the desktop layout is byte-for-byte the same single row in the same left-to-right order, because the sub-bar dissolves back into the header row at `sm` and up rather than being a second copy of the controls. Each control on the phone rows now clears the 44px touch floor, and the icon-only view toggles carry their names for screen readers.
diff --git a/client/src/components/writers-room/WorkEditor.jsx b/client/src/components/writers-room/WorkEditor.jsx
index c7627e10c7..2a2adb3813 100644
--- a/client/src/components/writers-room/WorkEditor.jsx
+++ b/client/src/components/writers-room/WorkEditor.jsx
@@ -66,6 +66,14 @@ const ANALYSIS_KIND = { SCRIPT: 'script', CHARACTERS: 'characters', PLACES: 'pla
const DRAWER = { VERSIONS: 'versions', HISTORY: 'history', POLISH: 'polish', VOICE: 'voice' };
const MOBILE_TAB = { WRITING: 'writing', STORYBOARD: 'storyboard' };
+// The three prose surfaces the header toggles between. Declared once so the
+// toggle group stays a map instead of three hand-copied buttons.
+const VIEW_MODES = [
+ { id: 'edit', label: 'Edit', icon: Pencil, title: 'Edit prose (textarea)' },
+ { id: 'read', label: 'Read', icon: BookOpen, title: 'Read view with scene anchors' },
+ { id: 'review', label: 'Review', icon: Columns3, title: 'Synced prose · script · media review' },
+];
+
const ANALYSIS_LABELS = {
[ANALYSIS_KIND.SCRIPT]: 'Adapt',
[ANALYSIS_KIND.CHARACTERS]: 'Characters',
@@ -719,84 +727,40 @@ export default function WorkEditor({ work, onChange, onToggleExercise, exerciseO
return (
<div className="flex flex-col h-full">
- {/* Header — title + status on left, primary actions + overflow on right */}
+ {/*
+ Header — one wrapping row on desktop, two compact rows on phones (#3568).
+ Under `sm` the secondary controls (status, view mode, snapshot) live in
+ their own full-width sub-bar so the first row is just title + Save +
+ Work menu; at `sm+` that wrapper becomes `display: contents` and its
+ children rejoin the single header row. The `sm:order-*` classes restore
+ the original left-to-right desktop sequence (title · status · view mode ·
+ Save · Snapshot · menu) that the DOM regrouping would otherwise shuffle.
+ Every control stays on screen at every width — nothing is hidden behind
+ the menu, so the prose editor clears the fold without losing reach.
+ */}
<div className="flex flex-wrap items-center gap-2 px-4 py-2 border-b border-port-border bg-port-card">
<input
value={title}
onChange={(e) => setTitle(e.target.value)}
onBlur={commitTitle}
onKeyDown={(e) => { if (e.key === 'Enter') e.target.blur(); }}
- className="bg-transparent text-base font-semibold text-white border-none focus:outline-none focus:bg-port-bg/50 px-1 rounded flex-1 min-w-[180px]"
+ className="bg-transparent text-base font-semibold text-white border-none focus:outline-none focus:bg-port-bg/50 px-1 rounded flex-1 min-w-[140px] sm:min-w-[180px] min-h-[44px] sm:min-h-0 order-1 sm:order-1"
aria-label="Work title"
/>
- <select
- value={status}
- onChange={(e) => commitStatus(e.target.value)}
- className="bg-port-bg border border-port-border rounded px-2 py-1 text-[11px] text-gray-300"
- aria-label="Status"
- >
- {Object.entries(STATUS_LABELS).map(([k, l]) => <option key={k} value={k}>{l}</option>)}
- </select>
- {/* Two-state toggle, not a true tablist (no separate panels keyed off
- tab id, no roving tabindex, no arrow-key cycling). aria-pressed is
- the semantically correct primitive for an on/off-style toggle pair. */}
- <div className="flex items-center bg-port-bg border border-port-border rounded p-0.5" role="group" aria-label="View mode">
- <button
- type="button"
- aria-pressed={viewMode === 'edit'}
- onClick={() => setViewMode('edit')}
- className={`flex items-center gap-1 px-2 py-0.5 text-[11px] rounded ${
- viewMode === 'edit' ? 'bg-port-card text-white' : 'text-gray-400 hover:text-gray-200'
- }`}
- title="Edit prose (textarea)"
- >
- <Pencil size={11} /> Edit
- </button>
- <button
- type="button"
- aria-pressed={viewMode === 'read'}
- onClick={() => setViewMode('read')}
- className={`flex items-center gap-1 px-2 py-0.5 text-[11px] rounded ${
- viewMode === 'read' ? 'bg-port-card text-white' : 'text-gray-400 hover:text-gray-200'
- }`}
- title="Read view with scene anchors"
- >
- <BookOpen size={11} /> Read
- </button>
- <button
- type="button"
- aria-pressed={viewMode === 'review'}
- onClick={() => setViewMode('review')}
- className={`flex items-center gap-1 px-2 py-0.5 text-[11px] rounded ${
- viewMode === 'review' ? 'bg-port-card text-white' : 'text-gray-400 hover:text-gray-200'
- }`}
- title="Synced prose · script · media review"
- >
- <Columns3 size={11} /> Review
- </button>
- </div>
<button
onClick={handleSave}
disabled={!dirty || saving}
- className={`flex items-center gap-1 px-3 py-1 text-xs rounded ${
+ className={`flex items-center gap-1 px-3 py-1 min-h-[44px] sm:min-h-0 text-xs rounded order-2 sm:order-4 ${
dirty && !saving ? 'bg-port-accent text-white hover:bg-port-accent/80' : 'bg-port-bg text-gray-500'
}`}
title={dirty ? 'Save (Ctrl/Cmd+S)' : 'Up to date'}
>
<Save size={12} /> {saving ? 'Saving…' : dirty ? 'Save' : 'Saved'}
</button>
- <button
- onClick={handleSnapshot}
- disabled={dirty}
- className="flex items-center gap-1 px-3 py-1 text-xs rounded bg-port-bg border border-port-border text-gray-300 hover:text-white disabled:text-gray-600 disabled:cursor-not-allowed"
- title="Snapshot the active draft as a new version"
- >
- <GitCommit size={12} /> Snapshot
- </button>
- <div className="relative" ref={overflowRef}>
+ <div className="relative order-3 sm:order-6" ref={overflowRef}>
<button
onClick={() => setOverflowOpen((v) => !v)}
- className="flex items-center justify-center px-2 py-1 text-xs rounded bg-port-bg border border-port-border text-gray-300 hover:text-white"
+ className="flex items-center justify-center px-3 sm:px-2 py-1 min-h-[44px] sm:min-h-0 text-xs rounded bg-port-bg border border-port-border text-gray-300 hover:text-white"
aria-label="Work menu"
aria-expanded={overflowOpen}
title="Work menu"
@@ -845,6 +809,49 @@ export default function WorkEditor({ work, onChange, onToggleExercise, exerciseO
</div>
)}
</div>
+ {/* Secondary controls. `w-full` forces its own compact row under `sm`;
+ `sm:contents` dissolves the wrapper so these are direct flex items
+ of the header row again on desktop. */}
+ <div className="order-4 w-full flex items-center gap-2 sm:contents" data-testid="work-header-secondary">
+ <select
+ value={status}
+ onChange={(e) => commitStatus(e.target.value)}
+ className="bg-port-bg border border-port-border rounded px-2 py-1 min-h-[44px] sm:min-h-0 text-[11px] text-gray-300 sm:order-2"
+ aria-label="Status"
+ >
+ {Object.entries(STATUS_LABELS).map(([k, l]) => <option key={k} value={k}>{l}</option>)}
+ </select>
+ {/* Not a true tablist (no separate panels keyed off tab id, no roving
+ tabindex, no arrow-key cycling). aria-pressed is the semantically
+ correct primitive for a toggle group. The text labels collapse to
+ icon-only under `sm` to keep this row single-line at ~375px, so
+ each button carries an explicit aria-label. */}
+ <div className="flex items-center bg-port-bg border border-port-border rounded p-0.5 sm:order-3" role="group" aria-label="View mode">
+ {VIEW_MODES.map(({ id, label, icon: Icon, title: viewTitle }) => (
+ <button
+ key={id}
+ type="button"
+ aria-pressed={viewMode === id}
+ aria-label={label}
+ onClick={() => setViewMode(id)}
+ className={`flex items-center gap-1 px-3 sm:px-2 py-2 sm:py-0.5 min-h-[40px] sm:min-h-0 text-[11px] rounded ${
+ viewMode === id ? 'bg-port-card text-white' : 'text-gray-400 hover:text-gray-200'
+ }`}
+ title={viewTitle}
+ >
+ <Icon size={11} /> <span className="hidden sm:inline">{label}</span>
+ </button>
+ ))}
+ </div>
+ <button
+ onClick={handleSnapshot}
+ disabled={dirty}
+ className="flex items-center gap-1 px-3 py-1 min-h-[44px] sm:min-h-0 text-xs rounded bg-port-bg border border-port-border text-gray-300 hover:text-white disabled:text-gray-600 disabled:cursor-not-allowed sm:order-5"
+ title="Snapshot the active draft as a new version"
+ >
+ <GitCommit size={12} /> Snapshot
+ </button>
+ </div>
</div>
{runningKind && (
diff --git a/client/src/components/writers-room/WorkEditor.test.jsx b/client/src/components/writers-room/WorkEditor.test.jsx
new file mode 100644
index 0000000000..32c8ee0739
--- /dev/null
+++ b/client/src/components/writers-room/WorkEditor.test.jsx
@@ -0,0 +1,156 @@
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { act, render, screen, within } from '@testing-library/react';
+import { fireEvent } from '@testing-library/dom';
+import { MemoryRouter } from 'react-router';
+
+// Header layout contract for #3568: on a ~375px phone the WorkEditor header
+// used to wrap into 4-5 rows and push the prose textarea below the fold. The
+// fix regroups the secondary controls (status, view mode, snapshot) into one
+// full-width sub-bar under `sm` while `sm:contents` dissolves that wrapper on
+// desktop so the single-row layout — and its left-to-right order — is
+// unchanged. jsdom doesn't apply Tailwind, so these assert the class contract
+// that drives the layout plus the behaviour that must survive the regroup.
+
+vi.mock('./StoryboardPanel', () => ({
+ default: function StoryboardPanelStub() { return <div data-testid="storyboard-panel" />; },
+ STORYBOARD_TAB: {
+ CHARACTERS: 'characters', WORLD: 'world', OBJECTS: 'objects',
+ SCENES: 'scenes', BOARDS: 'boards', CONFIG: 'config',
+ },
+ STORYBOARD_TAB_VALUES: ['characters', 'world', 'objects', 'scenes', 'boards', 'config'],
+}));
+
+// Socket.IO auto-connects on import (useImageGenQueue / LiveRenderPanel).
+vi.mock('../../services/socket', () => ({
+ default: { on: vi.fn(), off: vi.fn(), emit: vi.fn(), connected: false },
+}));
+
+vi.mock('../../services/apiWritersRoom', async (importOriginal) => ({
+ ...(await importOriginal()),
+ listWritersRoomCharacters: vi.fn(async () => []),
+ listWritersRoomPlaces: vi.fn(async () => []),
+ listWritersRoomObjects: vi.fn(async () => []),
+}));
+
+import WorkEditor from './WorkEditor';
+
+const work = {
+ id: 'wr-work-1',
+ title: 'Example Work',
+ status: 'drafting',
+ kind: 'novel',
+ activeDraftBody: 'The hero wakes.',
+ activeDraftVersionId: 'wr-draft-1',
+ drafts: [{ id: 'wr-draft-1', label: 'v1', wordCount: 3 }],
+};
+
+async function renderEditor() {
+ const view = render(
+ <MemoryRouter>
+ <WorkEditor work={work} onChange={() => {}} />
+ </MemoryRouter>
+ );
+ await act(async () => {});
+ return view;
+}
+
+// The header controls, in the order they must read left-to-right on desktop.
+function headerControls() {
+ const title = screen.getByLabelText('Work title');
+ return {
+ header: title.parentElement,
+ title,
+ status: screen.getByLabelText('Status'),
+ viewGroup: screen.getByRole('group', { name: 'View mode' }),
+ save: screen.getByRole('button', { name: /^Sav/ }),
+ snapshot: screen.getByRole('button', { name: 'Snapshot' }),
+ menu: screen.getByLabelText('Work menu').closest('div'),
+ };
+}
+
+function orderOf(el) {
+ const match = /(?:^|\s)sm:order-(\d+)(?:\s|$)/.exec(el.className);
+ return match ? Number(match[1]) : null;
+}
+
+beforeEach(() => {
+ vi.clearAllMocks();
+});
+
+describe('WorkEditor header layout (#3568)', () => {
+ it('keeps the first header row to title + Save + Work menu on mobile', async () => {
+ await renderEditor();
+ const { header, title, save, menu } = headerControls();
+ const secondary = screen.getByTestId('work-header-secondary');
+
+ // Four direct children: three first-row controls plus the sub-bar.
+ expect([...header.children]).toEqual([title, save, menu, secondary]);
+ // The sub-bar takes a full row of its own under `sm`…
+ expect(secondary.className).toContain('w-full');
+ // …and dissolves into the header row at `sm+`.
+ expect(secondary.className).toContain('sm:contents');
+ });
+
+ it('parks status, view mode and snapshot in the mobile sub-bar', async () => {
+ await renderEditor();
+ const { status, viewGroup, snapshot } = headerControls();
+ const secondary = screen.getByTestId('work-header-secondary');
+
+ for (const el of [status, viewGroup, snapshot]) {
+ expect(secondary.contains(el)).toBe(true);
+ }
+ });
+
+ it('restores the original left-to-right control order on desktop', async () => {
+ await renderEditor();
+ const { title, status, viewGroup, save, snapshot, menu } = headerControls();
+
+ const expected = [title, status, viewGroup, save, snapshot, menu];
+ expect(expected.map(orderOf)).toEqual([1, 2, 3, 4, 5, 6]);
+ });
+
+ it('renders every control exactly once — nothing is duplicated per breakpoint', async () => {
+ await renderEditor();
+ expect(screen.getAllByLabelText('Status')).toHaveLength(1);
+ expect(screen.getAllByLabelText('Work menu')).toHaveLength(1);
+ expect(screen.getAllByRole('button', { name: 'Snapshot' })).toHaveLength(1);
+ expect(screen.getAllByRole('group', { name: 'View mode' })).toHaveLength(1);
+ });
+
+ it('keeps view-mode buttons named when their labels collapse to icons under sm', async () => {
+ await renderEditor();
+ const { viewGroup } = headerControls();
+
+ for (const name of ['Edit', 'Read', 'Review']) {
+ const button = within(viewGroup).getByRole('button', { name });
+ // The visible text is hidden under `sm`, so the name comes from aria-label.
+ expect(button).toHaveAttribute('aria-label', name);
+ expect(within(button).getByText(name).className).toContain('hidden sm:inline');
+ }
+ });
+
+ it('gives the mobile-visible header controls a 44px touch target', async () => {
+ await renderEditor();
+ const { title, status, save, snapshot } = headerControls();
+ const menuButton = screen.getByLabelText('Work menu');
+
+ for (const el of [title, status, save, snapshot, menuButton]) {
+ expect(el.className).toContain('min-h-[44px]');
+ expect(el.className).toContain('sm:min-h-0');
+ }
+ });
+
+ it('still switches view mode from the regrouped toggle', async () => {
+ const { container } = await renderEditor();
+ const { viewGroup } = headerControls();
+ expect(container.querySelector('textarea')).toBeTruthy();
+
+ await act(async () => {
+ fireEvent.click(within(viewGroup).getByRole('button', { name: 'Read' }));
+ });
+
+ expect(within(viewGroup).getByRole('button', { name: 'Read' })).toHaveAttribute('aria-pressed', 'true');
+ expect(within(viewGroup).getByRole('button', { name: 'Edit' })).toHaveAttribute('aria-pressed', 'false');
+ expect(container.querySelector('textarea')).toBeNull();
+ });
+});