Skip to content

feat(setting): hide zoom and speed setting, only show when select track#143

Merged
webadderall merged 1 commit intowebadderall:mainfrom
mahdyarief:feat/hide-settings-conditionally
Mar 31, 2026
Merged

feat(setting): hide zoom and speed setting, only show when select track#143
webadderall merged 1 commit intowebadderall:mainfrom
mahdyarief:feat/hide-settings-conditionally

Conversation

@mahdyarief
Copy link
Copy Markdown
Contributor

@mahdyarief mahdyarief commented Mar 30, 2026

Description

This PR modifies the SettingsPanel to conditionally show the Zoom Level and Playback Speed settings in the bottom dock. Previously, these panels were always visible but disabled when no region was selected; now, the entire dock is hidden and only appears when a corresponding zoom, trim, or speed track item is active on the timeline.

Motivation

To reduce UI clutter and provide a more focused editing experience. Since these settings are context-dependent (requiring a specific timeline region to be selected), they are now treated as dynamic UI elements that only surface when relevant to the user's current selection.

Type of Change

  • New Feature
  • Bug Fix
  • Refactor / Code Cleanup
  • Documentation Update
  • Other (please specify)

Related Issue(s)

#119

Testing Guide

  1. Launch the editor and ensure no timeline regions (zoom or speed) are selected.
  2. Observe the right-hand Settings Panel; the bottom footer section should be completely hidden, providing more vertical space for other settings.
  3. Click on a Zoom Region in the timeline; verify that the "Zoom Level" and "Delete Zoom" buttons appear at the bottom.
  4. Click on a Speed Region in the timeline; verify that the "Playback Speed" and "Delete Region" buttons appear.
  5. De-select the region (or click a different section) to confirm the dock hides again.

Checklist

  • I have performed a self-review of my code.
  • I have added any necessary screenshots or videos.
  • I have linked related issue(s) and updated the changelog if applicable.

Summary by CodeRabbit

  • Refactor
    • Improved the video editor settings panel to conditionally display zoom, trim, and speed controls based on active selections, reducing unnecessary UI elements and placeholder messages.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 30, 2026

Warning

.coderabbit.yaml has a parsing error

The CodeRabbit configuration file in this repository has a parsing error and default settings were used instead. Please fix the error(s) in the configuration file. You can initialize chat with CodeRabbit to get help with the configuration file.

💥 Parsing errors (1)
Validation error: Invalid regex pattern for base branch. Received: "*" at "reviews.auto_review.base_branches[0]"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • 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
📝 Walkthrough

Walkthrough

Refactored the SettingsPanel component to replace boolean state derivations (zoomEnabled, trimEnabled) with ID-based conditional rendering. Zoom, trim, and speed controls now display based on whether their respective selected IDs are set, with trim logic adjusted to prevent overlap with zoom.

Changes

Cohort / File(s) Summary
Settings Panel Rendering Refactor
src/components/video-editor/SettingsPanel.tsx
Replaced zoomEnabled and trimEnabled boolean logic with ID-based conditional rendering. Zoom, trim, and speed UI sections now render only when their corresponding selected IDs exist. Trim deletion UI excluded when zoom is active to prevent overlap. Removed disabled button states and placeholder messages for inactive controls.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰✨ A bunny's delight in logic refined!
Where booleans once scattered, IDs now align,
Zoom, trim, and speed dance in perfect view,
No overlap, no confusion—just controls anew!
Settings shine bright, the panel's renewed! 🎬

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: conditionally hiding zoom and speed settings, showing them only when tracks are selected.
Description check ✅ Passed The PR description follows the template with all key sections completed: Description, Motivation, Type of Change (with selections), Related Issue(s), Testing Guide, and Checklist. The content is clear and substantive.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@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.

Caution

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

⚠️ Outside diff range comments (1)
src/components/video-editor/SettingsPanel.tsx (1)

2047-2055: ⚠️ Potential issue | 🟠 Major

Clear selectedSpeedId when deleting from this footer.

Line 2048 only calls onSpeedDelete, but src/components/video-editor/timeline/TimelineEditor.tsx:787-792 also calls onSelectSpeed(null) after deleting. With the footer now hidden/shown from selectedSpeedId, this path can leave the speed dock visible against a stale selection.

Suggested fix
-						<Button
-							onClick={() => selectedSpeedId && onSpeedDelete?.(selectedSpeedId)}
+						<Button
+							onClick={() => {
+								if (!selectedSpeedId) return;
+								onSpeedDelete?.(selectedSpeedId);
+								onSelectSpeed?.(null);
+							}}
// Outside this hunk, either clear selection inside the parent onSpeedDelete
// implementation or thread the setter through SettingsPanelProps:
onSelectSpeed?: (id: string | null) => void;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/video-editor/SettingsPanel.tsx` around lines 2047 - 2055, The
delete button only calls onSpeedDelete(selectedSpeedId) but does not clear the
UI selection, leaving the speed dock visible for a stale selectedSpeedId; update
the SettingsPanel delete flow to also clear the selection by invoking
onSelectSpeed(null) after a successful delete (or ensure the parent
implementation of onSpeedDelete clears selection), and if necessary add
onSelectSpeed?: (id: string | null) => void to SettingsPanelProps so
SettingsPanel can call it; adjust the handler connected to the Button (and any
parent delete handlers used by TimelineEditor.tsx) to guarantee selectedSpeedId
is reset to null after deletion.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/components/video-editor/SettingsPanel.tsx`:
- Around line 2047-2055: The delete button only calls
onSpeedDelete(selectedSpeedId) but does not clear the UI selection, leaving the
speed dock visible for a stale selectedSpeedId; update the SettingsPanel delete
flow to also clear the selection by invoking onSelectSpeed(null) after a
successful delete (or ensure the parent implementation of onSpeedDelete clears
selection), and if necessary add onSelectSpeed?: (id: string | null) => void to
SettingsPanelProps so SettingsPanel can call it; adjust the handler connected to
the Button (and any parent delete handlers used by TimelineEditor.tsx) to
guarantee selectedSpeedId is reset to null after deletion.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ec393280-58a1-493f-98b7-ff203c6c96d1

📥 Commits

Reviewing files that changed from the base of the PR and between e20e6a1 and f65eb30.

📒 Files selected for processing (1)
  • src/components/video-editor/SettingsPanel.tsx

@webadderall webadderall merged commit 034e6a6 into webadderall:main Mar 31, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants