Skip to content

Conversation

@ameer2468
Copy link
Contributor

@ameer2468 ameer2468 commented Aug 25, 2025

This PR:

  • Adds new shortcuts to editor for Zoom in, zoom out, split crop, and opening the aspect ratio dialog.
  • Adjusts color of adding new layout segment.

Preview:

Screenshot 2025-08-25 at 13 28 12

Summary by CodeRabbit

  • New Features

    • OS-aware keyboard shortcut hints in tooltips.
    • New shortcuts: A opens Aspect Ratio, S toggles Split mode, Cmd/Ctrl + +/- zooms, C opens Crop.
  • Improvements

    • Tooltips on editor controls now show shortcut hints.
    • Crop dialog initializes with smarter defaults for size/position.
    • Keyboard-driven open/close for Aspect Ratio selector and global shortcut support.
  • Style

    • Export dialog dark-mode contrast and custom scrolling improved.
    • Timeline hover gradient updated to purple; button/tooltip spacing and borders refined.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 25, 2025

Warning

Rate limit exceeded

@ameer2468 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 0 minutes and 35 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 6773e0b and a744578.

📒 Files selected for processing (3)
  • apps/desktop/src/components/Tooltip.tsx (1 hunks)
  • apps/desktop/src/routes/editor/Player.tsx (7 hunks)
  • apps/desktop/src/routes/editor/useEditorShortcuts.ts (1 hunks)

Walkthrough

Adds OS-aware keyboard shortcut hints to Tooltip and surfaces kbd?: string[] through EditorButton and editor UI; introduces global keyboard listeners for several editor actions; updates dark-mode theming and minor visual tweaks (export dialog, timeline gradient, button variant).

Changes

Cohort / File(s) Summary
Tooltip (OS-aware kbd hints)
apps/desktop/src/components/Tooltip.tsx
Adds kbd?: string[] prop, detects OS via ostype(), maps keys to OS-specific symbols (⌘/ctrl, ⌥/⎇, ⇧), and renders <kbd> hints alongside tooltip content with updated flex layout and spacing.
Editor controls & keyboard handlers
apps/desktop/src/routes/editor/AspectRatioSelect.tsx, apps/desktop/src/routes/editor/Player.tsx, apps/desktop/src/routes/editor/ui.tsx
AspectRatioSelect: controlled open state, global KeyA listener, Tooltip with kbd. Player: global shortcuts (S, Ctrl/Cmd +/-, C), centralized cropDialogHandler, updated tooltip kbd hints. ui.tsx: EditorButtonProps gains kbd?: string[] and forwards it to Tooltip.
Export dialog theming
apps/desktop/src/routes/editor/ExportDialog.tsx
Dark-mode color/token updates for icons, panels, and KSelect; adds dark:bg-* classes and custom-scroll for listbox; purely presentational.
Timeline visual tweak
apps/desktop/src/routes/editor/Timeline/LayoutTrack.tsx
Changes hover-time SegmentContent gradient from blue to purple; no logic changes.
UI Button variant update
packages/ui-solid/src/Button.tsx
Secondary variant updated to bg-gray-5 with dark:bg-gray-4 for dark-mode consistency; other classes unchanged.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Tooltip as Tooltip
  participant OS as ostype()
  participant UI as Renderer

  User->>Tooltip: Hover/Focus
  Tooltip->>OS: ostype()
  OS-->>Tooltip: os string
  Tooltip->>Tooltip: map kbd[] → symbols (⌘/ctrl, ⌥/⎇, ⇧)
  Tooltip->>UI: render content + <kbd> hints
  UI-->>User: Tooltip shown
Loading
sequenceDiagram
  autonumber
  actor User
  participant Document as document
  participant Aspect as AspectRatioSelect
  participant Player as Player
  participant Transform as TransformController

  User->>Document: press "A"
  Document->>Aspect: toggle open

  User->>Document: press "S"
  Document->>Player: toggle split/seek

  User->>Document: press "Ctrl/Cmd" "+" or "-"
  Document->>Player: zoom shortcut
  Player->>Transform: updateZoom(...)

  User->>Document: press "C"
  Document->>Player: invoke cropDialogHandler
  Player->>Transform: derive crop rect & open dialog
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

codex

Suggested reviewers

  • Brendonovich

Poem

A hop, a tap—now tooltips sing,
With ⌘ and ⇧ upon a spring.
Split and zoom, a nimble dance,
Press C to crop, give pixels a chance.
Dark-mode glows in purple light—🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch editor-shortcuts

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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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: 2

🧹 Nitpick comments (9)
apps/desktop/src/routes/editor/Timeline/LayoutTrack.tsx (1)

472-476: Purple hover gradient looks good; consider aligning ring color and tokens

The new hover-time SegmentContent gradient reads well. Minor consistency nit:

  • This overlay uses a purple gradient while SegmentRoot’s inner ring still uses blue (“ring-blue-300” above, and “ring-blue-5” in the main segment at Line 293). Consider switching the ring to a neutral token (e.g., ring-gray-5) or a purple token to avoid mixed accent cues. Also consider replacing raw hexes with design tokens for easier theming.

Example tweak:

- innerClass="ring-blue-300"
+ innerClass="ring-gray-5"  # or a purple token if available
packages/ui-solid/src/Button.tsx (1)

17-17: Secondary hover state is visually identical to base; adjust hover color

Secondary variant sets base bg to gray-5 and hover to gray-5 as well. On light mode this yields no visual feedback. Recommend a slight delta for hover, and aligning text token with the rest of the app (many places use text-gray-12/11 over numeric -500).

- "dark:bg-gray-4 bg-gray-5 enabled:hover:bg-gray-5 text-gray-500 disabled:bg-gray-6 disabled:text-gray-9 outline-blue-300 disabled:outline-blue-10",
+ "dark:bg-gray-4 bg-gray-5 enabled:hover:bg-gray-6 dark:enabled:hover:bg-gray-5 text-gray-12 disabled:bg-gray-6 disabled:text-gray-9 outline-blue-300 disabled:outline-blue-10",
apps/desktop/src/routes/editor/ExportDialog.tsx (2)

477-499: Deduplicate repeated panel container classes

Multiple panels repeat “p-4 rounded-xl dark:bg-gray-2 bg-gray-3”. Consider extracting a reusable panel class or a small component to ensure consistency and simplify future theme adjustments.

Example:

+ const panelClass = "p-4 rounded-xl dark:bg-gray-2 bg-gray-3";
...
- <div class="flex-1 p-4 rounded-xl dark:bg-gray-2 bg-gray-3">
+ <div class={cx("flex-1", panelClass)}>

Also applies to: 500-553, 556-616, 618-644, 646-678


588-602: KSelect trigger theming: check foreground tokens

Trigger bg uses dark:bg-gray-3 bg-gray-4, but Value/Icon still use text-[--gray-500]. If the rest of the dialog standardizes on numeric tokens (text-gray-12/11), consider switching for consistency or ensure --gray-500 maps correctly in both themes.

- class="flex-1 text-sm text-left truncate tabular-nums text-[--gray-500]"
+ class="flex-1 text-sm text-left truncate tabular-nums text-gray-12"
apps/desktop/src/routes/editor/AspectRatioSelect.tsx (3)

20-25: Global “A” shortcut: solid guard; consider meta key to avoid accidental toggles

Listening for KeyA on document and gating on e.target === document.body avoids conflicts with inputs. Consider also requiring a modifier (e.g., Alt/Shift) or providing a user setting to reduce accidental opens while navigating.

- if (e.code === "KeyA" && e.target === document.body) {
+ if (e.code === "KeyA" && e.target === document.body && (e.altKey || e.shiftKey)) {

19-19: Unused ref variable: remove or use

triggerSelect is defined and passed to ref, but never read. If you don’t programmatically focus/position the trigger, drop it to avoid linter noise. If you plan to focus on open, wire it up.

- let triggerSelect: HTMLDivElement | undefined;
...
- ref={triggerSelect}
+ // remove both lines if not used

Also applies to: 32-32


29-37: Controlled KSelect: defaultValue is redundant

You’re driving the component with open/value/onOpenChange/onChange. defaultValue is unnecessary (and in some libraries can cause controlled/uncontrolled warnings). Remove it.

- defaultValue="auto"

Also applies to: 38-38

apps/desktop/src/routes/editor/Player.tsx (2)

148-159: Consolidate global keydown listeners and relax the target check

You’re attaching four document-level listeners with a strict e.target === document.body check. This breaks shortcuts when focus is on non-body focusables (canvas, buttons) and scatters logic. Prefer a single handler, ignore inputs/contentEditable, and switch on code/modifiers.

-//split shortcut
-createEventListener(document, "keydown", (e: KeyboardEvent) => {
-  if (e.code === "KeyS" && e.target === document.body) {
-    e.preventDefault();
-    setEditorState(
-      "timeline",
-      "interactMode",
-      editorState.timeline.interactMode === "split" ? "seek" : "split",
-    );
-  }
-});
-
-//zoom-in shortct
-createEventListener(document, "keydown", (e: KeyboardEvent) => {
-  if (
-    (e.metaKey || e.ctrlKey) &&
-    e.code === "Equal" &&
-    e.target === document.body
-  ) {
-    e.preventDefault();
-    editorState.timeline.transform.updateZoom(
-      editorState.timeline.transform.zoom / 1.1,
-      editorState.playbackTime,
-    );
-  }
-});
-
-//zoom-out shortcut
-createEventListener(document, "keydown", (e: KeyboardEvent) => {
-  if (
-    (e.metaKey || e.ctrlKey) &&
-    e.code === "Minus" &&
-    e.target === document.body
-  ) {
-    e.preventDefault();
-    editorState.timeline.transform.updateZoom(
-      editorState.timeline.transform.zoom * 1.1,
-      editorState.playbackTime,
-    );
-  }
-});
-
-//crop shortcut
-createEventListener(document, "keydown", async (e: KeyboardEvent) => {
-  if (e.code === "KeyC" && e.target === document.body) {
-    e.preventDefault();
-    cropDialogHandler();
-  }
-});
+// Global editor shortcuts
+createEventListener(document, "keydown", (e: KeyboardEvent) => {
+  const target = e.target as HTMLElement | null;
+  const tag = target?.tagName?.toLowerCase();
+  const editable =
+    target?.isContentEditable ||
+    tag === "input" ||
+    tag === "textarea" ||
+    tag === "select";
+  if (editable) return;
+
+  switch (true) {
+    // Toggle split mode (S)
+    case e.code === "KeyS":
+      e.preventDefault();
+      setEditorState(
+        "timeline",
+        "interactMode",
+        editorState.timeline.interactMode === "split" ? "seek" : "split",
+      );
+      return;
+    // Open crop dialog (C)
+    case e.code === "KeyC":
+      e.preventDefault();
+      cropDialogHandler();
+      return;
+    // Zoom in/out (Ctrl/Cmd + +/-)
+    case (e.metaKey || e.ctrlKey) && (e.code === "Equal" || e.code === "Minus"):
+      e.preventDefault();
+      const factor = e.code === "Equal" ? 1 / 1.1 : 1.1;
+      editorState.timeline.transform.updateZoom(
+        editorState.timeline.transform.zoom * factor,
+        editorState.playbackTime,
+      );
+      return;
+  }
+});

Note: if updateZoom doesn’t internally clamp, consider clamping to your zoomOutLimit() and a min zoom.

Please verify that Ctrl/Cmd + +/- doesn’t trigger WebView page zoom on Windows/macOS, especially on non-body focus states. If it does, we may need additional prevention at the app level.

Also applies to: 160-174, 175-189, 190-197


160-161: Nit: typo in comment

“shortct” → “shortcut”.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 7ddc965 and 143f4ba.

📒 Files selected for processing (7)
  • apps/desktop/src/components/Tooltip.tsx (1 hunks)
  • apps/desktop/src/routes/editor/AspectRatioSelect.tsx (2 hunks)
  • apps/desktop/src/routes/editor/ExportDialog.tsx (9 hunks)
  • apps/desktop/src/routes/editor/Player.tsx (7 hunks)
  • apps/desktop/src/routes/editor/Timeline/LayoutTrack.tsx (1 hunks)
  • apps/desktop/src/routes/editor/ui.tsx (3 hunks)
  • packages/ui-solid/src/Button.tsx (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (4)
apps/desktop/src/routes/editor/Timeline/LayoutTrack.tsx (1)
apps/desktop/src/routes/editor/Timeline/Track.tsx (1)
  • SegmentContent (89-101)
apps/desktop/src/routes/editor/ui.tsx (1)
apps/desktop/src/components/Tooltip.tsx (1)
  • Tooltip (23-47)
apps/desktop/src/routes/editor/Player.tsx (2)
apps/desktop/src/routes/editor/ui.tsx (1)
  • EditorButton (353-418)
apps/desktop/src/components/Tooltip.tsx (1)
  • Tooltip (23-47)
apps/desktop/src/routes/editor/AspectRatioSelect.tsx (4)
apps/desktop/src/components/Tooltip.tsx (1)
  • Tooltip (23-47)
apps/desktop/src/utils/tauri.ts (1)
  • AspectRatio (358-358)
apps/desktop/src/routes/editor/projectConfig.ts (1)
  • ASPECT_RATIOS (8-14)
apps/desktop/src/routes/editor/ui.tsx (5)
  • MenuItem (264-279)
  • EditorButton (353-418)
  • PopperContent (287-293)
  • topLeftAnimateClasses (423-424)
  • MenuItemList (295-309)
⏰ 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). (3)
  • GitHub Check: Build Desktop (x86_64-pc-windows-msvc, windows-latest)
  • GitHub Check: Build Desktop (aarch64-apple-darwin, macos-latest)
  • GitHub Check: Analyze (rust)
🔇 Additional comments (10)
apps/desktop/src/routes/editor/ExportDialog.tsx (2)

412-446: Icon/text color swap to text-gray-12 improves contrast — looks good

The switch to text-gray-12 and explicit icon classes for the stats row (camera duration, resolution, size, render ETA) increases readability across themes. No functional changes. LGTM.


609-611: Custom-scroll utility is defined for desktop and web—no fallback required

I’ve confirmed that the custom-scroll class is explicitly defined in your desktop styles and in your web globals, so it will be bundled correctly across all targets:

  • apps/desktop/src/styles/theme.css lines 151–157: defines .custom-scroll with overflow-y: scroll and custom scrollbar styling.
  • apps/web/globals.css lines 563–566: defines .custom-scroll with overflow-y: auto and matching scrollbar rules.

Since the utility exists in both codebases, there’s no need to fall back to overflow-y-auto. Feel free to merge as is.

apps/desktop/src/routes/editor/ui.tsx (3)

342-351: Public API: EditorButton now accepts kbd hints — good extension

Adding kbd?: string[] to EditorButtonProps is a clean way to propagate OS-aware shortcut hints. Typing looks correct and non-breaking for existing call sites.


388-392: Tooltip now shows keyboard hints on hover — UX improvement

Forwarding kbd to Tooltip works as intended and keeps the implementation localized to EditorButton. Nice.


356-369: splitProps extraction validated; no ref/kbd shadowing detected

I’ve audited all EditorButton usages (in AspectRatioSelect.tsx, Player.tsx, and PresetsDropdown.tsx) and confirmed:

  • None pass an explicit ref prop to <EditorButton>, so there’s no downstream collision or ambiguity with the internal ref extraction.
  • The kbd prop is only used via local.kbd and never forwarded in others, so it correctly drives the Tooltip UI without duplication.

No changes are needed for the current code paths.

Optional future improvement:
• If you ever intend to let consumers attach a ref to the underlying DOM node, forward it explicitly—e.g.:

-  <Polymorphic
-    as="button"
-    {...others}
+  <Polymorphic
+    as="button"
+    ref={local.ref}
+    {...others}
     class={…}
   >
apps/desktop/src/routes/editor/AspectRatioSelect.tsx (1)

72-82: Composition with EditorButton/Tooltip is clean; API usage looks correct

Wrapping Trigger in EditorButton and moving listbox into PopperContent/MenuItemList matches existing UI patterns. Value renderer handles “auto” vs named ratios correctly. Looks good.

Also applies to: 83-92, 94-103

apps/desktop/src/components/Tooltip.tsx (1)

12-22: Ignore async OS detection and macOS mapping concerns in Tooltip.tsx

The type() export from @tauri-apps/plugin-os in Tauri v2 is synchronous and returns one of the OsType strings—including "macos"—so:

  • const os = ostype(); yields a plain OsType ("linux" | "macos" | "windows" | "ios" | "android"), not a Promise (v2.tauri.app)
  • A macOS host correctly returns "macos", making the existing os === "macos" checks valid (v2.tauri.app)

No changes are required to handle async behavior or normalize "Darwin"–style values. You may optionally refactor to a boolean isMac for readability, but this is purely stylistic.

Likely an incorrect or invalid review comment.

apps/desktop/src/routes/editor/Player.tsx (3)

218-224: LGTM: Crop button uses centralized handler and advertises shortcut

The tooltip + kbd hint is consistent with the new global shortcut and improves discoverability.


277-294: LGTM: Split toggle with keyboard hint and pressed state

Good use of KToggleButton via as and clear pressed styling.


296-307: LGTM: OS-aware tooltips for zoom in/out match the implemented shortcuts

The hints align with the Equal/Minus handlers and the Tooltip’s OS-aware symbol mapping.

Also applies to: 308-317

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.

2 participants