Skip to content

feat: start fresh, blank codeplug #102

Description

@pskillen

Problem

Import is currently the only way to create a new codeplug project. Operators who want to design a layout from scratch — the equivalent of File → New — have no entry point on the landing page.

The README and AGENTS.md already describe "import or start a blank project" as a core workflow, but Home (/) only offers Import codeplug and opening existing projects. newProject() and emptyCodeplug() already exist in the model layer; the gap is store action + UI.

Deferred from #31 (closed); still tracked in codeplug-project-outstanding.md.

Intended outcome

Add a Start fresh (or similar) control on Home that:

  1. Creates a new CodeplugProject with an empty codeplug (emptyCodeplug()).
  2. Sets it as the active project and persists to localStorage.
  3. Navigates the operator to the existing project metadata edit screen at /summary/edit (today titled Edit project — name, description, author, target radios, notes; shipped in #60).

After save, behaviour matches import: return to Summary (/summary) with an empty codeplug ready for CRUD.

Home (/)

  • Prominent button alongside import — e.g. Start fresh or New codeplug (copy TBD; avoid "project" in user-facing label where possible per codeplug-project docs).
  • Update intro copy: today it implies OpenGD77 import is the only path ("Import an OpenGD77 CPS export to get started"); mention both import and start-fresh.
  • When projects already exist: same button under a section heading (mirror "Import another codeplug").

Default name

  • Seed a placeholder project name on create (e.g. "Untitled codeplug" or "New codeplug") — operator renames on the edit screen.
  • Confirm no collision with existing project names if uniqueness is enforced later; v1 can allow duplicates like import does today.

Edit screen (/summary/edit)

  • Reuse existing ProjectEdit form — no new route required for v1.
  • Optional polish (same PR or follow-up): when arriving from start-fresh, Back / Cancel could go to Summary rather than assuming prior context; focus name field on mount.

Store

Add e.g. createBlankProject(name?: string) to useProjects():

  • newProject(name ?? defaultBlankName) → append to projects, set activeProjectId, persist.
  • Mirror importNewProject side effects (clear persistence error, dispatch reducer action).

No import result or Codeplug.meta provenance fields required for a blank create.

Affected

  • src/state/codeplugStore.tsx — new action + reducer case
  • src/routes/Home.tsx — button + copy
  • src/models/codeplugProject.ts — optional DEFAULT_BLANK_PROJECT_NAME constant
  • src/routes/project/edit.tsx — optional start-fresh UX polish
  • Tests: store action, Home button navigates to edit, persistence round-trip
  • docs/features/codeplug-project/ — mark "New empty project" shipped in README + outstanding

Notes / dependencies

Out of scope

  • Duplicate project.
  • Native YAML save/load (#10).
  • Wizard / multi-step onboarding beyond the existing edit form.
  • Confirm dialog when starting fresh would discard unsaved work on another tab (no multi-tab sync today).

Manual verify

  1. Home with no projects → Start fresh → lands on Edit project with placeholder name → save → Summary shows 0 channels/zones.
  2. Home with existing projects → Start fresh → new row on Home after returning; active project switches.
  3. Hard refresh → blank project + metadata persist.
  4. Import path unchanged.

Workflow note

Branch from origin/main, atomic conventional commits (store action → Home UI → tests → docs), PR linking Closes #<n>.

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