Skip to content

feat: add Cancel Recording button to HUD#295

Open
abres33 wants to merge 3 commits intosiddharthvaddem:mainfrom
abres33:feature/cancel-recording
Open

feat: add Cancel Recording button to HUD#295
abres33 wants to merge 3 commits intosiddharthvaddem:mainfrom
abres33:feature/cancel-recording

Conversation

@abres33
Copy link
Copy Markdown
Contributor

@abres33 abres33 commented Apr 3, 2026

Description

Adds a Cancel button to the recording HUD that discards the current recording and returns the app to idle - without saving the footage or opening the editor.

Motivation

The existing HUD offers Stop (saves + opens editor) and Restart (discards + restarts immediately). There was no way to simply abandon a recording and return to idle without committing to a new recording right away. Cancel fills that gap for cases where the user needs to re-configure their setup before recording again.

Type of Change

  • New Feature ✅

Screenshot

image

Testing

  1. Launch OpenScreen and start a recording
  2. Click the Cancel button (circle with X icon) in the HUD
  3. Verify: HUD returns to idle, no editor opens, no file is saved
  4. Start a new recording to confirm the app is fully functional after cancel
  5. Verify Stop and Restart still behave as before

Checklist

  • I have performed a self-review of my code.
  • I have added any necessary screenshots or videos.
  • I have linked related issue(s) and updated the changelog if applicable

Summary by CodeRabbit

  • New Features

    • Users can cancel active screen recordings via a HUD button shown during recording.
    • Added multilingual tooltip for the cancel action in English, Spanish, and Simplified Chinese.
  • Tests

    • Updated end-to-end test for HUD/GIF export to improve error handling around window/context interactions.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 34aa822a-9dc8-46d5-98b3-363c73297e76

📥 Commits

Reviewing files that changed from the base of the PR and between d693381 and 27853cc.

📒 Files selected for processing (1)
  • tests/e2e/gif-export.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/e2e/gif-export.spec.ts

📝 Walkthrough

Walkthrough

Adds a cancelRecording API to the screen recorder hook and exposes it in the LaunchWindow UI; stops and discards active recordings without auto-finalization. Adds tooltip translations for English, Spanish, and Chinese and adjusts an e2e test's error handling around HUD evaluate.

Changes

Cohort / File(s) Summary
Screen Recorder Hook
src/hooks/useScreenRecorder.ts
Added cancelRecording: () => void to the hook return; implementation marks current recording to be discarded, disables auto-finalize, and stops the recorder.
Launch Window UI
src/components/launch/LaunchWindow.tsx
Imported MdCancel, extended ICON_CONFIG, destructured cancelRecording from the hook, and rendered a HUD cancel button visible when recording that calls cancelRecording.
Localization
src/i18n/locales/en/launch.json, src/i18n/locales/es/launch.json, src/i18n/locales/zh-CN/launch.json
Added tooltips.cancelRecording translations: "Cancel recording" / "Cancelar grabación" / "取消录制".
End-to-end test
tests/e2e/gif-export.spec.ts
Moved try/catch scope to wrap the await hudWindow.evaluate(...) call so context-closure errors are caught outside the page callback; simplified the evaluate callback.

Sequence Diagram(s)

sequenceDiagram
participant UI as LaunchWindow (UI)
participant Hook as useScreenRecorder
participant Recorder as ScreenRecorderManager
UI->>Hook: user clicks Cancel button (while recording)
Hook->>Recorder: set discardRecordingId, disable allowAutoFinalize
Hook->>Recorder: stopRecording()
Recorder-->>Hook: stopped (no auto-finalize / discarded)
Hook-->>UI: recording state updated (stopped)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • siddharthvaddem

Poem

🐰 A button to cancel—quick little hop,
When captures go sideways, no need to stop,
I press, it forgets what it saw,
Poof—gone from the reel without a flaw,
Hooray—back to hopping on the log! 🥕

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
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.
Linked Issues check ❓ Inconclusive The PR description claims to have linked related issues and updated the changelog, but no explicit issue links (#123 format) are visible in the provided description text. Verify that related issues are properly linked in the GitHub PR and that the changelog has been updated with the new Cancel Recording feature.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: add Cancel Recording button to HUD' is fully related to the main change, clearly summarizing the primary feature addition across multiple files.
Description check ✅ Passed The pull request description covers all critical sections including Description, Motivation, Type of Change, Screenshots, and Testing steps with clear verification criteria.
Out of Scope Changes check ✅ Passed The E2E test modification in gif-export.spec.ts addresses a pre-existing test failure unrelated to the cancel-recording feature, as noted in the PR comments.

✏️ 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.

@abres33
Copy link
Copy Markdown
Contributor Author

abres33 commented Apr 3, 2026

@siddharthvaddem Identified and fixed a pre-existing E2E test failure unrelated to the cancel recording feature. The gif-export test had a try/catch inside the hudWindow.evaluate() callback to handle the HUD window closing — but the error is actually thrown by Playwright at the await level, not inside the browser context, so the catch never fired. Moved the try/catch to wrap the outer await hudWindow.evaluate(...) call instead.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/e2e/gif-export.spec.ts`:
- Around line 61-69: The evaluate callback should await setCurrentVideoPath
before calling switchToEditor to avoid a race: change the hudWindow.evaluate
callback to await window.electronAPI.setCurrentVideoPath(videoPath); then await
window.electronAPI.switchToEditor(); and make the surrounding catch block stop
silently swallowing errors — only ignore the exception when it is the expected
page/window-close error and otherwise rethrow or log the error so legitimate
failures in setCurrentVideoPath are surfaced (follow the same sequential-await
pattern used in LaunchWindow.tsx and reference hudWindow.evaluate,
setCurrentVideoPath, switchToEditor).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8d27e573-fa92-46e5-94a8-96e696573f4b

📥 Commits

Reviewing files that changed from the base of the PR and between 2b47178 and d693381.

📒 Files selected for processing (1)
  • tests/e2e/gif-export.spec.ts

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