Skip to content

Fountain import: frontend wiring (menu, Open dialog, Import as Episode, per-episode export) #187

@stultus

Description

@stultus

Part of #184 (Fountain import).

What

Wire the Rust Fountain parser into the frontend and add the user-facing entry points.

Surface area

Tauri commands (Rust → TS bridge)

  • import_fountain_as_film(path: String) -> Result<ScreenplayDocument, String>
  • import_fountain_as_episode(path: String, current_doc: ScreenplayDocument) -> Result<ScreenplayDocument, String> — returns the mutated Series document with the new episode appended, the active episode pointer updated.
  • Both return alongside an import summary (counts of dropped boneyards, absorbed sections, etc.) so the frontend can show a toast.

Native menu

  • File → Import Fountain... — always creates a new untitled Film. Goes through the dirty-state guard (documentStore.confirmIfDirty()).
  • File → Import Fountain as Episode... — only enabled when document.type === \"series\". Appends new episode; switches active episode to it.

Open dialog

  • Existing Open accepts .screenplay. Extend to also accept .fountain and route to import_fountain_as_film based on extension.
  • Same dirty-state guard applies.

Per-episode Fountain export (Series only)

  • Add a "Per episode" toggle to the Export modal, visible only when format = Fountain (and plain text — same logic, smaller win) and project is a Series.
  • When checked, the directory picker replaces the file picker. Output: {NN}-{slug(episode.title)}.fountain for each episode.

Import summary toast

After a successful import, show a small toast: Imported \"Filename.fountain\" — 12 scenes, 3 boneyards dropped. Reuse the UpdateToast styling pattern.

Tasks

  • Two Tauri commands in src-tauri/src/commands/
  • File menu items in src-tauri/src/lib.rs (native menu) — mirroring the existing custom-quit pattern
  • Frontend menu-event handlers in src/routes/+page.svelte
  • Open dialog extension filter update
  • Per-episode export branch in ExportModal.svelte + a per-episode export Tauri command
  • Import summary toast component (or reuse a generic toast)
  • Remove Fountain import from the "Deferred" list in .claude/CLAUDE.md

Out of scope

  • Drag-and-drop a .fountain file onto the window (separate small enhancement)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions