Skip to content

Conversation

@CamHudson808
Copy link

@CamHudson808 CamHudson808 commented Oct 11, 2025

Description

Adding a + icon to the side of all shortcuts (see image). When clicking on it, has same functionality as clicking on shortcuts themselves, except it now appends the new shortcut to the list of existing shortcuts.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Performance improvement
  • Code refactoring
  • Tests

How Has This Been Tested?

I verified that when clicking on the shortcuts themselves and entering a key, it deletes all previous shortcuts. When doing the same but clicking the "+" icon instead, it appends it to the already existing shortcuts.

  • Test A
  • Test B

Test Configuration:

  • Node version: v24
  • Browser (if applicable): Firefox
  • Operating System: MacOS

Screenshots (if applicable)

image

Add screenshots to help explain your changes.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have added screenshots if ui has been changed
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Additional context

Add any other context about the pull request here.

Summary by CodeRabbit

  • New Features

    • Keyboard Shortcuts: added an “Add Shortcut” control and an adding mode to create bindings alongside existing ones.
    • Sounds: shipping a full sounds store implementation to improve sound management and timeline integration.
  • Bug Fixes

    • Sounds: tightened search/pagination validation for external sound responses to reduce edge-case errors.
  • Style

    • Export error message now renders on a single line for cleaner presentation.

@vercel
Copy link

vercel bot commented Oct 11, 2025

@CamHudson808 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 Oct 11, 2025

Walkthrough

Formatting-heavy changes across migrations, API routes, components, hooks, libs, and types; functional changes: stricter URL validation for Freesound pagination, new keyboard-shortcuts “adding” mode with store state, and a full Zustand-based sounds store. Minor SVG path reorganization in icons.

Changes

Cohort / File(s) Summary of changes
Migrations formatting
apps/web/migrations/meta/0003_snapshot.json, apps/web/migrations/meta/_journal.json
JSON formatting: inline arrays and trailing newlines; no schema changes.
API routes (formatting)
apps/web/src/app/api/get-upload-url/route.ts, .../transcribe/route.ts, .../waitlist/export/route.ts
Reformatting only; logic and responses unchanged.
API sounds search validation
apps/web/src/app/api/sounds/search/route.ts
Tightened schema: next/previous must be URL or null; behavior otherwise unchanged.
Keyboard shortcuts “adding” mode
apps/web/src/components/keyboard-shortcuts-help.tsx, apps/web/src/stores/keybindings-store.ts
Added UI “adding” mode with isAdding state, setter, AddShortcut UI wiring, and updated recording/exit handling.
Sounds store implementation
apps/web/src/stores/sounds-store.ts, apps/web/src/types/sounds.ts
Added full Zustand sounds store implementation (state, actions, async search/pagination, add-to-timeline flow); types semantically unchanged.
Editor components (formatting/structure)
apps/web/src/components/editor/export-button.tsx, .../layout-guide-overlay.tsx, .../media-panel/tabbar.tsx, .../media-panel/views/captions.tsx, .../panel-base-view.tsx, .../panel-preset-selector.tsx, .../timeline/timeline-marker.tsx
Reflowed imports/JSX and formatting; behavior and APIs preserved.
UI components (formatting)
apps/web/src/components/ui/editable-timecode.tsx, .../font-picker.tsx, .../input-with-back.tsx, .../input.tsx, .../split-button.tsx, .../tooltip.tsx
Quote/style/whitespace adjustments and minor JSX formatting; no behavioral changes.
Icons SVG reorganization
apps/web/src/components/icons.tsx
Split combined SVG paths into separate fill/stroke elements; visual output preserved.
Misc components (formatting)
apps/web/src/components/footer.tsx, apps/web/src/components/language-select.tsx, apps/web/src/components/theme-toggle.tsx
Minor JSX/formatting edits; no logic changes.
Hooks (formatting)
apps/web/src/hooks/use-edge-auto-scroll.ts, .../use-highlight-scroll.ts, .../use-infinite-scroll.ts, .../use-sound-search.ts
Formatting/spacing only; behavior unchanged.
Libs (imports/formatting)
apps/web/src/lib/editor-utils.ts, .../export.ts, .../iconify-api.ts, .../schemas/waitlist.ts, .../transcription-utils.ts, .../video-cache.ts, .../zk-encryption.ts
Import tweaks, whitespace, and comment style changes; logic unchanged.
Constants (formatting)
apps/web/src/constants/text-constants.ts
Type annotation spacing normalized; values unchanged.
Playback store (formatting)
apps/web/src/stores/playback-store.ts
Console message formatting only.
Text properties store (formatting)
apps/web/src/stores/text-properties-store.ts
Structural/formatting edits only; exports unchanged.
Types (formatting)
apps/web/src/types/media.ts, apps/web/src/types/sounds.ts
Whitespace/comment adjustments; types unchanged.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant UI as KeyboardShortcutsHelp UI
  participant Store as Keybindings Store
  participant Recorder as Shortcut Recorder

  User->>UI: Click "Add Shortcut"
  UI->>Store: setIsAdding(true)
  UI->>Recorder: startRecording()
  alt Successful key capture
    Recorder-->>UI: keys
    UI->>Store: update bindings (add or replace)
    UI->>Store: setIsAdding(false)
    UI->>Recorder: stopRecording()
    UI-->>User: Shortcut added
  else Click outside / cancel
    UI->>Recorder: stopRecording()
    UI->>Store: setIsAdding(false)
    UI-->>User: Dismissed
  end
Loading
sequenceDiagram
  autonumber
  actor User
  participant Sounds as useSoundsStore
  participant API as Freesound API
  participant Timeline as Timeline Store
  participant Media as Media Store

  User->>Sounds: Search(query, page)
  Sounds->>API: GET /search
  API-->>Sounds: results { next, previous, items }
  Sounds-->>User: state updated (items, pagination)

  User->>Sounds: AddSoundToTimeline(sound)
  Sounds->>Media: ensure media loaded
  Sounds->>Timeline: add clip at playhead
  Timeline-->>User: timeline updated
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

A hop, a tap, a new key ring,
I add a shortcut, hear it sing.
Sounds jump in line, tidy and neat,
URLs checked and paths complete.
Cleaned-up code, then off I spring—🐰✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The description includes a summary, type of change, testing details, screenshots, and a checklist but the "Fixes #" line lacks an actual issue number and the Test A/Test B placeholders remain unfilled, so it does not fully adhere to the required template. Please specify the issue number in the "Fixes #" line and either fill in or remove the Test A and Test B placeholders to complete the testing section in the PR description.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly describes the main feature added—the ability to add additional shortcuts—making it clear and specific to the primary change.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@netlify
Copy link

netlify bot commented Oct 11, 2025

👷 Deploy request for appcut pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 4658263

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: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/web/src/components/keyboard-shortcuts-help.tsx (1)

45-106: Ensure the recording effect reacts to isAdding.

isAdding is read inside the keydown handler, but it’s omitted from the effect dependencies. If a user clicks “+” after recording has already started, isAdding flips to true while isRecording stays true, so the effect isn’t re-run and the handler keeps the stale isAdding=false closure—forcing removal of old shortcuts when we intended to append. Add isAdding (and the setter you call) to the dependency array to keep the handler in sync.

   }, [
     recordingShortcut,
     getKeybindingString,
     updateKeybinding,
     removeKeybinding,
     validateKeybinding,
     getKeybindingsForAction,
     setIsRecording,
-    isRecording,
+    setIsAdding,
+    isRecording,
+    isAdding,
   ]);
🧹 Nitpick comments (7)
apps/web/src/lib/video-cache.ts (1)

156-167: Consider awaiting iterator cleanup for proper resource management.

Line 160 calls iterator.return() without awaiting, whereas line 86 in seekToTime properly awaits the same call. While synchronous cleanup might be acceptable here, awaiting ensures the iterator fully releases resources (especially video decoder handles) before the sink is deleted.

Apply this diff if async cleanup is preferred:

-  clearVideo(mediaId: string): void {
+  async clearVideo(mediaId: string): Promise<void> {
     const sinkData = this.sinks.get(mediaId);
     if (sinkData) {
       if (sinkData.iterator) {
-        sinkData.iterator.return();
+        await sinkData.iterator.return();
       }

       this.sinks.delete(mediaId);
     }

     this.initPromises.delete(mediaId);
   }

Note: This would require updating clearAll to handle the async nature:

-  clearAll(): void {
-    for (const [mediaId] of this.sinks) {
-      this.clearVideo(mediaId);
-    }
+  async clearAll(): Promise<void> {
+    const clearPromises = Array.from(this.sinks.keys()).map((mediaId) =>
+      this.clearVideo(mediaId)
+    );
+    await Promise.all(clearPromises);
   }
apps/web/src/stores/playback-store.ts (1)

40-42: LGTM - Optional refactor suggestion.

The formatting change is fine and has no behavioral impact. However, since this line is being touched, consider using template literals instead of string concatenation for better readability.

Apply this diff for cleaner string interpolation:

-          console.error(
-            "Project FPS is not set, assuming " + DEFAULT_FPS + "fps"
-          );
+          console.error(
+            `Project FPS is not set, assuming ${DEFAULT_FPS}fps`
+          );
apps/web/src/components/theme-toggle.tsx (1)

4-4: Remove unused Moon import.

The Moon icon is imported but never used in this component. Only the Sun icon is rendered.

Apply this diff:

-import { Sun, Moon } from "lucide-react";
+import { Sun } from "lucide-react";
apps/web/src/stores/sounds-store.ts (4)

141-161: Remove console.error usage.

The code uses console.error for logging, which violates the coding guidelines that state "Don't use console."

As per coding guidelines.

Consider replacing console logging with a proper logging service or removing the console statements entirely, relying on the toast notifications for user feedback.


163-177: Remove console.error usage.

The code uses console.error for logging, which violates the coding guidelines.

As per coding guidelines.


179-194: Remove console.error usage.

The code uses console.error for logging, which violates the coding guidelines.

As per coding guidelines.


211-225: Remove console.error usage.

The code uses console.error for logging, which violates the coding guidelines.

As per coding guidelines.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bee7aba and f121bb4.

📒 Files selected for processing (42)
  • apps/web/migrations/meta/0003_snapshot.json (6 hunks)
  • apps/web/migrations/meta/_journal.json (1 hunks)
  • apps/web/src/app/api/get-upload-url/route.ts (1 hunks)
  • apps/web/src/app/api/sounds/search/route.ts (1 hunks)
  • apps/web/src/app/api/transcribe/route.ts (1 hunks)
  • apps/web/src/app/api/waitlist/export/route.ts (1 hunks)
  • apps/web/src/components/editor/export-button.tsx (1 hunks)
  • apps/web/src/components/editor/layout-guide-overlay.tsx (1 hunks)
  • apps/web/src/components/editor/media-panel/tabbar.tsx (3 hunks)
  • apps/web/src/components/editor/media-panel/views/captions.tsx (1 hunks)
  • apps/web/src/components/editor/panel-base-view.tsx (1 hunks)
  • apps/web/src/components/editor/panel-preset-selector.tsx (1 hunks)
  • apps/web/src/components/editor/timeline/timeline-marker.tsx (1 hunks)
  • apps/web/src/components/footer.tsx (1 hunks)
  • apps/web/src/components/icons.tsx (2 hunks)
  • apps/web/src/components/keyboard-shortcuts-help.tsx (8 hunks)
  • apps/web/src/components/language-select.tsx (1 hunks)
  • apps/web/src/components/theme-toggle.tsx (1 hunks)
  • apps/web/src/components/ui/editable-timecode.tsx (1 hunks)
  • apps/web/src/components/ui/font-picker.tsx (1 hunks)
  • apps/web/src/components/ui/input-with-back.tsx (1 hunks)
  • apps/web/src/components/ui/input.tsx (1 hunks)
  • apps/web/src/components/ui/split-button.tsx (1 hunks)
  • apps/web/src/components/ui/tooltip.tsx (4 hunks)
  • apps/web/src/constants/text-constants.ts (1 hunks)
  • apps/web/src/hooks/use-edge-auto-scroll.ts (1 hunks)
  • apps/web/src/hooks/use-highlight-scroll.ts (1 hunks)
  • apps/web/src/hooks/use-infinite-scroll.ts (1 hunks)
  • apps/web/src/hooks/use-sound-search.ts (1 hunks)
  • apps/web/src/lib/editor-utils.ts (1 hunks)
  • apps/web/src/lib/export.ts (1 hunks)
  • apps/web/src/lib/iconify-api.ts (0 hunks)
  • apps/web/src/lib/schemas/waitlist.ts (1 hunks)
  • apps/web/src/lib/transcription-utils.ts (1 hunks)
  • apps/web/src/lib/video-cache.ts (1 hunks)
  • apps/web/src/lib/zk-encryption.ts (1 hunks)
  • apps/web/src/stores/keybindings-store.ts (4 hunks)
  • apps/web/src/stores/playback-store.ts (1 hunks)
  • apps/web/src/stores/sounds-store.ts (1 hunks)
  • apps/web/src/stores/text-properties-store.ts (1 hunks)
  • apps/web/src/types/media.ts (1 hunks)
  • apps/web/src/types/sounds.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • apps/web/src/lib/iconify-api.ts
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{jsx,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{jsx,tsx}: Don't use accessKey attribute on any HTML element.
Don't set aria-hidden="true" on focusable elements.
Don't add ARIA roles, states, and properties to elements that don't support them.
Don't use distracting elements like <marquee> or <blink>.
Only use the scope prop on <th> elements.
Don't assign non-interactive ARIA roles to interactive HTML elements.
Make sure label elements have text content and are associated with an input.
Don't assign interactive ARIA roles to non-interactive HTML elements.
Don't assign tabIndex to non-interactive HTML elements.
Don't use positive integers for tabIndex property.
Don't include "image", "picture", or "photo" in img alt prop.
Don't use explicit role property that's the same as the implicit/default role.
Make static elements with click handlers use a valid role attribute.
Always include a title element for SVG elements.
Give all elements requiring alt text meaningful information for screen readers.
Make sure anchors have content that's accessible to screen readers.
Assign tabIndex to non-interactive HTML elements with aria-activedescendant.
Include all required ARIA attributes for elements with ARIA roles.
Make sure ARIA properties are valid for the element's supported roles.
Always include a type attribute for button elements.
Make elements with interactive roles and handlers focusable.
Give heading elements content that's accessible to screen readers (not hidden with aria-hidden).
Always include a lang attribute on the html element.
Always include a title attribute for iframe elements.
Accompany onClick with at least one of: onKeyUp, onKeyDown, or onKeyPress.
Accompany onMouseOver/onMouseOut with onFocus/onBlur.
Include caption tracks for audio and video elements.
Use semantic elements instead of role attributes in JSX.
Make sure all anchors are valid and navigable.
Ensure all ARIA properties (aria-*) are valid.
Use valid, non-abstract ARIA roles for elements with...

Files:

  • apps/web/src/components/editor/export-button.tsx
  • apps/web/src/components/editor/media-panel/views/captions.tsx
  • apps/web/src/components/footer.tsx
  • apps/web/src/components/editor/media-panel/tabbar.tsx
  • apps/web/src/components/ui/split-button.tsx
  • apps/web/src/components/ui/font-picker.tsx
  • apps/web/src/components/editor/layout-guide-overlay.tsx
  • apps/web/src/components/ui/input-with-back.tsx
  • apps/web/src/components/editor/panel-preset-selector.tsx
  • apps/web/src/components/editor/timeline/timeline-marker.tsx
  • apps/web/src/components/theme-toggle.tsx
  • apps/web/src/components/ui/editable-timecode.tsx
  • apps/web/src/components/ui/input.tsx
  • apps/web/src/components/icons.tsx
  • apps/web/src/components/keyboard-shortcuts-help.tsx
  • apps/web/src/components/language-select.tsx
  • apps/web/src/components/editor/panel-base-view.tsx
  • apps/web/src/components/ui/tooltip.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Don't use TypeScript enums.
Don't export imported variables.
Don't add type annotations to variables, parameters, and class properties that are initialized with literal expressions.
Don't use TypeScript namespaces.
Don't use non-null assertions with the ! postfix operator.
Don't use parameter properties in class constructors.
Don't use user-defined types.
Use as const instead of literal types and type annotations.
Use either T[] or Array<T> consistently.
Initialize each enum member value explicitly.
Use export type for types.
Use import type for types.
Make sure all enum members are literal values.
Don't use TypeScript const enum.
Don't declare empty interfaces.
Don't let variables evolve into any type through reassignments.
Don't use the any type.
Don't misuse the non-null assertion operator (!) in TypeScript files.
Don't use implicit any type on variable declarations.
Don't merge interfaces and classes unsafely.
Don't use overload signatures that aren't next to each other.
Use the namespace keyword instead of the module keyword to declare TypeScript namespaces.
Don't use empty type parameters in type aliases and interfaces.
Don't use any or unknown as type constraints.
Don't use the TypeScript directive @ts-ignore.
Use consistent accessibility modifiers on class properties and methods.
Use function types instead of object types with call signatures.
Don't use void type outside of generic or return types.

**/*.{ts,tsx}: Don't use primitive type aliases or misleading types
Don't use the TypeScript directive @ts-ignore
Don't use TypeScript enums
Use either T[] or Array consistently
Don't use the any type

Files:

  • apps/web/src/components/editor/export-button.tsx
  • apps/web/src/components/editor/media-panel/views/captions.tsx
  • apps/web/src/types/sounds.ts
  • apps/web/src/components/footer.tsx
  • apps/web/src/lib/transcription-utils.ts
  • apps/web/src/components/editor/media-panel/tabbar.tsx
  • apps/web/src/app/api/waitlist/export/route.ts
  • apps/web/src/types/media.ts
  • apps/web/src/stores/playback-store.ts
  • apps/web/src/app/api/sounds/search/route.ts
  • apps/web/src/lib/editor-utils.ts
  • apps/web/src/app/api/transcribe/route.ts
  • apps/web/src/stores/keybindings-store.ts
  • apps/web/src/lib/export.ts
  • apps/web/src/hooks/use-infinite-scroll.ts
  • apps/web/src/components/ui/split-button.tsx
  • apps/web/src/lib/schemas/waitlist.ts
  • apps/web/src/lib/zk-encryption.ts
  • apps/web/src/constants/text-constants.ts
  • apps/web/src/lib/video-cache.ts
  • apps/web/src/components/ui/font-picker.tsx
  • apps/web/src/components/editor/layout-guide-overlay.tsx
  • apps/web/src/components/ui/input-with-back.tsx
  • apps/web/src/components/editor/panel-preset-selector.tsx
  • apps/web/src/hooks/use-edge-auto-scroll.ts
  • apps/web/src/components/editor/timeline/timeline-marker.tsx
  • apps/web/src/components/theme-toggle.tsx
  • apps/web/src/app/api/get-upload-url/route.ts
  • apps/web/src/stores/text-properties-store.ts
  • apps/web/src/hooks/use-sound-search.ts
  • apps/web/src/components/ui/editable-timecode.tsx
  • apps/web/src/components/ui/input.tsx
  • apps/web/src/components/icons.tsx
  • apps/web/src/components/keyboard-shortcuts-help.tsx
  • apps/web/src/components/language-select.tsx
  • apps/web/src/components/editor/panel-base-view.tsx
  • apps/web/src/hooks/use-highlight-scroll.ts
  • apps/web/src/components/ui/tooltip.tsx
  • apps/web/src/stores/sounds-store.ts
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{js,jsx,ts,tsx}: Don't use the return value of React.render.
Don't use consecutive spaces in regular expression literals.
Don't use the arguments object.
Don't use primitive type aliases or misleading types.
Don't use the comma operator.
Don't write functions that exceed a given Cognitive Complexity score.
Don't use unnecessary boolean casts.
Don't use unnecessary callbacks with flatMap.
Use for...of statements instead of Array.forEach.
Don't create classes that only have static members (like a static namespace).
Don't use this and super in static contexts.
Don't use unnecessary catch clauses.
Don't use unnecessary constructors.
Don't use unnecessary continue statements.
Don't export empty modules that don't change anything.
Don't use unnecessary escape sequences in regular expression literals.
Don't use unnecessary labels.
Don't use unnecessary nested block statements.
Don't rename imports, exports, and destructured assignments to the same name.
Don't use unnecessary string or template literal concatenation.
Don't use String.raw in template literals when there are no escape sequences.
Don't use useless case statements in switch statements.
Don't use ternary operators when simpler alternatives exist.
Don't use useless this aliasing.
Don't initialize variables to undefined.
Don't use the void operators (they're not familiar).
Use arrow functions instead of function expressions.
Use Date.now() to get milliseconds since the Unix Epoch.
Use .flatMap() instead of map().flat() when possible.
Use literal property access instead of computed property access.
Don't use parseInt() or Number.parseInt() when binary, octal, or hexadecimal literals work.
Use concise optional chaining instead of chained logical expressions.
Use regular expression literals instead of the RegExp constructor when possible.
Don't use number literal object member names that aren't base 10 or use underscore separators.
Remove redundant terms from logical expressions.
Use while loops instead of...

Files:

  • apps/web/src/components/editor/export-button.tsx
  • apps/web/src/components/editor/media-panel/views/captions.tsx
  • apps/web/src/types/sounds.ts
  • apps/web/src/components/footer.tsx
  • apps/web/src/lib/transcription-utils.ts
  • apps/web/src/components/editor/media-panel/tabbar.tsx
  • apps/web/src/app/api/waitlist/export/route.ts
  • apps/web/src/types/media.ts
  • apps/web/src/stores/playback-store.ts
  • apps/web/src/app/api/sounds/search/route.ts
  • apps/web/src/lib/editor-utils.ts
  • apps/web/src/app/api/transcribe/route.ts
  • apps/web/src/stores/keybindings-store.ts
  • apps/web/src/lib/export.ts
  • apps/web/src/hooks/use-infinite-scroll.ts
  • apps/web/src/components/ui/split-button.tsx
  • apps/web/src/lib/schemas/waitlist.ts
  • apps/web/src/lib/zk-encryption.ts
  • apps/web/src/constants/text-constants.ts
  • apps/web/src/lib/video-cache.ts
  • apps/web/src/components/ui/font-picker.tsx
  • apps/web/src/components/editor/layout-guide-overlay.tsx
  • apps/web/src/components/ui/input-with-back.tsx
  • apps/web/src/components/editor/panel-preset-selector.tsx
  • apps/web/src/hooks/use-edge-auto-scroll.ts
  • apps/web/src/components/editor/timeline/timeline-marker.tsx
  • apps/web/src/components/theme-toggle.tsx
  • apps/web/src/app/api/get-upload-url/route.ts
  • apps/web/src/stores/text-properties-store.ts
  • apps/web/src/hooks/use-sound-search.ts
  • apps/web/src/components/ui/editable-timecode.tsx
  • apps/web/src/components/ui/input.tsx
  • apps/web/src/components/icons.tsx
  • apps/web/src/components/keyboard-shortcuts-help.tsx
  • apps/web/src/components/language-select.tsx
  • apps/web/src/components/editor/panel-base-view.tsx
  • apps/web/src/hooks/use-highlight-scroll.ts
  • apps/web/src/components/ui/tooltip.tsx
  • apps/web/src/stores/sounds-store.ts
**/*.{tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)

**/*.{tsx,jsx}: Always include a title element for icons unless there's text beside the icon
Always include a type attribute for button elements
Accompany onClick with at least one of: onKeyUp, onKeyDown, or onKeyPress
Accompany onMouseOver/onMouseOut with onFocus/onBlur
Don't import React itself
Don't define React components inside other components
Don't use both children and dangerouslySetInnerHTML on the same element
Don't insert comments as text nodes
Use <>...</> instead of ...

Files:

  • apps/web/src/components/editor/export-button.tsx
  • apps/web/src/components/editor/media-panel/views/captions.tsx
  • apps/web/src/components/footer.tsx
  • apps/web/src/components/editor/media-panel/tabbar.tsx
  • apps/web/src/components/ui/split-button.tsx
  • apps/web/src/components/ui/font-picker.tsx
  • apps/web/src/components/editor/layout-guide-overlay.tsx
  • apps/web/src/components/ui/input-with-back.tsx
  • apps/web/src/components/editor/panel-preset-selector.tsx
  • apps/web/src/components/editor/timeline/timeline-marker.tsx
  • apps/web/src/components/theme-toggle.tsx
  • apps/web/src/components/ui/editable-timecode.tsx
  • apps/web/src/components/ui/input.tsx
  • apps/web/src/components/icons.tsx
  • apps/web/src/components/keyboard-shortcuts-help.tsx
  • apps/web/src/components/language-select.tsx
  • apps/web/src/components/editor/panel-base-view.tsx
  • apps/web/src/components/ui/tooltip.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)

**/*.{ts,tsx,js,jsx}: Don't use the comma operator
Use for...of statements instead of Array.forEach
Don't initialize variables to undefined
Use .flatMap() instead of map().flat() when possible
Don't assign a value to itself
Avoid unused imports and variables
Don't use await inside loops
Don't hardcode sensitive data like API keys and tokens
Don't use the delete operator
Don't use global eval()
Use String.slice() instead of String.substr() and String.substring()
Don't use else blocks when the if block breaks early
Put default function parameters and optional function parameters last
Use new when throwing an error
Use String.trimStart() and String.trimEnd() over String.trimLeft() and String.trimRight()

Files:

  • apps/web/src/components/editor/export-button.tsx
  • apps/web/src/components/editor/media-panel/views/captions.tsx
  • apps/web/src/types/sounds.ts
  • apps/web/src/components/footer.tsx
  • apps/web/src/lib/transcription-utils.ts
  • apps/web/src/components/editor/media-panel/tabbar.tsx
  • apps/web/src/app/api/waitlist/export/route.ts
  • apps/web/src/types/media.ts
  • apps/web/src/stores/playback-store.ts
  • apps/web/src/app/api/sounds/search/route.ts
  • apps/web/src/lib/editor-utils.ts
  • apps/web/src/app/api/transcribe/route.ts
  • apps/web/src/stores/keybindings-store.ts
  • apps/web/src/lib/export.ts
  • apps/web/src/hooks/use-infinite-scroll.ts
  • apps/web/src/components/ui/split-button.tsx
  • apps/web/src/lib/schemas/waitlist.ts
  • apps/web/src/lib/zk-encryption.ts
  • apps/web/src/constants/text-constants.ts
  • apps/web/src/lib/video-cache.ts
  • apps/web/src/components/ui/font-picker.tsx
  • apps/web/src/components/editor/layout-guide-overlay.tsx
  • apps/web/src/components/ui/input-with-back.tsx
  • apps/web/src/components/editor/panel-preset-selector.tsx
  • apps/web/src/hooks/use-edge-auto-scroll.ts
  • apps/web/src/components/editor/timeline/timeline-marker.tsx
  • apps/web/src/components/theme-toggle.tsx
  • apps/web/src/app/api/get-upload-url/route.ts
  • apps/web/src/stores/text-properties-store.ts
  • apps/web/src/hooks/use-sound-search.ts
  • apps/web/src/components/ui/editable-timecode.tsx
  • apps/web/src/components/ui/input.tsx
  • apps/web/src/components/icons.tsx
  • apps/web/src/components/keyboard-shortcuts-help.tsx
  • apps/web/src/components/language-select.tsx
  • apps/web/src/components/editor/panel-base-view.tsx
  • apps/web/src/hooks/use-highlight-scroll.ts
  • apps/web/src/components/ui/tooltip.tsx
  • apps/web/src/stores/sounds-store.ts
🧠 Learnings (1)
📚 Learning: 2025-08-09T09:03:49.797Z
Learnt from: CR
PR: OpenCut-app/OpenCut#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-09T09:03:49.797Z
Learning: Applies to **/*.{jsx,tsx} : Include caption tracks for audio and video elements.

Applied to files:

  • apps/web/src/components/editor/media-panel/views/captions.tsx
🧬 Code graph analysis (21)
apps/web/src/lib/transcription-utils.ts (1)
apps/web/src/env.ts (1)
  • env (7-45)
apps/web/src/components/editor/media-panel/tabbar.tsx (1)
apps/web/src/lib/utils.ts (1)
  • cn (6-8)
apps/web/src/app/api/waitlist/export/route.ts (4)
apps/web/src/lib/schemas/waitlist.ts (2)
  • exportWaitlistSchema (3-5)
  • exportWaitlistResponseSchema (7-10)
apps/web/src/lib/rate-limit.ts (1)
  • baseRateLimit (11-16)
packages/db/src/index.ts (2)
  • db (20-20)
  • eq (27-27)
packages/db/src/schema.ts (1)
  • exportWaitlist (61-70)
apps/web/src/stores/playback-store.ts (1)
apps/web/src/stores/project-store.ts (1)
  • DEFAULT_FPS (12-12)
apps/web/src/app/api/sounds/search/route.ts (2)
apps/web/src/lib/rate-limit.ts (1)
  • baseRateLimit (11-16)
apps/web/src/env.ts (1)
  • env (7-45)
apps/web/src/lib/editor-utils.ts (1)
apps/web/src/types/editor.ts (1)
  • CanvasSize (5-8)
apps/web/src/app/api/transcribe/route.ts (4)
apps/web/src/app/api/get-upload-url/route.ts (1)
  • POST (22-128)
apps/web/src/lib/rate-limit.ts (1)
  • baseRateLimit (11-16)
apps/web/src/lib/transcription-utils.ts (1)
  • isTranscriptionConfigured (3-13)
apps/web/src/env.ts (1)
  • env (7-45)
apps/web/src/components/ui/split-button.tsx (2)
apps/web/src/components/ui/button.tsx (2)
  • ButtonProps (41-45)
  • Button (61-61)
apps/web/src/lib/utils.ts (1)
  • cn (6-8)
apps/web/src/constants/text-constants.ts (2)
apps/web/src/types/timeline.ts (1)
  • TextElement (25-40)
apps/web/src/constants/timeline-constants.ts (1)
  • TIMELINE_CONSTANTS (72-79)
apps/web/src/components/ui/font-picker.tsx (1)
apps/web/src/components/ui/select.tsx (1)
  • SelectTrigger (171-171)
apps/web/src/components/editor/layout-guide-overlay.tsx (1)
apps/web/src/stores/editor-store.ts (1)
  • useEditorStore (39-91)
apps/web/src/components/editor/panel-preset-selector.tsx (1)
apps/web/src/stores/panel-store.ts (2)
  • PanelPreset (4-8)
  • usePanelStore (68-225)
apps/web/src/components/editor/timeline/timeline-marker.tsx (2)
apps/web/src/lib/utils.ts (1)
  • cn (6-8)
apps/web/src/constants/timeline-constants.ts (1)
  • TIMELINE_CONSTANTS (72-79)
apps/web/src/app/api/get-upload-url/route.ts (3)
apps/web/src/lib/rate-limit.ts (1)
  • baseRateLimit (11-16)
apps/web/src/lib/transcription-utils.ts (1)
  • isTranscriptionConfigured (3-13)
apps/web/src/env.ts (1)
  • env (7-45)
apps/web/src/hooks/use-sound-search.ts (1)
apps/web/src/stores/sounds-store.ts (1)
  • useSoundsStore (74-282)
apps/web/src/components/ui/editable-timecode.tsx (3)
apps/web/src/lib/time.ts (3)
  • TimeCode (5-5)
  • formatTimeCode (8-29)
  • parseTimeCode (31-122)
apps/web/src/stores/project-store.ts (1)
  • DEFAULT_FPS (12-12)
apps/web/src/lib/utils.ts (1)
  • cn (6-8)
apps/web/src/components/ui/input.tsx (1)
apps/web/src/lib/utils.ts (1)
  • cn (6-8)
apps/web/src/components/keyboard-shortcuts-help.tsx (1)
apps/web/src/hooks/use-keyboard-shortcuts-help.ts (1)
  • KeyboardShortcut (8-15)
apps/web/src/components/language-select.tsx (2)
apps/web/src/components/editor/media-panel/views/captions.tsx (1)
  • languages (21-31)
apps/web/src/lib/utils.ts (1)
  • cn (6-8)
apps/web/src/components/editor/panel-base-view.tsx (1)
apps/web/src/lib/utils.ts (1)
  • cn (6-8)
apps/web/src/stores/sounds-store.ts (4)
apps/web/src/types/sounds.ts (2)
  • SoundEffect (1-22)
  • SavedSound (24-34)
apps/web/src/lib/storage/storage-service.ts (4)
  • storageService (479-479)
  • isSoundSaved (445-453)
  • removeSavedSound (429-443)
  • saveSoundEffect (392-427)
apps/web/src/stores/timeline-store.ts (1)
  • useTimelineStore (253-1853)
apps/web/src/stores/playback-store.ts (1)
  • usePlaybackStore (77-176)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Vercel Agent Review
🔇 Additional comments (9)
apps/web/src/lib/video-cache.ts (1)

15-186: Well-structured video frame caching implementation.

The cache design effectively handles the complexity of video frame access:

  • Promise deduplication prevents redundant sink initialization
  • Seek-ahead optimization (lines 36-44) efficiently handles forward scrubbing within a 2-second window
  • Graceful fallback to full seeks when iteration fails
  • Stats tracking provides useful observability
apps/web/src/components/ui/split-button.tsx (1)

1-90: LGTM!

The formatting changes improve code organization while preserving all functionality. No behavioral changes detected.

apps/web/src/components/ui/font-picker.tsx (1)

23-25: LGTM!

The formatting change improves readability without affecting functionality.

apps/web/src/components/ui/editable-timecode.tsx (1)

1-138: LGTM!

The formatting refactor improves code structure while maintaining all existing functionality and behavior.

apps/web/src/components/ui/input-with-back.tsx (1)

1-88: LGTM!

The formatting refactor maintains all functionality while improving code organization.

apps/web/src/app/api/sounds/search/route.ts (1)

50-51: LGTM - Good validation improvement!

Adding .url() validation for the next and previous pagination fields is a positive change that ensures stricter type safety and data integrity for the Freesound API response.

apps/web/src/app/api/get-upload-url/route.ts (1)

1-128: LGTM!

The formatting refactor maintains all functionality including rate limiting, validation, R2 client initialization, presigned URL generation, and error handling.

apps/web/src/hooks/use-edge-auto-scroll.ts (1)

1-101: LGTM!

The edge auto-scroll implementation is correct. The hook properly manages the animation frame lifecycle, calculates scroll speeds based on edge proximity, and includes all necessary dependencies.

apps/web/src/components/editor/timeline/timeline-marker.tsx (1)

1-67: LGTM!

The timeline marker component is correctly implemented with proper time formatting logic that adapts display format based on the time scale.

Comment on lines +55 to +58
const ip = request.headers.get("x-forwarded-for") ?? "anonymous";
const { success } = await baseRateLimit.limit(ip);
const origin = request.headers.get("origin");

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Remove unused origin declaration

Line 57 defines const origin = … but the value is never used. With our TypeScript/ESLint settings (noUnusedLocals) this will fail builds. Please drop the declaration or use the value.

-    const { success } = await baseRateLimit.limit(ip);
-    const origin = request.headers.get("origin");
+    const { success } = await baseRateLimit.limit(ip);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const ip = request.headers.get("x-forwarded-for") ?? "anonymous";
const { success } = await baseRateLimit.limit(ip);
const origin = request.headers.get("origin");
const ip = request.headers.get("x-forwarded-for") ?? "anonymous";
const { success } = await baseRateLimit.limit(ip);
🤖 Prompt for AI Agents
In apps/web/src/app/api/transcribe/route.ts around lines 55 to 58, there is an
unused variable declaration "const origin = request.headers.get(\"origin\");"
which will break builds under noUnusedLocals; remove that declaration (or use it
where needed). Edit the file to delete the origin line (or reference origin in
subsequent logic if intended), ensuring no other references are left dangling
and the code compiles.

Comment on lines 88 to 105
function FadeOverlay({
direction,
show,
}: {
direction: "top" | "bottom";
show: boolean;
}) {
return (
<div
<div
className={cn(
"absolute left-0 right-0 h-6 pointer-events-none z-[101] transition-opacity duration-200",
direction === "top" && show
? "top-0 bg-gradient-to-b from-panel to-transparent"
? "top-0 bg-gradient-to-b from-panel to-transparent"
: "bottom-0 bg-gradient-to-t from-panel to-transparent"
)}
/>
);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Fix the visibility logic in FadeOverlay.

The conditional class logic is incorrect and will cause visibility issues:

  1. When direction="top" and show=false, it applies bottom positioning and gradient (wrong).
  2. When show=false for either direction, the overlay remains visible because no opacity class is applied.
  3. The component has transition-opacity but never toggles between opacity-0 and opacity-100.

Apply this diff to fix the visibility logic:

 function FadeOverlay({
   direction,
   show,
 }: {
   direction: "top" | "bottom";
   show: boolean;
 }) {
   return (
     <div
       className={cn(
         "absolute left-0 right-0 h-6 pointer-events-none z-[101] transition-opacity duration-200",
-        direction === "top" && show
-          ? "top-0 bg-gradient-to-b from-panel to-transparent"
-          : "bottom-0 bg-gradient-to-t from-panel to-transparent"
+        !show && "opacity-0",
+        direction === "top" && "top-0 bg-gradient-to-b from-panel to-transparent",
+        direction === "bottom" && "bottom-0 bg-gradient-to-t from-panel to-transparent"
       )}
     />
   );
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function FadeOverlay({
direction,
show,
}: {
direction: "top" | "bottom";
show: boolean;
}) {
return (
<div
<div
className={cn(
"absolute left-0 right-0 h-6 pointer-events-none z-[101] transition-opacity duration-200",
direction === "top" && show
? "top-0 bg-gradient-to-b from-panel to-transparent"
? "top-0 bg-gradient-to-b from-panel to-transparent"
: "bottom-0 bg-gradient-to-t from-panel to-transparent"
)}
/>
);
}
\ No newline at end of file
}
function FadeOverlay({
direction,
show,
}: {
direction: "top" | "bottom";
show: boolean;
}) {
return (
<div
className={cn(
"absolute left-0 right-0 h-6 pointer-events-none z-[101] transition-opacity duration-200",
!show && "opacity-0",
direction === "top" && "top-0 bg-gradient-to-b from-panel to-transparent",
direction === "bottom" && "bottom-0 bg-gradient-to-t from-panel to-transparent"
)}
/>
);
}
🤖 Prompt for AI Agents
In apps/web/src/components/editor/media-panel/tabbar.tsx around lines 88 to 105,
the FadeOverlay currently mixes direction and visibility logic causing wrong
positioning and always-visible overlay; separate the direction-based
positioning/gradient (apply top-0 + bg-gradient-to-b when direction === "top",
else bottom-0 + bg-gradient-to-t) and add opacity classes based on show (use
"opacity-100" when show is true and "opacity-0" when false) so the component
keeps transition-opacity but toggles visibility correctly.

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/web/src/components/keyboard-shortcuts-help.tsx (1)

96-105: Add missing dependencies to useEffect.

The effect reads isAdding (line 69) and calls setIsAdding (lines 78, 86), but neither appears in the dependency array. This violates the exhaustive-deps rule and can lead to stale closures.

Apply this diff to include the missing dependencies:

   }, [
     recordingShortcut,
     getKeybindingString,
     updateKeybinding,
     removeKeybinding,
     validateKeybinding,
     getKeybindingsForAction,
     setIsRecording,
     isRecording,
+    isAdding,
+    setIsAdding,
   ]);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f121bb4 and 4658263.

📒 Files selected for processing (1)
  • apps/web/src/components/keyboard-shortcuts-help.tsx (8 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{jsx,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{jsx,tsx}: Don't use accessKey attribute on any HTML element.
Don't set aria-hidden="true" on focusable elements.
Don't add ARIA roles, states, and properties to elements that don't support them.
Don't use distracting elements like <marquee> or <blink>.
Only use the scope prop on <th> elements.
Don't assign non-interactive ARIA roles to interactive HTML elements.
Make sure label elements have text content and are associated with an input.
Don't assign interactive ARIA roles to non-interactive HTML elements.
Don't assign tabIndex to non-interactive HTML elements.
Don't use positive integers for tabIndex property.
Don't include "image", "picture", or "photo" in img alt prop.
Don't use explicit role property that's the same as the implicit/default role.
Make static elements with click handlers use a valid role attribute.
Always include a title element for SVG elements.
Give all elements requiring alt text meaningful information for screen readers.
Make sure anchors have content that's accessible to screen readers.
Assign tabIndex to non-interactive HTML elements with aria-activedescendant.
Include all required ARIA attributes for elements with ARIA roles.
Make sure ARIA properties are valid for the element's supported roles.
Always include a type attribute for button elements.
Make elements with interactive roles and handlers focusable.
Give heading elements content that's accessible to screen readers (not hidden with aria-hidden).
Always include a lang attribute on the html element.
Always include a title attribute for iframe elements.
Accompany onClick with at least one of: onKeyUp, onKeyDown, or onKeyPress.
Accompany onMouseOver/onMouseOut with onFocus/onBlur.
Include caption tracks for audio and video elements.
Use semantic elements instead of role attributes in JSX.
Make sure all anchors are valid and navigable.
Ensure all ARIA properties (aria-*) are valid.
Use valid, non-abstract ARIA roles for elements with...

Files:

  • apps/web/src/components/keyboard-shortcuts-help.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Don't use TypeScript enums.
Don't export imported variables.
Don't add type annotations to variables, parameters, and class properties that are initialized with literal expressions.
Don't use TypeScript namespaces.
Don't use non-null assertions with the ! postfix operator.
Don't use parameter properties in class constructors.
Don't use user-defined types.
Use as const instead of literal types and type annotations.
Use either T[] or Array<T> consistently.
Initialize each enum member value explicitly.
Use export type for types.
Use import type for types.
Make sure all enum members are literal values.
Don't use TypeScript const enum.
Don't declare empty interfaces.
Don't let variables evolve into any type through reassignments.
Don't use the any type.
Don't misuse the non-null assertion operator (!) in TypeScript files.
Don't use implicit any type on variable declarations.
Don't merge interfaces and classes unsafely.
Don't use overload signatures that aren't next to each other.
Use the namespace keyword instead of the module keyword to declare TypeScript namespaces.
Don't use empty type parameters in type aliases and interfaces.
Don't use any or unknown as type constraints.
Don't use the TypeScript directive @ts-ignore.
Use consistent accessibility modifiers on class properties and methods.
Use function types instead of object types with call signatures.
Don't use void type outside of generic or return types.

**/*.{ts,tsx}: Don't use primitive type aliases or misleading types
Don't use the TypeScript directive @ts-ignore
Don't use TypeScript enums
Use either T[] or Array consistently
Don't use the any type

Files:

  • apps/web/src/components/keyboard-shortcuts-help.tsx
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{js,jsx,ts,tsx}: Don't use the return value of React.render.
Don't use consecutive spaces in regular expression literals.
Don't use the arguments object.
Don't use primitive type aliases or misleading types.
Don't use the comma operator.
Don't write functions that exceed a given Cognitive Complexity score.
Don't use unnecessary boolean casts.
Don't use unnecessary callbacks with flatMap.
Use for...of statements instead of Array.forEach.
Don't create classes that only have static members (like a static namespace).
Don't use this and super in static contexts.
Don't use unnecessary catch clauses.
Don't use unnecessary constructors.
Don't use unnecessary continue statements.
Don't export empty modules that don't change anything.
Don't use unnecessary escape sequences in regular expression literals.
Don't use unnecessary labels.
Don't use unnecessary nested block statements.
Don't rename imports, exports, and destructured assignments to the same name.
Don't use unnecessary string or template literal concatenation.
Don't use String.raw in template literals when there are no escape sequences.
Don't use useless case statements in switch statements.
Don't use ternary operators when simpler alternatives exist.
Don't use useless this aliasing.
Don't initialize variables to undefined.
Don't use the void operators (they're not familiar).
Use arrow functions instead of function expressions.
Use Date.now() to get milliseconds since the Unix Epoch.
Use .flatMap() instead of map().flat() when possible.
Use literal property access instead of computed property access.
Don't use parseInt() or Number.parseInt() when binary, octal, or hexadecimal literals work.
Use concise optional chaining instead of chained logical expressions.
Use regular expression literals instead of the RegExp constructor when possible.
Don't use number literal object member names that aren't base 10 or use underscore separators.
Remove redundant terms from logical expressions.
Use while loops instead of...

Files:

  • apps/web/src/components/keyboard-shortcuts-help.tsx
**/*.{tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)

**/*.{tsx,jsx}: Always include a title element for icons unless there's text beside the icon
Always include a type attribute for button elements
Accompany onClick with at least one of: onKeyUp, onKeyDown, or onKeyPress
Accompany onMouseOver/onMouseOut with onFocus/onBlur
Don't import React itself
Don't define React components inside other components
Don't use both children and dangerouslySetInnerHTML on the same element
Don't insert comments as text nodes
Use <>...</> instead of ...

Files:

  • apps/web/src/components/keyboard-shortcuts-help.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)

**/*.{ts,tsx,js,jsx}: Don't use the comma operator
Use for...of statements instead of Array.forEach
Don't initialize variables to undefined
Use .flatMap() instead of map().flat() when possible
Don't assign a value to itself
Avoid unused imports and variables
Don't use await inside loops
Don't hardcode sensitive data like API keys and tokens
Don't use the delete operator
Don't use global eval()
Use String.slice() instead of String.substr() and String.substring()
Don't use else blocks when the if block breaks early
Put default function parameters and optional function parameters last
Use new when throwing an error
Use String.trimStart() and String.trimEnd() over String.trimLeft() and String.trimRight()

Files:

  • apps/web/src/components/keyboard-shortcuts-help.tsx
🧠 Learnings (2)
📚 Learning: 2025-08-09T09:03:49.797Z
Learnt from: CR
PR: OpenCut-app/OpenCut#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-09T09:03:49.797Z
Learning: Applies to **/*.{jsx,tsx} : Always include a `type` attribute for button elements.

Applied to files:

  • apps/web/src/components/keyboard-shortcuts-help.tsx
📚 Learning: 2025-08-15T00:50:09.126Z
Learnt from: CR
PR: OpenCut-app/OpenCut#0
File: .cursor/rules/ultracite.mdc:0-0
Timestamp: 2025-08-15T00:50:09.126Z
Learning: Applies to **/*.{tsx,jsx} : Always include a type attribute for button elements

Applied to files:

  • apps/web/src/components/keyboard-shortcuts-help.tsx
🧬 Code graph analysis (1)
apps/web/src/components/keyboard-shortcuts-help.tsx (1)
apps/web/src/hooks/use-keyboard-shortcuts-help.ts (1)
  • KeyboardShortcut (8-15)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Vercel Agent Review
🔇 Additional comments (2)
apps/web/src/components/keyboard-shortcuts-help.tsx (2)

68-72: LGTM!

The conditional logic correctly preserves existing shortcuts when isAdding is true, implementing the core feature of this PR.


113-115: LGTM!

The onAdding callback is correctly propagated through the component hierarchy, enabling the "add shortcut" feature throughout the UI.

Also applies to: 155-155, 177-177, 182-182, 225-229

Comment on lines +284 to +292
<button
type="button"
onClick={handleClick}
title={
isRecording ? "Press any key combination..." : "Click to add shortcut"
}
>
<Plus className="px-1 min-w-6 hover:stroke-[#cecececc]" />
</button>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Add keyboard handler and icon title for accessibility.

The button violates two accessibility guidelines:

  1. Per coding guidelines, buttons with onClick must be accompanied by at least one of onKeyUp, onKeyDown, or onKeyPress.
  2. The Plus icon should include a <title> element for screen readers.

As per coding guidelines

Apply this diff to add keyboard support:

   return (
     <button
       type="button"
       onClick={handleClick}
+      onKeyDown={(e) => {
+        if (e.key === 'Enter' || e.key === ' ') {
+          handleClick(e as any);
+        }
+      }}
       title={
         isRecording ? "Press any key combination..." : "Click to add shortcut"
       }
     >
-      <Plus className="px-1 min-w-6 hover:stroke-[#cecececc]" />
+      <Plus className="px-1 min-w-6 hover:stroke-[#cecececc]">
+        <title>Add shortcut</title>
+      </Plus>
     </button>
   );
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<button
type="button"
onClick={handleClick}
title={
isRecording ? "Press any key combination..." : "Click to add shortcut"
}
>
<Plus className="px-1 min-w-6 hover:stroke-[#cecececc]" />
</button>
<button
type="button"
onClick={handleClick}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
handleClick(e as any);
}
}}
title={
isRecording ? "Press any key combination..." : "Click to add shortcut"
}
>
<Plus className="px-1 min-w-6 hover:stroke-[#cecececc]">
<title>Add shortcut</title>
</Plus>
</button>
🤖 Prompt for AI Agents
In apps/web/src/components/keyboard-shortcuts-help.tsx around lines 284-292, the
<button> currently only has onClick and the Plus icon lacks an accessible title;
add keyboard support and an accessible icon title by implementing an onKeyDown
(or onKeyUp) handler that listens for Enter and Space and calls the same logic
as handleClick (preventDefault where appropriate) and attach it to the button
alongside onClick, and update the Plus SVG component usage to include a title
(or pass a title prop so the SVG renders a <title> element) describing the
action (e.g., "Add shortcut") so screen readers can announce the icon.

}

// Remove old keybindings for this action
const oldKeys = getKeybindingsForAction(recordingShortcut.action);
Copy link

Choose a reason for hiding this comment

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

The isAdding state is not reset when a keybinding conflict occurs, leaving the system in an inconsistent state for subsequent shortcut operations.

View Details
📝 Patch Details
diff --git a/apps/web/src/components/keyboard-shortcuts-help.tsx b/apps/web/src/components/keyboard-shortcuts-help.tsx
index 07bac6a..62d559e 100644
--- a/apps/web/src/components/keyboard-shortcuts-help.tsx
+++ b/apps/web/src/components/keyboard-shortcuts-help.tsx
@@ -61,6 +61,8 @@ export function KeyboardShortcutsHelp() {
             `Key "${keyString}" is already bound to "${conflict.existingAction}"`
           );
           setRecordingShortcut(null);
+          setIsRecording(false);
+          setIsAdding(false);
           return;
         }
 

Analysis

State inconsistency in keyboard shortcuts conflict handling

What fails: KeyboardShortcutsHelp component conflict handler at line 63 doesn't reset isRecording and isAdding states, leaving component in inconsistent state after keybinding conflicts

How to reproduce:

  1. Click '+' button to add new keyboard shortcut (sets isAdding=true, isRecording=true)
  2. Press key combination that conflicts with existing shortcut (e.g. 'Ctrl+S' if already bound)
  3. Component shows error toast and calls setRecordingShortcut(null) but exits early without resetting isRecording and isAdding flags

Result: isAdding and isRecording remain true after conflict, causing state inconsistency for subsequent shortcut operations. Success path (lines 77-79) and click-outside handler (lines 84-87) properly reset all three states.

Expected: All state flags should be reset consistently across all exit paths, matching the behavior of success and click-outside handlers

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