Skip to content

Conversation

@ameer2468
Copy link
Contributor

@ameer2468 ameer2468 commented Nov 4, 2025

Summary by CodeRabbit

  • New Features

    • Restructured editor sidebar with in-place tab content and consistent padding for smoother navigation
    • New collapsible Border and enhanced Shadow panels for advanced styling controls
    • In-content rendering for zoom/scene/clip controls and caption overlays for clearer workflows
  • Bug Fixes

    • Debounced wallpaper/path application with improved loading state and error handling
    • Auto-scroll behavior ensures newly opened sections are visible; padding/layout tweaks prevent overflow and preserve selection/deletion flows

@ameer2468 ameer2468 added the Desktop Things affecting desktop app label Nov 4, 2025
@ameer2468 ameer2468 changed the title desktop app: fix layout breaking when toggling border fix layout breaking when toggling border Nov 4, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 4, 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 9 minutes and 0 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 9d0431a and 965da3a.

📒 Files selected for processing (1)
  • apps/desktop/src/routes/editor/ConfigSidebar.tsx (10 hunks)

Walkthrough

Reworks ConfigSidebar to inline former overlay UIs into KTabs.Content, adjusts tab content layout (padding/flex/min-h-0), refactors background wallpaper loading with debounce and URL resolution, moves Border controls into a KCollapsible with auto-scroll, and replaces ShadowSettings conditional rendering with KCollapsible-based animated content.

Changes

Cohort / File(s) Summary
ConfigSidebar: tabs, selection, background, zoom/clip/scene
apps/desktop/src/routes/editor/ConfigSidebar.tsx
Binds KTabs to component state; removes overlay-driven selection UI and inlines controls in KTabs.Content; moves padding/flex/min-h-0 into content sections; replaces overlay Delete/Done with in-content handlers wired to projectActions (e.g., deleteZoomSegments, deleteSceneSegment, deleteClipSegment); introduces debounced wallpaper application, URL/path resolution, loading state and error/toast handling; migrates many background/gradient/image controls into padded, flexed blocks; adds KCollapsible for Border and auto-scroll when opening.
Shadow settings: collapsible refactor & layout tweaks
apps/desktop/src/routes/editor/ShadowSettings.tsx
Replaces inline conditional rendering with KCollapsible and KCollapsible.Content; consolidates auto-scroll logic to a single 200ms timeout; adjusts wrapper sizing (w-full h-full) and button label text-sm; preserves Size/Opacity/Blur sliders inside animated collapsible content.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant ConfigSidebar
  participant KTabs
  participant BackgroundLoader
  participant Toast

  User->>ConfigSidebar: select tab / interact with controls
  ConfigSidebar->>KTabs: set value = state.selectedTab
  KTabs-->>ConfigSidebar: render corresponding KTabs.Content (inline controls)
  alt Background tab selected
    ConfigSidebar->>BackgroundLoader: applyWallpaper(path) [debounced]
    BackgroundLoader-->>BackgroundLoader: resolve URL/path, load image
    BackgroundLoader-->>ConfigSidebar: success / failure
    BackgroundLoader->>Toast: show error (on failure)
  end
  Note right of ConfigSidebar: Opening Border KCollapsible triggers auto-scroll to reveal controls
Loading
sequenceDiagram
  participant User
  participant ShadowSettings
  participant KCollapsible

  User->>ShadowSettings: toggle Shadow section
  ShadowSettings->>KCollapsible: set open = isOpen
  KCollapsible-->>ShadowSettings: animate reveal
  ShadowSettings->>ShadowSettings: setTimeout(200ms) -> scroll into view if needed
  User->>ShadowSettings: adjust Size/Opacity/Blur sliders
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

  • Focus areas:
    • apps/desktop/src/routes/editor/ConfigSidebar.tsx — debounce, async wallpaper loading, URL/path resolution and cleanup.
    • In-content Delete/Done handlers for zoom/scene/clip — ensure correct action wiring and state consistency.
    • KCollapsible animations, open/close timing and auto-scroll behavior (Background border).
    • ShadowSettings collapsible behavior and updated timeout/scroll logic.

Poem

🐰 I nudged the tabs and tucked the panes,

Wallpapers hum and borders train,
Shadows stretch with sliders true,
Zooms and clips now snug in view,
A rabbit hops — "Great work, we grew!" ✨

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix layout breaking when toggling border' directly addresses the primary change in the PR—adding auto-scroll behavior and collapsible UI improvements to fix layout issues when border state toggles.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3af8741 and fccaeae.

📒 Files selected for processing (1)
  • apps/desktop/src/routes/editor/ConfigSidebar.tsx (7 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Use a 2-space indent for TypeScript code.
Use Biome for formatting and linting TypeScript/JavaScript files by running pnpm format.

Files:

  • apps/desktop/src/routes/editor/ConfigSidebar.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,js,jsx}: Use kebab-case for filenames for TypeScript/JavaScript modules (e.g., user-menu.tsx).
Use PascalCase for React/Solid components.

Files:

  • apps/desktop/src/routes/editor/ConfigSidebar.tsx
🧬 Code graph analysis (1)
apps/desktop/src/routes/editor/ConfigSidebar.tsx (3)
apps/desktop/src/routes/editor/ui.tsx (7)
  • Field (25-47)
  • Subfield (49-63)
  • MenuItem (264-279)
  • PopperContent (287-293)
  • topSlideAnimateClasses (432-433)
  • MenuItemList (295-309)
  • Slider (65-147)
apps/desktop/src/components/Toggle.tsx (1)
  • Toggle (37-50)
apps/desktop/src/utils/tauri.ts (1)
  • StereoMode (473-473)
⏰ 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: Analyze (rust)

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/desktop/src/routes/editor/ConfigSidebar.tsx (1)

647-879: Critical bug in deleteClipSegment validation logic.

The handlers are properly implemented and called correctly from ConfigSidebar.tsx. However, there is a critical logic error in deleteClipSegment at line 111 of apps/desktop/src/routes/editor/context.ts:

!segment.recordingSegment === undefined

This should be:

segment.recordingSegment === undefined

The negation operator applied to segment.recordingSegment converts it to a boolean before comparison, breaking the validation check.

♻️ Duplicate comments (1)
apps/desktop/src/routes/editor/ConfigSidebar.tsx (1)

1570-1609: Resume history after gradient drag.

History is paused on line 1572 but never resumed. Once a user drags the gradient angle, the editor's history stays paused and no further state changes reach the undo stack.

