Skip to content

ui(series): IDE-style explorer — multiple expanded episodes, folder-and-file mental model #156

@stultus

Description

@stultus

Where: `src/lib/components/SeriesEpisodeList.svelte` (with knock-on changes in `SceneNavigator.svelte`)

Goal

Treat the sidebar as a code-IDE explorer. Each episode is a folder, each scene is a file. Any combination of episodes can be expanded at the same time, independent of which episode is currently active in the editor.

This is a meaningful UX upgrade over the current single-expansion behavior, especially for series writers who want to glance across multiple episodes' outlines while editing one.

Current behavior (problem)

Looking at `SeriesEpisodeList.svelte`:

```svelte
{#if isOpen && isActive}

{/if} \`\`\`

Scene list renders only when the episode is both expanded AND the active one. Switching activation collapses the previously-active episode's scene tree. Disclosure state is local-only and tied to the active selection.

Target behavior

  1. Independent expansion state per episode. Click the disclosure chevron toggles only that episode's open/closed flag. No coupling to activation.

  2. Activation and expansion are different actions.

    • Click the episode title → activate (open that episode's content in the editor; same as today).
    • Click the chevron (or the folder icon) → toggle expansion only. Active episode unchanged.
    • Activating an episode for the first time auto-expands it (writer expects to see the scenes of where they are). Subsequent manual collapse is honored — don't force-reopen on every activation.
  3. Expanded but inactive episode shows its scene list, read-only-ish. Each expanded episode renders its own scene rows. Clicking a scene in episode X switches active to X then scrolls the editor to that scene — same pattern as VSCode opening a file from another folder.

  4. Persist expansion state per project. `localStorage` keyed by `:expanded-episodes` so the explorer remembers what was open across sessions (mirrors VSCode's `.vscode/settings.json` explorer state).

  5. Folder / file visual metaphor.

    • Episode row: chevron (collapsed → right, expanded → down) + soft folder glyph (or just the existing zero-padded number badge from ui(series): episode number badge — match EpisodeCardsView's zero-padded chip #145) + title.
    • Scene row: small page/file glyph (or the time-of-day stripe — already exists) + scene number + heading. Indented one level under the parent episode.
    • When an episode is expanded but inactive, its scenes render at slightly muted weight so the active episode's tree remains the primary focus.

Implementation considerations

  • SceneNavigator currently reads `documentStore.activeContent`. To render scene lists for non-active episodes, either:

    • a. Refactor SceneNavigator to accept `content` + `settings` + `onSceneClick` as props, defaulting to the active episode when none provided. Then SeriesEpisodeList can render one SceneNavigator per expanded episode with the correct prop bindings.
    • b. Inline a slimmer scene-row render directly inside SeriesEpisodeList for non-active episodes (cheaper but duplicates the styling).

    Option (a) is cleaner long-term. Touches `SceneNavigator.svelte`, `SeriesEpisodeList.svelte`, plus a small contract for the scene-click callback that switches active episode + scrolls.

  • Active scene highlight stays in the active episode only. Other expanded trees show no active row (the cursor isn't in them). This keeps the "where am I right now" answer single-valued.

  • Drag-to-reorder scenes stays within an episode boundary; cross-episode drag is a separate, larger feature. (See out-of-scope below.)

  • Performance: for a 12-episode series with all expanded, that's 12 × N scenes rendered. The recent perf work (perf: SceneNavigator re-walks full document on every keystroke #98) memoized scene parsing on `contentVersionDebounced`, so per-episode cost is fine. Each expanded episode's scene list re-derives only when its own content changes (not on every keystroke globally).

Out of scope (follow-ups)

Why this matters

Series writers often hold the shape of two or three episodes in their head simultaneously — Ep 2's reveal sets up Ep 4's confrontation; Ep 3's runner pays off in Ep 5. The current sidebar makes that mental cross-reference one-step-too-many: collapse the current episode's scenes to peek at another. With multi-expand, the explorer becomes a real outline tool — what writers actually need from a series sidebar.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestui/uxUI/UX or design issue

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions