feat(editor): New Track dialog — add any track, including from scratch - #315
Conversation
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>
|
Warning Review limit reached
Next review available in: 41 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis 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. ChangesNew Track feature
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
Possibly related issues
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Why
From Discord (Kisscool → Christian, 07-18):
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
+ Tracktoolbar 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):
/import-stems), with the manager opened alongside so the tracks land somewhere visible.editorAddEmptyFretted(role)— new: generalizes the empty-Keys plumbing into a shared_addEmptyArrangementbody. 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 blankdrum_tabshape ({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._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 atrack-session → new-track → stem-tracks → track-sessionimport 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,editorAddEmptyFrettedregister-append-switch with a stubbed backend + error path leaving state untouched,editorAddEmptyDrumsshape/refusal/format gate.npm test210/210 ·npm run lint0 errors.Runtime verification (real host + Playwright)
Old trio gone ·
+ Trackvisible 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
Documentation