Apply this diff to resume history on mouseup:

                   createRoot((dispose) =>
                     createEventListenerMap(window, {
-                      mouseup: () => dispose(),
+                      mouseup: () => {
+                        resumeHistory();
+                        dispose();
+                      },
                       mousemove: (moveEvent) => {
                         const rawNewAngle =
                           Math.round(
🧹 Nitpick comments (2)
apps/desktop/src/routes/editor/ConfigSidebar.tsx (2)

1717-1781: Consider extracting default border config.

The default border configuration { enabled: true, width: 5.0, color: [0, 0, 0], opacity: 50.0 } is repeated three times (lines 1725-1730, 1745-1750, 1764-1769). Extracting this to a constant would improve maintainability.

Add this constant near the top of the BackgroundConfig function:

const DEFAULT_BORDER_CONFIG = {
  enabled: true,
  width: 5.0,
  color: [0, 0, 0] as [number, number, number],
  opacity: 50.0,
};

Then use it in the border controls:

  onChange={(v) =>
    setProject("background", "border", {
-     ...(project.background.border ?? {
-       enabled: true,
-       width: 5.0,
-       color: [0, 0, 0],
-       opacity: 50.0,
-     }),
+     ...(project.background.border ?? DEFAULT_BORDER_CONFIG),
      width: v[0],
    })
  }

943-960: Consider simplifying wallpaper path resolution.

The inline radioGroupOnChange function definition followed by immediate invocation (lines 943-960) adds complexity. Consider extracting the path resolution logic directly:

// Find the wallpaper with matching ID
const wallpaper = loadedWallpapers.find((w) => w.id === path);
if (wallpaper?.url) {
  try {
    const rawPath = decodeURIComponent(
      wallpaper.url.replace("file://", ""),
    );
    debouncedSetProject(rawPath);
  } catch (err) {
    toast.error("Failed to set wallpaper");
  }
}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fccaeae and c04f777.

📒 Files selected for processing (2)
  • apps/desktop/src/routes/editor/ConfigSidebar.tsx (12 hunks)
  • apps/desktop/src/routes/editor/ShadowSettings.tsx (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Use a 2-space indent for TypeScript code.
Use Biome for formatting and linting TypeScript/JavaScript files by running pnpm format.

Files:

  • apps/desktop/src/routes/editor/ShadowSettings.tsx
  • apps/desktop/src/routes/editor/ConfigSidebar.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,js,jsx}: Use kebab-case for filenames for TypeScript/JavaScript modules (e.g., user-menu.tsx).
Use PascalCase for React/Solid components.

Files:

  • apps/desktop/src/routes/editor/ShadowSettings.tsx
  • apps/desktop/src/routes/editor/ConfigSidebar.tsx
🧬 Code graph analysis (2)
apps/desktop/src/routes/editor/ShadowSettings.tsx (1)
apps/desktop/src/routes/editor/ui.tsx (2)
  • Field (25-47)
  • Slider (65-147)
apps/desktop/src/routes/editor/ConfigSidebar.tsx (3)
apps/desktop/src/routes/editor/CaptionsTab.tsx (1)
  • CaptionsTab (168-1145)
apps/desktop/src/utils/tauri.ts (1)
  • ZoomSegment (497-497)
apps/desktop/src/routes/editor/ui.tsx (2)
  • Field (25-47)
  • Slider (65-147)
⏰ 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: Analyze (rust)
🔇 Additional comments (9)
apps/desktop/src/routes/editor/ShadowSettings.tsx (4)

1-1: LGTM!

The import statement correctly aliases Collapsible as KCollapsible, maintaining consistency with the project's naming conventions for Kobalte components.


25-35: LGTM!

The simplified timeout logic correctly waits 200ms for the collapsible animation to complete before scrolling to reveal the expanded content.


38-38: LGTM!

Layout and typography adjustments are appropriate and consistent with the codebase styling patterns.

Also applies to: 44-44


52-84: LGTM!

The KCollapsible implementation correctly uses Kobalte's animation classes and state management, maintaining consistency with the broader refactor across the editor UI.

apps/desktop/src/routes/editor/ConfigSidebar.tsx (5)

260-261: LGTM!

Binding KTabs directly to state.selectedTab provides cleaner state management and aligns with the new tab control flow.


339-646: LGTM!

Explicit KTabs.Content wrappers with consistent padding and flex layout classes improve the tab content structure and ensure proper overflow behavior.


1056-1056: LGTM!

Explicit KTabs.Content wrapper with padding aligns with the tab content refactor pattern throughout the file.


1545-1566: LGTM!

The gradient editor layout refactor improves visual hierarchy by separating interactive controls from preset selection, making the code more maintainable.

Also applies to: 1613-1648


1804-1845: LGTM!

ShadowSettings component is consistently used in both BackgroundConfig and CameraConfig with proper prop handling and default values.

Also applies to: 2026-2067

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

♻️ Duplicate comments (2)
apps/desktop/src/routes/editor/ConfigSidebar.tsx (2)

1932-1937: Delay scroll to match KCollapsible animation timing.

The scroll is triggered immediately when the border toggle changes, but the KCollapsible content takes 200ms to animate (line 1948). This can cause the newly expanded content to be partially off-screen or scroll to complete before the animation finishes.

Apply this diff to delay the scroll until after the animation completes:

 					<Toggle
 						checked={project.background.border?.enabled ?? false}
 						onChange={(enabled) => {
 							const prev = project.background.border ?? {
 								enabled: false,
 								width: 5.0,
 								color: [0, 0, 0],
 								opacity: 50.0,
 							};
 
-							if (props.scrollRef) {
-								props.scrollRef.scrollTo({
-									top: props.scrollRef.scrollHeight,
-									behavior: "smooth",
-								});
-							}
+							setTimeout(() => {
+								if (enabled && props.scrollRef) {
+									props.scrollRef.scrollTo({
+										top: props.scrollRef.scrollHeight,
+										behavior: "smooth",
+									});
+								}
+							}, 200);
 
 							setProject("background", "border", {
 								...prev,
 								enabled,
 							});
 						}}
 					/>

Note: Also added a check to only scroll when enabling (not when collapsing).


1800-1839: Resume history after gradient drag.

History is paused on line 1802 but the returned resumeHistory() function is never called. Once a user drags the gradient angle, the editor's history remains paused and no further state changes reach the undo stack.

Apply this diff to call resumeHistory() in the mouseup handler:

 													createRoot((dispose) =>
 														createEventListenerMap(window, {
-															mouseup: () => dispose(),
+															mouseup: () => {
+																resumeHistory();
+																dispose();
+															},
 															mousemove: (moveEvent) => {
🧹 Nitpick comments (1)
apps/desktop/src/routes/editor/ConfigSidebar.tsx (1)

632-632: Consider adding flex-col and gap-6 for consistency.

The hotkeys tab uses "flex flex-1 p-4 min-h-0", while audio (line 339-341), cursor (458-460), and captions (641-643) tabs all use "flex flex-col flex-1 gap-6 p-4 min-h-0". Although hotkeys has minimal content currently, applying consistent classes would maintain uniformity across tabs.

Apply this diff for consistency:

-			<KTabs.Content value="hotkeys" class="flex flex-1 p-4 min-h-0">
+			<KTabs.Content value="hotkeys" class="flex flex-col flex-1 gap-6 p-4 min-h-0">
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c04f777 and 9d0431a.

📒 Files selected for processing (1)
  • apps/desktop/src/routes/editor/ConfigSidebar.tsx (10 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Use a 2-space indent for TypeScript code.
Use Biome for formatting and linting TypeScript/JavaScript files by running pnpm format.

Files:

  • apps/desktop/src/routes/editor/ConfigSidebar.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,js,jsx}: Use kebab-case for filenames for TypeScript/JavaScript modules (e.g., user-menu.tsx).
Use PascalCase for React/Solid components.

Files:

  • apps/desktop/src/routes/editor/ConfigSidebar.tsx
🧬 Code graph analysis (1)
apps/desktop/src/routes/editor/ConfigSidebar.tsx (3)
apps/desktop/src/routes/editor/CaptionsTab.tsx (1)
  • CaptionsTab (168-1145)
apps/desktop/src/utils/tauri.ts (2)
  • ZoomSegment (497-497)
  • commands (7-292)
apps/desktop/src/routes/editor/ui.tsx (3)
  • EditorButton (353-418)
  • Field (25-47)
  • Slider (65-147)
⏰ 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: Analyze (rust)
🔇 Additional comments (1)
apps/desktop/src/routes/editor/ConfigSidebar.tsx (1)

1947-2011: LGTM: Border controls KCollapsible implementation.

The KCollapsible implementation for border controls is well-structured with proper animation classes, consistent Field/Slider/RgbInput patterns, and appropriate default value handling. The animation timing aligns with the recommended scroll delay.

@ameer2468 ameer2468 merged commit a91f8c4 into main Nov 4, 2025
16 checks passed
@ameer2468 ameer2468 deleted the toggling-border-breaks-layout branch November 4, 2025 16:06
@Brendonovich Brendonovich restored the toggling-border-breaks-layout branch November 4, 2025 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Desktop Things affecting desktop app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants