Skip to content

Conversation

@karansingh-dev
Copy link

@karansingh-dev karansingh-dev commented Jul 21, 2025

Description

This pull request implements fullscreen functionality for the preview panel in the editor.
Clicking the maximize button now correctly triggers the browser's Fullscreen API and maximizes the preview panel as expected.

Fixes #385

  • Adds a robust handler for entering fullscreen via the maximize button.

  • Adds error handling if the browser blocks fullscreen access.

  • Does not change UI/UX layout—panel appearance and borders remain as before.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Manually tested in Chrome and Firefox
  • Clicked maximize button to confirm panel enters fullscreen and works as expected

Test Configuration:

  • Node version: v22.16.0
  • Browser: Chrome (latest), Firefox (latest)
  • Operating System: Ubuntu 24.04.2 LTS

Screen Recording

fix_.full.screen.button.in.preview-panel.tsx.mp4

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • [x]I have added screen recording
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes

Additional context

This PR focuses specifically on enabling fullscreen for the preview panel, matching the current issue requirements. If further UX improvements are desired—such as keeping the toolbar visible in fullscreen mode—I would be happy to propose and work on those in a separate, follow-up PR.

Summary by CodeRabbit

  • New Features

    • Added a fullscreen mode to the preview panel, accessible via the toolbar's expand button.
  • Chores

    • Introduced ESLint configuration and related dependencies to improve code quality and consistency.

@netlify
Copy link

netlify bot commented Jul 21, 2025

👷 Deploy request for appcut pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit cfebb7c

@vercel
Copy link

vercel bot commented Jul 21, 2025

@karansingh-dev is attempting to deploy a commit to the OpenCut OSS Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 21, 2025

"""

Walkthrough

A new ESLint configuration tailored for Next.js and TypeScript was added to the web app, along with updates to the project's dependencies to support ESLint. The preview panel component was enhanced to enable fullscreen functionality via the toolbar's expand button, including error handling for fullscreen requests.

Changes

File(s) Change Summary
apps/web/.eslintrc.json Added ESLint config extending Next.js and TypeScript recommended rules.
apps/web/package.json Added @types/node to devDependencies; added eslint and eslint-config-next to devDependencies.
apps/web/src/components/editor/preview-panel.tsx Implemented fullscreen feature in preview panel and updated toolbar to trigger fullscreen mode.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant PreviewToolbar
    participant PreviewPanel
    participant Browser

    User->>PreviewToolbar: Clicks fullscreen button
    PreviewToolbar->>PreviewPanel: Calls onExpand()
    PreviewPanel->>Browser: Requests fullscreen on preview container
    alt Success
        Browser-->>PreviewPanel: Fullscreen activated
    else Failure
        PreviewPanel->>User: Shows alert (fullscreen failed)
    end
Loading

Estimated code review effort

2 (~10–30 minutes)

Poem

A rabbit hopped to check the screen,
Now fullscreen works—so crisp and clean!
With linting rules and tidy code,
The toolbar’s button takes the load.
If fullscreen fails, you’ll see a note—
Bugs are gone, let’s gloat and float!
🐇✨
"""


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b7d900d and cfebb7c.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • apps/web/package.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • apps/web/package.json

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@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

🧹 Nitpick comments (1)
apps/web/src/components/editor/preview-panel.tsx (1)

46-56: Improve error handling and user experience.

The fullscreen implementation is functional but has some areas for improvement:

  1. Using alert() provides poor UX - consider using a toast notification instead
  2. The error handling could be more specific about different failure scenarios
  3. Consider checking for fullscreen support more comprehensively
-  //handle fullScreen
-  const handleFullScreen = () => {
-    // Only attempt fullscreen if ref is available
-    if (previewRef.current && previewRef.current.requestFullscreen) {
-      previewRef.current.requestFullscreen().catch(() => {
-        alert(
-          "Failed to enter fullscreen. Your browser may block this operation."
-        );
-      });
-    }
-  };
+  // Handle fullscreen functionality
+  const handleFullScreen = () => {
+    if (!previewRef.current) return;
+    
+    // Check for fullscreen API support
+    if (!document.fullscreenEnabled) {
+      console.warn('Fullscreen is not supported or enabled in this browser');
+      return;
+    }
+    
+    previewRef.current.requestFullscreen().catch((error) => {
+      console.error('Failed to enter fullscreen:', error);
+      // Consider using a toast notification here instead of alert
+    });
+  };
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3446fdd and b7d900d.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • apps/web/.eslintrc.json (1 hunks)
  • apps/web/package.json (2 hunks)
  • apps/web/src/components/editor/preview-panel.tsx (3 hunks)
🔇 Additional comments (5)
apps/web/package.json (1)

70-71: LGTM! ESLint configuration looks appropriate.

The addition of ESLint and eslint-config-next to devDependencies is well-placed and aligns with the new ESLint configuration file.

apps/web/.eslintrc.json (1)

1-6: LGTM! Standard Next.js ESLint configuration.

The configuration properly extends the recommended Next.js presets for core web vitals and TypeScript support. This is the standard setup for Next.js projects.

apps/web/src/components/editor/preview-panel.tsx (3)

395-398: LGTM! Clean prop passing implementation.

The fullscreen handler is properly passed to the PreviewToolbar component with clear naming and structure.


404-412: LGTM! Component interface properly updated.

The component signature correctly reflects the new onExpand prop with proper TypeScript typing.


514-514: LGTM! Event handler properly connected.

The onClick handler is correctly wired to trigger the fullscreen functionality.

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.

[FEATURE] Fullscreen Button Not Working

1 participant