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

feat: auto-collapse Writers Room header + library when opening a work

Adam Eivy3f7624e30d05
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index e0d5cd1311..817699cef5 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -16,6 +16,8 @@ TBD
- **Universes table** — each row now shows a 48×48 thumbnail of the latest image from the universe's auto-managed media collection (the `Universe: <name>` bucket linked by `collection.universeId`). Rows without media fall back to a Globe placeholder; a broken file ref also degrades to the placeholder via `<img onError>`. Applies to both the desktop table and the mobile card layout.
+- **Writers Room auto-collapses the header + library when you open a work.** Tapping a library item now collapses both the page header and the library so the editor gets the full screen — most useful on mobile, where the library is an inline block stacked above the editor. The header shrinks to a slim bar that hosts the "show library" control (reachable on mobile, where there was previously no expand affordance), and the library always re-appears whenever no work is selected so you're never stranded.
+
## Fixed
- **Tabbed sub-nav strips no longer drift vertically on mobile.** The horizontally-scrolling sub-nav tabs (Media Gen and every other page that uses the shared `TabPills` primitive) could be dragged diagonally/vertically on iOS, producing an uneven, wonky scroll. Both `TabPills` scroll containers now set `touch-action: pan-x` so touch gestures pan the strip horizontally while vertical drags pass through to normal page scrolling.
diff --git a/client/src/pages/WritersRoom.jsx b/client/src/pages/WritersRoom.jsx
index eb80b4be49..159f3624d4 100644
--- a/client/src/pages/WritersRoom.jsx
+++ b/client/src/pages/WritersRoom.jsx
@@ -21,8 +21,11 @@ export default function WritersRoom() {
const [activeWork, setActiveWork] = useState(null);
const [loadingWork, setLoadingWork] = useState(false);
const [showExercise, setShowExercise] = useState(false);
- // Library collapsed state — desktop only; mobile keeps the library inline
- // because there's no editor-vs-library tradeoff to make on a small screen.
+ // Header + library collapse state. Opening a work auto-collapses both (see
+ // selectWork) so the editor gets maximum room — this now applies on mobile
+ // too, where the library is an inline block stacked above the editor. The
+ // full header shrinks to a slim bar that hosts the "show library" control.
+ // Persisted so a manual collapse survives reloads.
const [libraryCollapsed, setLibraryCollapsed] = useLocalStorageBool(LIBRARY_COLLAPSED_KEY, false);
const toggleLibrary = useCallback(() => {
setLibraryCollapsed((prev) => !prev);
@@ -69,9 +72,20 @@ export default function WritersRoom() {
navigate('/writers-room');
return;
}
+ // Tapping a work auto-collapses the header + library so the editor gets the
+ // full screen. The slim header's button re-expands when the user wants to
+ // pick another work.
+ setLibraryCollapsed(true);
navigate(`/writers-room/works/${id}`);
};
+ // Whenever no work is open (initial load, after deselect, or after the active
+ // work is deleted) show the library — never strand the user on a hidden
+ // library with nothing to edit.
+ useEffect(() => {
+ if (!workId) setLibraryCollapsed(false);
+ }, [workId, setLibraryCollapsed]);
+
const handleWorkChange = (updated) => {
// Caller (WorkEditor) hands us the freshest manifest + activeDraftBody —
// the server-side endpoints (PUT draft, POST snapshot, PATCH version,
@@ -107,34 +121,42 @@ export default function WritersRoom() {
// Inline gridTemplateColumns is a no-op while the container is `display: flex`
// (mobile) and takes effect once `md:grid` flips display at the breakpoint.
- // Collapsed track is 0px (not a thin rail) — matches CoS pattern where a
- // floating expand button stands in for the rail.
+ // Collapsed track is 0px (not a thin rail) — the slim header's "show library"
+ // button stands in for the rail.
const libraryTrack = libraryCollapsed ? '0px' : '260px';
const exerciseSuffix = showExercise ? ' 320px' : '';
const desktopGridCols = `${libraryTrack} minmax(0, 1fr)${exerciseSuffix}`;
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">
- <NotebookPen className="w-5 h-5 text-port-accent" />
- <h1 className="text-xl font-bold text-white">Writers Room</h1>
- <span className="text-xs text-gray-500 hidden md:inline ml-auto">Folders, works, drafts, storyboard, and write-for-10 sprints</span>
- </div>
-
- <div
- className="relative flex-1 flex flex-col md:grid min-h-0 transition-[grid-template-columns] duration-200"
- style={{ gridTemplateColumns: desktopGridCols }}
- >
- {libraryCollapsed && (
+ {libraryCollapsed ? (
+ // Slim header while editing — frees vertical room and hosts the "show
+ // library" control. This replaces the old desktop-only floating expand
+ // button so it's reachable on mobile, where there's no side rail.
+ <div className="flex items-center gap-2 px-3 py-1.5 border-b border-port-border bg-port-card">
<button
onClick={toggleLibrary}
- className="hidden md:flex absolute left-0 top-2 z-20 p-1.5 text-gray-500 hover:text-white transition-colors rounded-r-md hover:bg-port-card bg-port-card/60 border border-l-0 border-port-border"
+ className="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 text-port-accent" />
+ <span className="text-sm font-semibold text-white">Writers Room</span>
+ </div>
+ ) : (
+ <div className="flex items-center gap-3 px-4 py-3 border-b border-port-border bg-port-card">
+ <NotebookPen className="w-5 h-5 text-port-accent" />
+ <h1 className="text-xl font-bold text-white">Writers Room</h1>
+ <span className="text-xs text-gray-500 hidden md:inline ml-auto">Folders, works, drafts, storyboard, and write-for-10 sprints</span>
+ </div>
+ )}
+
+ <div
+ className="flex-1 flex flex-col md:grid min-h-0 transition-[grid-template-columns] duration-200"
+ style={{ gridTemplateColumns: desktopGridCols }}
+ >
{libraryCollapsed ? (
<div className="hidden md:block overflow-hidden min-w-0" />
) : (