Skip to content

feat(editor): New Track dialog — add any track, including from scratch - #315

Merged
ChrisBeWithYou merged 2 commits into
mainfrom
feat/new-track-modal
Jul 19, 2026
Merged

feat(editor): New Track dialog — add any track, including from scratch#315
ChrisBeWithYou merged 2 commits into
mainfrom
feat/new-track-modal

Conversation

@ChrisBeWithYou

@ChrisBeWithYou ChrisBeWithYou commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Why

From Discord (Kisscool → Christian, 07-18):

Kisscool: Is it possible to add a track without importing a gp file? Can't find a way to do it in the interface … like an instrument, a MIDI instrument track.
Christian: it's on my to do list, but I don't think it exists yet … I'll knock it out today

It mostly didn't exist: the three toolbar buttons (+ Drums / + Keys / + Guitar/Bass) were all import-from-file flows; the only blank start was a "Start Empty" button buried inside the Add-Keys modal. Christian's design direction: one "New Track" button with a modal asking what kind of track (audio or MIDI/transcription), following the Logic Pro design language.

What

One entry, three doors, same dialog — a + Track toolbar button (replacing the trio), a at the top of the Tracks column (the DAW spot: above the track headers), and Track ▸ New Track….

The dialog (New-Tracks idiom — type tiles up top, details below, Cancel/Create bottom-right):

  • Audio — choose files; each becomes a studio track via the existing stem-manager import path (/import-stems), with the manager opened alongside so the tracks land somewhere visible.
  • MIDI / Transcription — instrument chips (Lead / Rhythm / Bass / Keys / Drums) × source (Start empty / Import from a file). From-file routes to the surviving per-kind modals; empty routes to:
    • editorAddEmptyFretted(role)new: generalizes the empty-Keys plumbing into a shared _addEmptyArrangement body. Unique kind-prefixed names ("Lead 2", never a rename — kind inference is name-driven), Bass seeds 4 strings, registered via /add-arrangement, adopted as the active part.
    • editorAddEmptyDrums()new: the create-flow blank drum_tab shape ({version, name, kit:[], hits:[]}), client-state until save like the import path. Refuses a second drum tab with an inline dialog note steering to import-replace.
  • The Create fork is a pure planner (_newTrackPlanPure) — table-tested with no DOM. The sloppak-only gate the three buttons carried is preserved.

Seams handled: the injected 🥁 Edit Drums button re-anchors beside + Track (its old anchor was the removed + Drums); the Tracks-column dispatches through the window surface to avoid a track-session → new-track → stem-tracks → track-session import cycle; User Guide's §1/§5 updated ("Adding a track" flow).

Tests

tests/new_track.test.mjs (all fail on main): planner routing + blocked states (no session / archive format / second drum tab / junk), unique naming, editorAddEmptyFretted register-append-switch with a stubbed backend + error path leaving state untouched, editorAddEmptyDrums shape/refusal/format gate.

npm test 210/210 · npm run lint 0 errors.

Runtime verification (real host + Playwright)

Old trio gone · + Track visible on a sloppak session · Edit Drums re-anchored · dialog defaults to Transcription/Lead/empty · empty Bass created, named, and active (['Lead','Bass']) · empty Drums created once, second attempt blocked inline · Keys-from-file lands in the Add-Keys modal · Audio opens the stem manager · the Tracks-column opens the same dialog.

🤖 Generated with Claude Code

https://claude.ai/code/session_01929LgKdJMyPGLf8N1WpEVW

Summary by CodeRabbit

  • New Features

    • Added a unified + Track / New Track workflow for creating Audio, MIDI, and transcription tracks.
    • Supports starting tracks empty or importing from Guitar Pro, MIDI, and MusicXML files.
    • Added instrument selection for Lead, Rhythm, Bass, Keys, and Drums.
    • Added empty-track creation for Keys, fretted instruments, and Drums.
    • Added access through the toolbar, Tracks panel, and Track menu.
  • Documentation

    • Updated the user guide and changelog with the new track-creation workflow.

Tester ask (Kisscool): "Is it possible to add a track without importing
a gp file?" It wasn't, except for a blank-Keys button buried inside the
Add-Keys modal. Christian's design call: one New Track entry, DAW-idiom
dialog (type tiles up top, details below, Create bottom-right).

- The three toolbar buttons (+ Drums / + Keys / + Guitar-Bass)
  consolidate into a single "+ Track" — toolbar, a + atop the Tracks
  column (dispatched through the window surface to avoid the
  track-session -> new-track -> stem-tracks import cycle), and
  Track > New Track…. All open the same dialog.
- Type tiles: Audio (files become studio tracks via the stem manager's
  import path, manager opened alongside) vs MIDI/Transcription
  (Lead / Rhythm / Bass / Keys / Drums; Start empty or Import from a
  file — the old per-kind modals survive as the file flows).
- New blank starts: editorAddEmptyFretted (generalizes the empty-Keys
  plumbing — shared _addEmptyArrangement body, unique kind-prefixed
  names, Bass seeds 4 strings, registered via /add-arrangement, adopted
  as the active part) and editorAddEmptyDrums (the create-flow blank
  drum_tab shape, client-state until save; refuses a second tab, with
  an inline dialog note steering to import-replace).
- The pure planner (_newTrackPlanPure) owns the Create fork —
  table-tested without a DOM. Sloppak-only gate preserved. The
  drum-edit button re-anchors beside the new button (its old anchor
  was the removed +Drums).
- Docs: User Guide "Adding a track" flow + create-section pointer.

Tests: tests/new_track.test.mjs — planner routes/blocked states, unique
naming, empty-fretted register/append/switch + backend-error rollback
(fetch stubbed), empty-drums shape/refusal. All fail on main. Full
suite 210/210, lint 0 errors. Runtime-verified through the host with
Playwright: consolidation, defaults, empty Bass lands selected, empty
Drums once then blocked inline, Keys-from-file routes to the Add-Keys
modal, Audio routes to the stem manager, Tracks-column + works.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01929LgKdJMyPGLf8N1WpEVW
Signed-off-by: ChrisBeWithYou <chris@rifflarr.local>
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@ChrisBeWithYou, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 41 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0efd630d-7f56-4c2b-b80d-3e7a1562b1a1

📥 Commits

Reviewing files that changed from the base of the PR and between d93d35e and 6e3370c.

📒 Files selected for processing (4)
  • src/import.js
  • src/new-track.js
  • src/track-session.js
  • tests/new_track.test.mjs
📝 Walkthrough

Walkthrough

This PR replaces separate "Add Drums/Keys/Guitar/Bass" toolbar controls with a single consolidated "+ Track" entry point (toolbar button, menu item, Tracks header button) opening a New Track modal in src/new-track.js. It refactors empty-arrangement creation into shared helpers, adds editorAddEmptyDrums, updates docs/changelog, and adds tests.

Changes

New Track feature

Layer / File(s) Summary
New Track planner and dialog module
src/new-track.js
New module exports a pure plan function, modal render/setters, an async create dispatcher, and a toolbar visibility refresh for the New Track dialog.
Empty arrangement creation refactor
src/import.js, src/arrangement.js
Shares a common _addEmptyArrangement helper and _uniqueTrackNamePure name generator across editorAddEmptyKeys/editorAddEmptyFretted; adds editorAddEmptyDrums for client-side blank drum tabs.
Toolbar, menu, and Tracks header wiring
src/main.js, src/menu-bar.js, screen.html, src/drum.js, src/track-session.js, assets/v3-theme.css
Exposes new-track handlers on window, replaces per-type buttons with a single "+ Track" control, adds a "New Track…" menu item, adds the modal markup and styles, and re-anchors the drum edit button.
Changelog, user guide, and tests
CHANGELOG.md, docs/USER-GUIDE.md, tests/new_track.test.mjs
Documents the New Track workflow and adds unit/async tests for the planner, name generator, and empty-track creation paths.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant NewTrackModal as new-track.js
  participant ImportJs as import.js
  participant ArrangementJs as arrangement.js
  participant Server

  User->>NewTrackModal: editorShowNewTrackModal()
  User->>NewTrackModal: set type/instrument/source
  NewTrackModal->>NewTrackModal: _newTrackPlanPure(sel, ctx)
  User->>NewTrackModal: editorNewTrackCreate()
  alt Audio
    NewTrackModal->>NewTrackModal: route to stem manager / import
  else Empty fretted (MIDI)
    NewTrackModal->>ImportJs: editorAddEmptyFretted(role)
    ImportJs->>Server: POST /api/plugins/editor/add-arrangement
    Server-->>ImportJs: registration result
    ImportJs->>ImportJs: push arrangement, refresh UI
  else Empty drums
    NewTrackModal->>ArrangementJs: editorAddEmptyDrums()
    ArrangementJs->>ArrangementJs: set S.drumTab, refresh UI
  end
  NewTrackModal-->>User: hide modal or show status
Loading

Possibly related issues

Possibly related PRs

Suggested reviewers: byrongamatos

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 38.10% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: a new editor Track dialog for creating tracks, including empty starts.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/new-track-modal

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ChrisBeWithYou
ChrisBeWithYou merged commit 1a7c11d into main Jul 19, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant