Skip to content

Create polished demo videos without editing skills. Mac/Windows/Linux

fix CodeRabbit comments

Alan Trebugeaiseae47a1ae06d
diff --git a/src/components/video-editor/timeline/components/axis/TimelineAxis.tsx b/src/components/video-editor/timeline/components/axis/TimelineAxis.tsx
index a1bab326..4f169821 100644
--- a/src/components/video-editor/timeline/components/axis/TimelineAxis.tsx
+++ b/src/components/video-editor/timeline/components/axis/TimelineAxis.tsx
@@ -28,8 +28,8 @@ export default function TimelineAxis({ videoDurationMs, currentTimeMs }: Timelin
const markerTimes = new Set<number>();
const firstMarker = Math.ceil(visibleStart / intervalMs) * intervalMs;
- for (let time = firstMarker; time <= maxTime; time += intervalMs) {
- if (time >= visibleStart && time <= visibleEnd) markerTimes.add(Math.round(time));
+ for (let time = firstMarker; time <= visibleEnd; time += intervalMs) {
+ markerTimes.add(Math.round(time));
}
if (visibleStart <= maxTime) markerTimes.add(Math.round(visibleStart));
@@ -41,11 +41,9 @@ export default function TimelineAxis({ videoDurationMs, currentTimeMs }: Timelin
const minorTicks: number[] = [];
const minorInterval = intervalMs / 5;
- for (let time = firstMarker; time <= maxTime; time += minorInterval) {
- if (time >= visibleStart && time <= visibleEnd) {
- const isMajor = Math.abs(time % intervalMs) < 1;
- if (!isMajor) minorTicks.push(time);
- }
+ for (let time = firstMarker; time <= visibleEnd; time += minorInterval) {
+ const isMajor = Math.abs(time % intervalMs) < 1;
+ if (!isMajor) minorTicks.push(time);
}
return {
@@ -80,7 +78,7 @@ export default function TimelineAxis({ videoDurationMs, currentTimeMs }: Timelin
flexDirection: "row",
alignItems: "flex-end",
[sideProperty]: `${offset}px`,
- transform: "translateX(-50%)",
+ transform: direction === "rtl" ? "translateX(50%)" : "translateX(-50%)",
};
return (
diff --git a/src/components/video-editor/timeline/components/toolbar/TimelineToolbar.tsx b/src/components/video-editor/timeline/components/toolbar/TimelineToolbar.tsx
index fa7093c0..ba6ae732 100644
--- a/src/components/video-editor/timeline/components/toolbar/TimelineToolbar.tsx
+++ b/src/components/video-editor/timeline/components/toolbar/TimelineToolbar.tsx
@@ -118,7 +118,13 @@ export default function TimelineToolbar({
</DropdownMenuContent>
</DropdownMenu>
<div className="w-[1px] h-4 bg-foreground/10" />
- <Button variant="ghost" size="sm" onClick={() => onOpenCropEditor?.()} className="h-7 px-2 text-xs text-muted-foreground hover:text-foreground hover:bg-foreground/10 transition-all gap-1.5">
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={onOpenCropEditor}
+ disabled={!onOpenCropEditor}
+ className="h-7 px-2 text-xs text-muted-foreground hover:text-foreground hover:bg-foreground/10 transition-all gap-1.5"
+ >
<Crop className="w-3.5 h-3.5" />
<span className="font-medium">{cropLabel}</span>
{isCropped ? <span className="h-1.5 w-1.5 rounded-full bg-[#2563EB]" /> : null}