Skip to content

Conversation

@heysagnik
Copy link
Owner

This PR is for implementing new changes in terms of UI and features

@vercel
Copy link

vercel bot commented Oct 29, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
screen-rec Ready Ready Preview Comment Oct 29, 2025 11:04pm

@heysagnik
Copy link
Owner Author

Issues:

  1. Not responsive in the record page
  2. The video combined has a smaller pip camera view.
  3. More bugs on the go.

@heysagnik heysagnik requested a review from Copilot October 29, 2025 23:14
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This is a comprehensive rewrite that migrates the screen recording application from a Parcel-based vanilla JavaScript architecture to a modern Next.js 15 + React 19 + TypeScript stack with Tailwind CSS 4. The refactor introduces React hooks for state management, improved type safety, and a component-based architecture while maintaining the core screen recording functionality.

Key Changes:

  • Complete migration from vanilla JS to Next.js 15 with React 19 and TypeScript
  • Replaced SCSS with Tailwind CSS 4 for styling
  • Introduced custom React hooks (useRecording, useMediaStreams, useCameraPosition) for better code organization
  • Added TypeScript type safety throughout the codebase

Reviewed Changes

Copilot reviewed 60 out of 91 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
package.json Updated dependencies from Parcel to Next.js 15 + React 19 ecosystem
tsconfig.json Added TypeScript configuration for Next.js with strict mode
src/hooks/useRecording.ts New custom hook for managing recording lifecycle with MediaRecorder API
src/hooks/useMediaStreams.ts New hook for managing screen/camera/audio stream state
src/utils/streamCombiner.ts Extracted stream combining logic with canvas rendering for PiP layouts
src/utils/telemetry.ts Added telemetry service for analytics tracking
src/components/* New React components replacing vanilla JS DOM manipulation
src/app/* Next.js App Router pages and layout

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +368 to +369
useEffect(() => {
const handleKeyPress = (event: KeyboardEvent) => {
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

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

Duplicate keyboard shortcut handlers detected. There are two separate useEffect hooks (lines 368-436 and 477-503) implementing the same keyboard shortcuts. This creates redundant event listeners and could lead to handlers firing twice. Consolidate into a single keyboard shortcut handler.

Copilot uses AI. Check for mistakes.
Comment on lines +477 to +503
useEffect(() => {
const onKey = (e: KeyboardEvent) => {
const key = e.key.toLowerCase();
const mod = e.ctrlKey || e.metaKey;
if (!mod) return;
if (key === 'r') {
e.preventDefault();
if (isRecording) {
handleStopRecording();
} else {
handleStartRecording();
}
}
if (key === 'p') { e.preventDefault(); if (isRecording) { pauseRecording(); } }
if (key === 'm') { e.preventDefault(); handleToggleMic(); }
if (key === 's') {
e.preventDefault();
if (isScreenShared) {
stopScreen();
} else {
handleShareScreen();
}
}
};
window.addEventListener('keydown', onKey);
return () => window.removeEventListener('keydown', onKey);
}, [isRecording, handleStopRecording, handleStartRecording, pauseRecording, handleToggleMic, isScreenShared, stopScreen, handleShareScreen]);
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

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

Duplicate keyboard shortcut handlers detected. There are two separate useEffect hooks (lines 368-436 and 477-503) implementing the same keyboard shortcuts. This creates redundant event listeners and could lead to handlers firing twice. Consolidate into a single keyboard shortcut handler.

Suggested change
useEffect(() => {
const onKey = (e: KeyboardEvent) => {
const key = e.key.toLowerCase();
const mod = e.ctrlKey || e.metaKey;
if (!mod) return;
if (key === 'r') {
e.preventDefault();
if (isRecording) {
handleStopRecording();
} else {
handleStartRecording();
}
}
if (key === 'p') { e.preventDefault(); if (isRecording) { pauseRecording(); } }
if (key === 'm') { e.preventDefault(); handleToggleMic(); }
if (key === 's') {
e.preventDefault();
if (isScreenShared) {
stopScreen();
} else {
handleShareScreen();
}
}
};
window.addEventListener('keydown', onKey);
return () => window.removeEventListener('keydown', onKey);
}, [isRecording, handleStopRecording, handleStartRecording, pauseRecording, handleToggleMic, isScreenShared, stopScreen, handleShareScreen]);
// (Removed duplicate keyboard shortcut useEffect. Logic is now consolidated above.)

Copilot uses AI. Check for mistakes.
Comment on lines +224 to +225
useEffect(() => {
const handleBeforeUnload = (e: BeforeUnloadEvent) => {
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

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

Duplicate beforeunload event handlers detected. Two separate useEffect hooks (lines 224-234 and 506-515) register the same beforeunload event listener, causing duplicate event handlers. Remove one of these duplicate useEffect blocks.

Copilot uses AI. Check for mistakes.
Comment on lines +506 to +515
useEffect(() => {
const beforeUnload = (e: BeforeUnloadEvent) => {
if (isRecording) {
e.preventDefault();
e.returnValue = '';
}
};
window.addEventListener('beforeunload', beforeUnload);
return () => window.removeEventListener('beforeunload', beforeUnload);
}, [isRecording]);
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

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

Duplicate beforeunload event handlers detected. Two separate useEffect hooks (lines 224-234 and 506-515) register the same beforeunload event listener, causing duplicate event handlers. Remove one of these duplicate useEffect blocks.

Suggested change
useEffect(() => {
const beforeUnload = (e: BeforeUnloadEvent) => {
if (isRecording) {
e.preventDefault();
e.returnValue = '';
}
};
window.addEventListener('beforeunload', beforeUnload);
return () => window.removeEventListener('beforeunload', beforeUnload);
}, [isRecording]);

Copilot uses AI. Check for mistakes.
startGuardRef.current = false;
};

mediaRecorder.start(1000); // keep timeslice; make configurable later
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

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

Magic number 1000 used as timeslice parameter. This should be extracted to a constant in RECORDING_CONFIG for consistency with other configuration values and to make it configurable as mentioned in the comment.

Copilot uses AI. Check for mistakes.
"test": "npm run check-format && npm run check-lint && npm run build",
"prepare": "husky install"
"dev": "next dev --turbopack",
"build": "next build --turbopack",
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

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

Using --turbopack flag in production build. Turbopack is experimental and may not be stable for production builds. Consider removing the --turbopack flag from the build script and only use it for development.

Suggested change
"build": "next build --turbopack",
"build": "next build",

Copilot uses AI. Check for mistakes.
Comment on lines +157 to +158
canvas.width = 16;
canvas.height = 9;
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

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

Canvas initialized with incorrect dimensions (16x9 pixels). This creates an extremely small canvas that will be immediately resized, causing unnecessary initial rendering. Initialize with more reasonable default dimensions or the first available video dimensions.

Copilot uses AI. Check for mistakes.
@heysagnik
Copy link
Owner Author

@copilot could you please provide me the summary of the changes needed in a paragraph.

Copy link

Copilot AI commented Oct 30, 2025

@heysagnik I've opened a new pull request, #110, to work on those changes. Once the pull request is ready, I'll request review from you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants