feat: add confirmation dialog for track deletion (#738)
Problem
Right-click β Delete track immediately destroys the track with all its clips, no confirmation. One misclick can destroy a complex edit.
Solution
Added an AlertDialog (matching the existing DeleteDialog pattern from scenes-view.tsx) that shows element count before confirming:
- "Delete track? This will remove X elements. This action cannot be undone."
- Cancel/Confirm buttons with destructive variant
- Reuses the project's existing
@radix-uiAlertDialog component
Changes
apps/web/src/components/editor/panels/timeline/index.tsx:- Imported AlertDialog components
- Added
trackToDeletestate to track pending deletion - Replaced direct
removeTrack()call with state setter - Added AlertDialog with element count display
Fixes #738
Summary by CodeRabbit
Release Notes
- New Features
- Timeline track deletion now requires confirmation. A dialog prompt appears when deleting a track, allowing users to cancel or confirm the action to prevent accidental removal.
@Vitalcheffe is attempting to deploy a commit to the OpenCut OSS Team on Vercel.
A member of the Team first needs to authorize it.
No actionable comments were generated in the recent review. π
βΉοΈ Recent review info
βοΈ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 60c20c45-ebc5-4f00-9fb4-81803446ccfc
π₯ Commits
Reviewing files that changed from the base of the PR and between 5cc6abc3a44c9d046a1cb71a8c916f1d35827e8f and c29633588f4a9ad4a11f2a85b6d24a86c700bf5b.
π Files selected for processing (1)
apps/web/src/components/editor/panels/timeline/index.tsx
π Walkthrough
Walkthrough
A confirmation dialog was added to the timeline track deletion flow. When users click "Delete track," a modal dialog now prompts for confirmation instead of immediately removing the track. Canceling dismisses the dialog; confirming proceeds with the deletion.
Changes
| Cohort / File(s) | Summary |
|---|---|
Timeline Track Deletion Confirmation apps/web/src/components/editor/panels/timeline/index.tsx |
Added AlertDialog component with confirmation flow for track deletion. Introduced trackToDelete state to hold pending deletions. Modified delete handler to trigger dialog instead of direct removal. Dialog offers Cancel (clears state) and Delete (executes removal and clears state) options. |
Estimated code review effort
π― 2 (Simple) | β±οΈ ~10 minutes
Suggested reviewers
- mezotv
Poem
π° A delete so swift caused much dismay, With clips vanishing without delay! Now a dialog springs forth with care, "Are you sure?" it asks so fair, Safety first! No more regretβ Just click confirm, no tears to fret! β¨
π₯ Pre-merge checks | β 3 | β 2
β Failed checks (2 warnings)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Description check | β οΈ Warning | The PR description does not comply with the template, which requires approval confirmation for features. | Since this is a feature PR, address the template requirement: either open an issue for discussion first (already done #738) or obtain explicit maintainer approval before submitting. |
| Docstring Coverage | β οΈ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
β Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | β Passed | The title accurately describes the main change: adding a confirmation dialog for track deletion. |
| Linked Issues check | β Passed | The code changes fully satisfy issue #738 requirements by implementing an AlertDialog confirmation flow for track deletion with element count display. |
| Out of Scope Changes check | β Passed | All changes are directly related to implementing the confirmation dialog for track deletion; no unrelated modifications detected. |
βοΈ Tip: You can configure your own custom pre-merge checks in the settings.
β¨ Finishing Touches
π§ͺ Generate unit tests (beta)
- [ ] Create PR with unit tests
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 @coderabbitai help to get the list of available commands and usage tips.