Skip to content

Added the new recording button so that user does not exit the entire application #307

Open
Ayush765-spec wants to merge 2 commits intosiddharthvaddem:mainfrom
Ayush765-spec:main
Open

Added the new recording button so that user does not exit the entire application #307
Ayush765-spec wants to merge 2 commits intosiddharthvaddem:mainfrom
Ayush765-spec:main

Conversation

@Ayush765-spec
Copy link
Copy Markdown

@Ayush765-spec Ayush765-spec commented Apr 3, 2026

Pull Request Template

Description

The PR introduces a dedicated button in the application's top toolbar ,letting users cancel their active session in the editor and bounce straight back into the main recording (HUD) overlay

Motivation

Here's a clean write-up you can use in your PR description:


Why This Change Is Needed

Right now, if a user finishes recording and wants to start a fresh one, there is no way to do it from within the app. The only option is to completely quit OpenScreen and reopen it — which is frustrating, breaks the workflow, and feels like a bug rather than intentional design.

This is especially painful for users who record frequently, like developers making demo videos or tutorials, where starting a new recording is something they do repeatedly in a single session.


What Problems It Solves

1. Eliminates the need to quit the app
Users no longer have to force-quit and reopen just to record again. The app stays running the whole time.

2. Faster workflow
Going from "done editing" to "ready to record again" is now just two clicks — button click + confirm. Previously it meant quitting, waiting for relaunch, and setting everything up again.

3. Accidental data loss prevention
The confirmation dialog ("Start a new recording? Your current recording will be discarded.") makes sure nobody loses their work by accidentally clicking the button.

4. Meets basic user expectations
Almost every screen recorder out there has a "start over" or "new recording" option. Not having it made OpenScreen feel incomplete compared to alternatives.


In Short

A small UI addition that removes a genuinely annoying pain point and makes the core recording loop feel smooth and intentional.

Type of Change

  • New Feature

Related Issue(s)

#247

Screenshots / Video

Screenshot (if applicable):
Screenshot 2026-04-03 185235
Screenshot 2026-04-03 185457
Screenshot 2026-04-03 185445

![Screenshot Description](path/to/screenshot.png)

Video (if applicable):

<video src="path/to/video.mp4" controls width="600"></video>

Testing

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.

Thank you for contributing!

Summary by CodeRabbit

  • New Features
    • Added "New Recording" button to the video editor toolbar that allows users to start a new recording session with a confirmation dialog, enabling seamless workflow without closing the application.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 3, 2026

📝 Walkthrough

Walkthrough

The changes introduce a "switch to HUD" feature allowing users to transition from the video editor back to the HUD wrapper interface. New IPC communication routes the request from the renderer through the Electron preload bridge to the main process, which closes the editor window and reinitializes the HUD display.

Changes

Cohort / File(s) Summary
Type Definitions
electron/electron-env.d.ts, src/vite-env.d.ts
Added switchToHud: () => Promise<void> method signature to the electronAPI interface.
IPC and Main Process
electron/ipc/handlers.ts, electron/main.ts, electron/preload.ts
Extended registerIpcHandlers to accept optional switchToHud callback; implemented IPC handler switch-to-hud in preload bridge; added main process logic that closes the editor window, resets state via isForceClosing flag, nulls mainWindow, and calls showMainWindow() to display the HUD.
UI Component
src/components/video-editor/VideoEditor.tsx
Added "New Recording" dialog with confirmation callback that clears video path, resets recording session, and invokes switchToHud(). Integrated new "New Recording" button in the toolbar to open the dialog.

Sequence Diagram

sequenceDiagram
    participant User
    participant VideoEditor as VideoEditor UI
    participant Preload as Preload Bridge
    participant IPC as IPC Main
    participant MainProcess as Main Process

    User->>VideoEditor: Click "New Recording" button
    VideoEditor->>VideoEditor: Show "New Recording" dialog
    User->>VideoEditor: Confirm dialog
    VideoEditor->>VideoEditor: Clear video path & reset session
    VideoEditor->>Preload: Call electronAPI.switchToHud()
    Preload->>IPC: ipcRenderer.invoke("switch-to-hud")
    IPC->>MainProcess: IPC handler triggered
    MainProcess->>MainProcess: Set isForceClosing = true
    MainProcess->>MainProcess: Close mainWindow (no confirmation)
    MainProcess->>MainProcess: Set mainWindow = null
    MainProcess->>MainProcess: Call showMainWindow()
    MainProcess->>User: Display HUD interface
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Poem

