Allow advanced padding to position video vertically#681
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (4)
📝 WalkthroughWalkthroughAdds a new exported constant ChangesAdvanced Vertical Padding Max
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
a51e05f to
8410925
Compare
There was a problem hiding this comment.
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)
2417-2428:⚠️ Potential issue | 🟠 Major | ⚡ Quick winClamp relinked padding to linked-mode bounds (0–100).
Line 2417 and Line 2428 expand unlinked vertical range to 250, but the existing relink averaging can now produce
linked: truevalues above 100. That breaks the linked padding contract and can cause confusing jumps after persistence normalization.💡 Proposed fix (outside this selected range, in
togglePaddingLink)const togglePaddingLink = () => { const isLinked = padding.linked !== false; const nextLinked = !isLinked; if (nextLinked) { // Compute average for relinking to avoid sudden shifts - const avg = Math.round( + const avg = Math.min( + 100, + Math.max( + 0, + Math.round( (padding.top + padding.bottom + padding.left + padding.right) / 4, - ); + ), + ), + ); onPaddingChange?.({ top: avg, bottom: avg, left: avg, right: avg, linked: true, });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/components/video-editor/SettingsPanel.tsx` around lines 2417 - 2428, The vertical padding range is expanded to 250 in unlinked mode (as shown by max={ADVANCED_VERTICAL_PADDING_MAX} in the SliderControl components for top and bottom padding), but when padding is relinked, the averaging logic in the togglePaddingLink function can produce values above 100 which violates the linked padding contract that requires bounds of 0-100. Modify the togglePaddingLink function to clamp the newly calculated linked padding values to the 0-100 range after averaging the unlinked values to prevent values exceeding 100 from being set on the linked state.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/components/video-editor/SettingsPanel.tsx`:
- Around line 2417-2428: The vertical padding range is expanded to 250 in
unlinked mode (as shown by max={ADVANCED_VERTICAL_PADDING_MAX} in the
SliderControl components for top and bottom padding), but when padding is
relinked, the averaging logic in the togglePaddingLink function can produce
values above 100 which violates the linked padding contract that requires bounds
of 0-100. Modify the togglePaddingLink function to clamp the newly calculated
linked padding values to the 0-100 range after averaging the unlinked values to
prevent values exceeding 100 from being set on the linked state.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 2ddd2f4e-0aab-4b86-ac6e-15ea18f64cfd
📒 Files selected for processing (6)
src/components/video-editor/SettingsPanel.tsxsrc/components/video-editor/projectPersistence.test.tssrc/components/video-editor/projectPersistence.tssrc/components/video-editor/types.tssrc/components/video-editor/videoPlayback/layoutUtils.test.tssrc/components/video-editor/videoPlayback/layoutUtils.ts
8410925 to
c92a255
Compare
Summary
Verification
npx vitest --run src/components/video-editor/videoPlayback/layoutUtils.test.ts src/components/video-editor/projectPersistence.test.tsnpx biome check src/components/video-editor/projectPersistence.ts src/components/video-editor/projectPersistence.test.ts src/components/video-editor/types.ts src/components/video-editor/videoPlayback/layoutUtils.ts src/components/video-editor/videoPlayback/layoutUtils.test.tsNotes
npm run lintstill fails on existing unrelated formatting/import diagnostics outside this change.Summary by CodeRabbit
New Features
Bug Fixes
Tests