-
Notifications
You must be signed in to change notification settings - Fork 4.1k
feat: add media flip controls #641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
@joepduin is attempting to deploy a commit to the OpenCut OSS Team on Vercel. A member of the Team first needs to authorize it. |
👷 Deploy request for appcut pending review.Visit the deploys page to approve it
|
WalkthroughAdds media flip support: UI controls now pass a trackId to MediaProperties (and media flip controls re-export MediaProperties), a toggleMediaFlip store action updates element.transform, canvas drawing uses a drawWithFlip helper, types include MediaTransform, and frame-cache/timeline rendering account for flips. Changes
Sequence DiagramsequenceDiagram
participant User
participant UI as MediaProperties
participant Store as TimelineStore
participant Cache as Frame Cache
participant Renderer as Canvas Renderer
User->>UI: Click flip (horizontal/vertical)
UI->>Store: toggleMediaFlip(trackId, elementId, axis)
activate Store
Store->>Store: validate media, pushHistory(), toggle transform
Store->>Store: updateTracksAndSave()
deactivate Store
Store->>Cache: update timeline hash (includes transform)
activate Cache
Cache->>Renderer: request re-render
deactivate Cache
activate Renderer
Renderer->>Renderer: drawWithFlip(element, transform)
Renderer->>Renderer: apply canvas transforms, ctx.drawImage()
deactivate Renderer
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
apps/web/src/hooks/use-frame-cache.ts (1)
52-55: Consider referencing the MediaTransform type for consistency.The inline transform type definition here could reference the MediaTransform type from
@/types/timelineto maintain consistency and reduce duplication.Apply this diff to reference the existing type:
+import type { MediaTransform } from "@/types/timeline"; interface CachedFrame { imageData: ImageData; timelineHash: string; timestamp: number; }And update the inline type:
const activeElements: Array<{ id: string; type: string; startTime: number; duration: number; trimStart: number; trimEnd: number; mediaId?: string; - transform?: { - flipHorizontal: boolean; - flipVertical: boolean; - }; + transform?: Required<MediaTransform>;Note: Using
Required<MediaTransform>makes the booleans non-optional, matching the current behavior where both flags are always present in the cache hash.apps/web/src/components/editor/properties-panel/flip/media-flip-controls.tsx (1)
4-9: Remove unused imports.Lines 6 and 7 import
PropertyItemandPropertyItemLabel, but these are not used in the component.Apply this diff to remove the unused imports:
import { PropertyGroup, - PropertyItem, - PropertyItemLabel, PropertyItemValue, } from "./property-item";apps/web/src/components/editor/properties-panel/media-properties.tsx (1)
4-9: Remove unused imports.Lines 6 and 7 import
PropertyItemandPropertyItemLabel, but these are not used in the component.Apply this diff to remove the unused imports:
import { PropertyGroup, - PropertyItem, - PropertyItemLabel, PropertyItemValue, } from "./property-item";
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
apps/web/src/components/editor/properties-panel/flip/media-flip-controls.tsx(1 hunks)apps/web/src/components/editor/properties-panel/index.tsx(1 hunks)apps/web/src/components/editor/properties-panel/media-properties.tsx(1 hunks)apps/web/src/components/editor/timeline/timeline-element.tsx(2 hunks)apps/web/src/hooks/use-frame-cache.ts(2 hunks)apps/web/src/lib/timeline-renderer.ts(8 hunks)apps/web/src/stores/timeline-store.ts(2 hunks)apps/web/src/types/timeline.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{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.
Useas constinstead of literal types and type annotations.
Use eitherT[]orArray<T>consistently.
Initialize each enum member value explicitly.
Useexport typefor types.
Useimport typefor 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/types/timeline.tsapps/web/src/hooks/use-frame-cache.tsapps/web/src/stores/timeline-store.tsapps/web/src/components/editor/properties-panel/index.tsxapps/web/src/components/editor/properties-panel/media-properties.tsxapps/web/src/lib/timeline-renderer.tsapps/web/src/components/editor/properties-panel/flip/media-flip-controls.tsxapps/web/src/components/editor/timeline/timeline-element.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 theargumentsobject.
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 uselessthisaliasing.
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/types/timeline.tsapps/web/src/hooks/use-frame-cache.tsapps/web/src/stores/timeline-store.tsapps/web/src/components/editor/properties-panel/index.tsxapps/web/src/components/editor/properties-panel/media-properties.tsxapps/web/src/lib/timeline-renderer.tsapps/web/src/components/editor/properties-panel/flip/media-flip-controls.tsxapps/web/src/components/editor/timeline/timeline-element.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/types/timeline.tsapps/web/src/hooks/use-frame-cache.tsapps/web/src/stores/timeline-store.tsapps/web/src/components/editor/properties-panel/index.tsxapps/web/src/components/editor/properties-panel/media-properties.tsxapps/web/src/lib/timeline-renderer.tsapps/web/src/components/editor/properties-panel/flip/media-flip-controls.tsxapps/web/src/components/editor/timeline/timeline-element.tsx
**/*.{jsx,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{jsx,tsx}: Don't useaccessKeyattribute on any HTML element.
Don't setaria-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 thescopeprop 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 assigntabIndexto non-interactive HTML elements.
Don't use positive integers fortabIndexproperty.
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 atitleelement 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.
AssigntabIndexto non-interactive HTML elements witharia-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 atypeattribute for button elements.
Make elements with interactive roles and handlers focusable.
Give heading elements content that's accessible to screen readers (not hidden witharia-hidden).
Always include alangattribute on the html element.
Always include atitleattribute for iframe elements.
AccompanyonClickwith at least one of:onKeyUp,onKeyDown, oronKeyPress.
AccompanyonMouseOver/onMouseOutwithonFocus/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/properties-panel/index.tsxapps/web/src/components/editor/properties-panel/media-properties.tsxapps/web/src/components/editor/properties-panel/flip/media-flip-controls.tsxapps/web/src/components/editor/timeline/timeline-element.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/editor/properties-panel/index.tsxapps/web/src/components/editor/properties-panel/media-properties.tsxapps/web/src/components/editor/properties-panel/flip/media-flip-controls.tsxapps/web/src/components/editor/timeline/timeline-element.tsx
🧠 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/properties-panel/index.tsx
🧬 Code graph analysis (4)
apps/web/src/components/editor/properties-panel/index.tsx (1)
apps/web/src/components/editor/properties-panel/media-properties.tsx (1)
MediaProperties(16-45)
apps/web/src/components/editor/properties-panel/media-properties.tsx (1)
apps/web/src/types/timeline.ts (1)
MediaElement(23-28)
apps/web/src/lib/timeline-renderer.ts (1)
apps/web/src/types/timeline.ts (2)
MediaTransform(17-20)MediaElement(23-28)
apps/web/src/components/editor/properties-panel/flip/media-flip-controls.tsx (3)
apps/web/src/types/timeline.ts (1)
MediaElement(23-28)apps/web/src/components/editor/properties-panel/media-properties.tsx (1)
MediaProperties(16-45)apps/web/src/stores/timeline-store.ts (1)
useTimelineStore(258-1912)
⏰ 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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
apps/web/src/hooks/use-frame-cache.ts (2)
190-201: Remove console usage; avoid leaking hashes and noisy logs.Console logging is disallowed per project guidelines and may expose state. Drop the logs or route to your structured logger behind a debug flag.
Apply this diff:
const currentHash = getTimelineHash( time, tracks, mediaFiles, activeProject, sceneId ); - console.log(cached.timelineHash === currentHash); if (cached.timelineHash !== currentHash) { - // Cache is stale, remove it - console.log( - "Cache miss - hash mismatch:", - JSON.stringify({ - cachedHash: cached.timelineHash.slice(0, 100), - currentHash: currentHash.slice(0, 100), - }) - ); + // Cache is stale, remove it frameCacheRef.current.delete(frameKey); return null; }And:
- } catch (error) { - console.warn(`Pre-render failed for time ${time}:`, error); - } + } catch { + // Ignore pre-render failures; foreground render will retry + }As per coding guidelines.
Also applies to: 339-341
22-28: Avoidanyon the shared cache; type the global.Replace the
globalThis as anypattern with a typed global augmentation. This removesanyand keeps HMR-safety.Apply this diff:
-// Shared singleton cache across hook instances (HMR-safe) -// eslint-disable-next-line @typescript-eslint/no-explicit-any -const __frameCacheGlobal: any = globalThis as any; -const __sharedFrameCache: Map<number, CachedFrame> = - __frameCacheGlobal.__sharedFrameCache ?? new Map<number, CachedFrame>(); -__frameCacheGlobal.__sharedFrameCache = __sharedFrameCache; +// Shared singleton cache across hook instances (HMR-safe) +declare global { + // eslint-disable-next-line no-var + var __sharedFrameCache: Map<number, CachedFrame> | undefined; +} +const __sharedFrameCache: Map<number, CachedFrame> = + globalThis.__sharedFrameCache ?? new Map<number, CachedFrame>(); +globalThis.__sharedFrameCache = __sharedFrameCache;As per coding guidelines.
apps/web/src/lib/timeline-renderer.ts (1)
259-289: Avoid reloading images every frame; reuse the cached element.Creating a new Image and awaiting load on every frame is a severe performance hit. Reuse
getImageElement(already implemented above).Apply this diff:
- const img = new Image(); - await new Promise<void>((resolve, reject) => { - img.onload = () => resolve(); - img.onerror = () => reject(new Error("Image load failed")); - img.src = mediaItem.url || URL.createObjectURL(mediaItem.file); - }); + const img = await getImageElement(mediaItem);
🧹 Nitpick comments (4)
apps/web/src/hooks/use-frame-cache.ts (2)
272-281: GuardrequestIdleCallbackfor SSR and browsers lacking it.Provide a safe fallback to
setTimeoutto avoid ReferenceErrors during SSR or older engines.Apply this diff:
- // Pre-render during idle time - for (const time of toSchedule) { - requestIdleCallback(async () => { + // Pre-render during idle time + const schedule = (fn: () => void) => { + const ric = (globalThis as unknown as { requestIdleCallback?: (cb: () => void) => number }).requestIdleCallback; + return typeof ric === "function" ? ric(fn) : setTimeout(fn, 0); + }; + for (const time of toSchedule) { + schedule(async () => { try { const imageData = await renderFunction(time); cacheFrame( time, imageData, tracks, mediaFiles, activeProject, sceneId ); } catch { // Ignore pre-render failures; foreground render will retry } - }); + }); }Also applies to: 327-343
2-9: Useimport typefor type-only imports.These imports are types only; switch to
import typeto avoid unnecessary runtime bindings.Apply this diff:
-import { - TimelineTrack, - TimelineElement, - MediaElement, - TextElement, -} from "@/types/timeline"; -import { MediaFile } from "@/types/media"; -import { TProject } from "@/types/project"; +import type { + TimelineTrack, + TimelineElement, + MediaElement, + TextElement, +} from "@/types/timeline"; +import type { MediaFile } from "@/types/media"; +import type { TProject } from "@/types/project";As per coding guidelines.
apps/web/src/stores/timeline-store.ts (1)
879-932: Element-level flip toggle logic is solid; consider a selection-aware variant.The per-element toggle correctly creates/removes transform and preserves booleans. To match the PR goal of “single toggle applies to all selected clips,” add a bulk action mirroring
toggleSelectedHidden/Muted, or confirm the UI loops overselectedElements.Proposed addition:
interface TimelineStore { ... + toggleSelectedFlip: ( + axis: "horizontal" | "vertical", + trackId?: string, + elementId?: string + ) => void; }And implementation (near other selection-aware actions):
+ toggleSelectedFlip: (axis, trackId?, elementId?) => { + const { selectedElements, _tracks } = get(); + const targets = + trackId && elementId + ? [{ trackId, elementId }] + : selectedElements.length > 0 + ? selectedElements + : []; + if (targets.length === 0) return; + get().pushHistory(); + updateTracksAndSave( + _tracks.map((track) => ({ + ...track, + elements: track.elements.map((el) => { + const shouldUpdate = targets.some( + ({ trackId: tId, elementId: eId }) => + tId === track.id && eId === el.id + ); + if (!shouldUpdate || el.type !== "media") return el; + const curr = el.transform || {}; + const key = axis === "horizontal" ? "flipHorizontal" : "flipVertical"; + const toggled = !curr[key as keyof typeof curr]; + const next = { + flipHorizontal: key === "flipHorizontal" ? toggled : !!curr.flipHorizontal, + flipVertical: key === "flipVertical" ? toggled : !!curr.flipVertical, + }; + const hasAny = next.flipHorizontal || next.flipVertical; + return { ...el, transform: hasAny ? next : undefined }; + }), + })) + ); + },If the UI already iterates over selection, please confirm. Based on PR objectives.
apps/web/src/components/editor/properties-panel/media-properties.tsx (1)
16-45: Wire-up looks good; add a11y states and explicit button type.Expose toggle state via
aria-pressedand settype="button"to avoid accidental form submits in nested forms.Apply this diff:
<PropertyItemValue> <div className="flex gap-2"> <Button variant={flipHorizontal ? "default" : "outline"} size="sm" + type="button" + aria-pressed={flipHorizontal} onClick={() => toggleMediaFlip(trackId, element.id, "horizontal")} > Flip Horizontal </Button> <Button variant={flipVertical ? "default" : "outline"} size="sm" + type="button" + aria-pressed={flipVertical} onClick={() => toggleMediaFlip(trackId, element.id, "vertical")} > Flip Vertical </Button> </div> </PropertyItemValue>As per coding guidelines.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
apps/web/src/components/editor/properties-panel/flip/media-flip-controls.tsx(1 hunks)apps/web/src/components/editor/properties-panel/media-properties.tsx(1 hunks)apps/web/src/components/editor/timeline/timeline-element.tsx(2 hunks)apps/web/src/hooks/use-frame-cache.ts(2 hunks)apps/web/src/lib/timeline-renderer.ts(8 hunks)apps/web/src/stores/timeline-store.ts(2 hunks)apps/web/src/types/timeline.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- apps/web/src/components/editor/properties-panel/flip/media-flip-controls.tsx
- apps/web/src/types/timeline.ts
- apps/web/src/components/editor/timeline/timeline-element.tsx
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{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.
Useas constinstead of literal types and type annotations.
Use eitherT[]orArray<T>consistently.
Initialize each enum member value explicitly.
Useexport typefor types.
Useimport typefor 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/lib/timeline-renderer.tsapps/web/src/hooks/use-frame-cache.tsapps/web/src/stores/timeline-store.tsapps/web/src/components/editor/properties-panel/media-properties.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 theargumentsobject.
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 uselessthisaliasing.
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/lib/timeline-renderer.tsapps/web/src/hooks/use-frame-cache.tsapps/web/src/stores/timeline-store.tsapps/web/src/components/editor/properties-panel/media-properties.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/lib/timeline-renderer.tsapps/web/src/hooks/use-frame-cache.tsapps/web/src/stores/timeline-store.tsapps/web/src/components/editor/properties-panel/media-properties.tsx
**/*.{jsx,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{jsx,tsx}: Don't useaccessKeyattribute on any HTML element.
Don't setaria-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 thescopeprop 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 assigntabIndexto non-interactive HTML elements.
Don't use positive integers fortabIndexproperty.
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 atitleelement 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.
AssigntabIndexto non-interactive HTML elements witharia-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 atypeattribute for button elements.
Make elements with interactive roles and handlers focusable.
Give heading elements content that's accessible to screen readers (not hidden witharia-hidden).
Always include alangattribute on the html element.
Always include atitleattribute for iframe elements.
AccompanyonClickwith at least one of:onKeyUp,onKeyDown, oronKeyPress.
AccompanyonMouseOver/onMouseOutwithonFocus/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/properties-panel/media-properties.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/editor/properties-panel/media-properties.tsx
🧬 Code graph analysis (2)
apps/web/src/lib/timeline-renderer.ts (1)
apps/web/src/types/timeline.ts (2)
MediaTransform(18-21)MediaElement(24-29)
apps/web/src/components/editor/properties-panel/media-properties.tsx (2)
apps/web/src/types/timeline.ts (1)
MediaElement(24-29)apps/web/src/components/editor/properties-panel/property-item.tsx (2)
PropertyGroup(63-86)PropertyItemValue(45-53)
⏰ 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 (5)
apps/web/src/hooks/use-frame-cache.ts (1)
52-56: Good call: include flip transform in the cache key.Hashing flipHorizontal/flipVertical ensures cache invalidates on mirror changes. This aligns the cache with rendering.
Also applies to: 92-97
apps/web/src/lib/timeline-renderer.ts (3)
26-53:drawWithFlipis correct and self-contained.Center-based translate/scale/restore is clean and side-effect-safe. Good reuse point.
141-148: Background blur respects flip.Applying
drawWithFlipto the blur cover keeps background consistent with foreground mirroring. LGTM.Also applies to: 169-177, 200-208
219-220: Video rendering path uses flip correctly.The transform is applied around the draw rect; no additional changes needed.
Also applies to: 242-250
apps/web/src/stores/timeline-store.ts (1)
130-134: Public API surface addition is consistent.The
toggleMediaFlipsignature matches other actions and is discoverable on the store.
Description
Fixes: n/a
Type of change
How Has This Been Tested?
bun run dev, opened the editor, selected multiple media clips, toggled both flip buttons and confirmed preview updates for every selected clip.bunx biome format --write .(root),bun run lint(apps/web)Test Configuration:
Screenshots (if applicable)
Transform UI:

Before:

After:

Video:
https://github.com/user-attachments/assets/fd80223f-dedb-4635-bed4-829d4f388ea4
Checklist:
Additional context
The selection-aware toggle ensures mirror state stays consistent when editing multiple clips at once while keeping undo/redo history intact.
Summary by CodeRabbit