🐰 The editor and HUD now dance hand in hand,
A dialog blooms with "New Recording" grand!
Through IPC bridges our messages flow,
Back to the HUD with a magical go! 🎬

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

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.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a new recording button that allows users to stay within the app rather than exiting entirely.
Description check ✅ Passed The description covers most required sections including detailed motivation, problem statement, type of change, related issue, and screenshots demonstrating the UI change.

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

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.

🧹 Nitpick comments (2)
src/components/video-editor/VideoEditor.tsx (2)

476-481: Redundant IPC call: setCurrentRecordingSession(null) after clearCurrentVideoPath().

Based on the IPC handler at electron/ipc/handlers.ts:762-765, clearCurrentVideoPath() already calls setCurrentRecordingSessionState(null) internally. The subsequent setCurrentRecordingSession(null) call is redundant.

🔧 Suggested simplification
 const handleNewRecordingConfirm = useCallback(async () => {
   setShowNewRecordingDialog(false);
   await window.electronAPI.clearCurrentVideoPath();
-  await window.electronAPI.setCurrentRecordingSession(null);
   await window.electronAPI.switchToHud();
 }, []);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/video-editor/VideoEditor.tsx` around lines 476 - 481, The
handleNewRecordingConfirm callback makes a redundant IPC call:
clearCurrentVideoPath() already clears the recording session state, so remove
the extra await window.electronAPI.setCurrentRecordingSession(null) call from
handleNewRecordingConfirm; keep setShowNewRecordingDialog(false), await
window.electronAPI.clearCurrentVideoPath(), and await
window.electronAPI.switchToHud() intact and ensure handleNewRecordingConfirm
(the useCallback) still has the correct dependencies.

1418-1420: Hardcoded English strings should use internationalization.

The "New Recording" button text (line 1473), dialog title (line 1418), and dialog description (lines 1419-1420) are hardcoded in English, while adjacent UI elements use the internationalization system (ts("project.load"), ts("project.save")).

Consider adding appropriate i18n keys for consistency with the rest of the UI.

Also applies to: 1467-1474

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/video-editor/VideoEditor.tsx` around lines 1418 - 1420,
Replace the hardcoded English UI strings in VideoEditor (the DialogTitle "New
Recording", the DialogDescription "Start a new recording? Your current recording
will be discarded.", and the "New Recording" button label) with calls to the
i18n helper (e.g. ts("recording.new.title"), ts("recording.new.description"),
ts("recording.new.button")). Update the JSX where DialogTitle,
DialogDescription, and the Button label are rendered to use ts(...) instead of
literals, and add corresponding i18n keys to the translation resource files so
the new keys resolve.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/components/video-editor/VideoEditor.tsx`:
- Around line 476-481: The handleNewRecordingConfirm callback makes a redundant
IPC call: clearCurrentVideoPath() already clears the recording session state, so
remove the extra await window.electronAPI.setCurrentRecordingSession(null) call
from handleNewRecordingConfirm; keep setShowNewRecordingDialog(false), await
window.electronAPI.clearCurrentVideoPath(), and await
window.electronAPI.switchToHud() intact and ensure handleNewRecordingConfirm
(the useCallback) still has the correct dependencies.
- Around line 1418-1420: Replace the hardcoded English UI strings in VideoEditor
(the DialogTitle "New Recording", the DialogDescription "Start a new recording?
Your current recording will be discarded.", and the "New Recording" button
label) with calls to the i18n helper (e.g. ts("recording.new.title"),
ts("recording.new.description"), ts("recording.new.button")). Update the JSX
where DialogTitle, DialogDescription, and the Button label are rendered to use
ts(...) instead of literals, and add corresponding i18n keys to the translation
resource files so the new keys resolve.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fcef48cf-e903-4e9f-99ee-91ca1c14faec

📥 Commits

Reviewing files that changed from the base of the PR and between b101820 and 5259ae5.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (6)
  • electron/electron-env.d.ts
  • electron/ipc/handlers.ts
  • electron/main.ts
  • electron/preload.ts
  • src/components/video-editor/VideoEditor.tsx
  • src/vite-env.d.ts

@Ayush765-spec
Copy link
Copy Markdown
Author

hi @siddharthvaddem pls do check the pr and pls tell if you expect any further changes or merge if no further issues..looking forward to it...thanks

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