# Content Tab (v2) ### Route: `/initiatives/$id` (Content tab) ### Source: `packages/web/src/components/editor/ContentTab.tsx`, `packages/web/src/components/editor/` --- ## v1 -> v2 Changes | Aspect | v1 | v2 | |--------|----|----| | Breadcrumbs | None | `Root > Parent > Current` row above title, clickable | | Deep breadcrumbs | N/A | Ellipsis collapse with dropdown: `Root > [...] > Parent > Current` | | Save indicator | Bare "Saving..." text, top-right, no success/fail states | `` component: spinner, checkmark (fade), error + retry | | Empty root page | Blank editor, no guidance | Tiptap placeholder: "Start writing... use / for commands" | | Root page creation | Only via tree context menu hover `[+]` on nodes | Additional `[+]` button in sidebar header for root-level pages | | Sidebar width | 192px (`w-48`) | 240px (`w-60`) — accommodates deep nesting + truncation | | Page tree search | None | Collapsible filter input in sidebar header | | Drag-and-drop | None | Reorder + re-parent via dnd-kit | | Keyboard nav (tree) | None | Arrow keys, Enter, Home/End | | Refine panel layout | Above editor (banner) | Right column (360px) at >= 1280px viewport | | Refine panel detail | Minimal (spinner + text) | Full state machine: idle, running (live output), questions, proposals, crashed | | Read-only lockout | None | Visual indicator when agent is actively refining | | Word count | None | Bottom-right of editor area | | Slash command menu | Functional but not documented | Wireframed floating popover with all command options | --- ## Default State (with content) ``` +=================================================================================+ | Pages [+] | Root > Architecture > Current Page | | --------------------------+ [✓] Saved | | ├── Architecture | ----------------------------------------------------| | │ ├── Overview | | | │ └── Decisions | # Authentication Architecture | | ├── Requirements | | | └── API Design | This document outlines the OAuth 2.0 | | | implementation strategy for... | | | | | | ~1,240 words · 5m | | 240px | editor area (flex-1) | | | | +=================================================================================+ ``` - `[+]` in sidebar header creates a new root-level child page - Breadcrumb segments are clickable links that call `onNavigate(pageId)` - `[✓] Saved` indicator fades after 2s via CSS opacity transition - Tree nodes still show hover `[+]` for nested child creation (unchanged from v1) - Word count + reading time displayed bottom-right of editor, `text-xs text-muted-foreground` --- ## Empty Root Page (placeholder) ``` +=================================================================================+ | Pages [+] | Root | | --------------------------+ | | (empty tree) | ----------------------------------------------------| | | | | | My Initiative Name | | | ^^^^^^^^^^^^^^^^^^^^^^ | | | 3xl bold title input | | | | | | Start writing... use / for commands | | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | muted placeholder text (text-muted-foreground) | | | | | | | | 240px | editor area (flex-1) | | | | +=================================================================================+ ``` - Placeholder uses `@tiptap/extension-placeholder` with `emptyEditorClass` - Placeholder text disappears on focus/first keystroke - Root page title maps to `initiativeName` (edits update initiative, not page) ### Slash Command Menu Preview When user types `/` at the start of a line (or after a space), the command menu appears as a floating popover anchored to the cursor position: ``` | | | /___ | | +--------------------------------------+ | | | [H1] Heading 1 | <- highlighted | | [H2] Heading 2 | | | [H3] Heading 3 | | | [¶] Bullet List | | | [#] Numbered List | | | ["] Blockquote | | | [—] Divider | | | [<>] Code Block | | | [+] Subpage | <- creates child + inserts link | +--------------------------------------+ | | surface: popover, shadow-md, max-h-64 scroll | ``` - Appears on `/` keystroke; filters as user types (e.g., `/head` shows only headings) - `Arrow Up` / `Arrow Down` to navigate; `Enter` to select; `Esc` to dismiss - Each item: icon (16px, `text-muted-foreground`) + label (`text-sm`) - Popover: `bg-popover border border-border rounded-md shadow-md` - Max height: `max-h-64 overflow-y-auto` with scroll - Highlighted item: `bg-accent text-accent-foreground` --- ## Save Indicator States Three-state component positioned top-right of editor area, inline with breadcrumb row. ### Saving (spinner) ``` Root > Architecture > Current Page [spinner] Saving... ``` - `Loader2` icon with `animate-spin`, `text-muted-foreground` - Shown while `isSaving` or `updateInitiativeMutation.isPending` ### Saved (checkmark, fading) ``` Root > Architecture > Current Page [✓] Saved ``` - Green checkmark icon, `text-green-500` - Fades to `opacity-0` after 2s via `transition-opacity duration-1000` - Resets to full opacity on next save cycle ### Failed (error with retry) ``` Root > Architecture > Current Page [!] Failed [retry] ``` - `AlertCircle` icon, `text-destructive` - `[retry]` is a ghost button that triggers manual save flush - Persists until retry succeeds or new edit triggers auto-save --- ## With Refine Panel Open (3-column layout) ``` +=================================================================================+ | Pages [+] | Root > Current Page [✓] Saved | Refine with Agent | | ---------------+ | ----------------------| | ├── Arch | # Auth Architecture | [spinner] Architect | | │ ├── Ovw | | is refining... | | │ └── Dec | This document outlines the | | | ├── Req | OAuth 2.0 implementation... | (see panel detail | | └── API | | below) | | | | | | 240px | editor (flex-1) | 360px | | | | | +=================================================================================+ ``` - Refine panel sits above editor in v1 source (not beside it) - v2 proposal: move to right column when viewport >= 1280px - Below 1280px, refine panel stays above editor (current v1 behavior) - Panel width: **360px** fixed (`w-[360px]`), editor remains `flex-1` - **Save indicator placement**: in the 3-column layout, the save indicator stays inline with the breadcrumb row, right-aligned within the editor column (middle column). It does NOT extend into the refine panel column. The breadcrumb row is `flex justify-between` within the editor column only. --- ## Refine Panel — Internal Layout The refine panel is a right-side column with its own state machine. The wireframe must show all states, since this is where the agent-human interaction happens. ### State: Idle (no active agent) ``` +-----------------------------------+ | Refine with Agent | | ---------------------------------| | | | [sparkle icon] | | An agent will review all pages | | and suggest improvements. | | | | What should it focus on? | | +-------------------------------+| | | (optional instruction) || | +-------------------------------+| | | | [ Start Refine ] | | | +-----------------------------------+ ``` - Panel header: `text-sm font-semibold`, top-left - CTA button: `