OpenCut icon indicating copy to clipboard operation
OpenCut copied to clipboard

feat: add confirmation dialog for track deletion (#738)

Open Vitalcheffe opened this issue 8 months ago β€’ 2 comments

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-ui AlertDialog component

Changes

  • apps/web/src/components/editor/panels/timeline/index.tsx:
    • Imported AlertDialog components
    • Added trackToDelete state 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 avatar Mar 30 '26 23:03 Vitalcheffe

@Vitalcheffe is attempting to deploy a commit to the OpenCut OSS Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Mar 30 '26 23:03 vercel[bot]

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.

❀️ Share

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

coderabbitai[bot] avatar Mar 30 '26 23:03 coderabbitai[bot]