fix: typescript error from old usage

This commit is contained in:
Maze Winther
2025-08-05 06:28:45 +02:00
parent 8f6c487c26
commit 1bed89d55f
2 changed files with 16 additions and 16 deletions
@@ -8,20 +8,13 @@ import { useEditorStore } from "@/stores/editor-store";
import { VideoPlayer } from "@/components/ui/video-player"; import { VideoPlayer } from "@/components/ui/video-player";
import { AudioPlayer } from "@/components/ui/audio-player"; import { AudioPlayer } from "@/components/ui/audio-player";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { import { Play, Pause, Expand, SkipBack, SkipForward } from "lucide-react";
Play,
Pause,
Expand,
SkipBack,
SkipForward,
LayoutGrid,
} from "lucide-react";
import { useState, useRef, useEffect, useCallback } from "react"; import { useState, useRef, useEffect, useCallback } from "react";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
import { formatTimeCode } from "@/lib/time"; import { formatTimeCode } from "@/lib/time";
import { EditableTimecode } from "@/components/ui/editable-timecode"; import { EditableTimecode } from "@/components/ui/editable-timecode";
import { FONT_CLASS_MAP } from "@/lib/font-config"; import { FONT_CLASS_MAP } from "@/lib/font-config";
import { useProjectStore } from "@/stores/project-store"; import { DEFAULT_CANVAS_SIZE, useProjectStore } from "@/stores/project-store";
import { TextElementDragState } from "@/types/editor"; import { TextElementDragState } from "@/types/editor";
import { import {
Popover, Popover,
@@ -43,8 +36,8 @@ interface ActiveElement {
export function PreviewPanel() { export function PreviewPanel() {
const { tracks, getTotalDuration, updateTextElement } = useTimelineStore(); const { tracks, getTotalDuration, updateTextElement } = useTimelineStore();
const { mediaItems } = useMediaStore(); const { mediaItems } = useMediaStore();
const { currentTime, toggle, setCurrentTime, isPlaying } = usePlaybackStore(); const { currentTime, toggle, setCurrentTime } = usePlaybackStore();
const { canvasSize } = useEditorStore(); const { activeProject } = useProjectStore();
const previewRef = useRef<HTMLDivElement>(null); const previewRef = useRef<HTMLDivElement>(null);
const containerRef = useRef<HTMLDivElement>(null); const containerRef = useRef<HTMLDivElement>(null);
const [previewDimensions, setPreviewDimensions] = useState({ const [previewDimensions, setPreviewDimensions] = useState({
@@ -52,7 +45,8 @@ export function PreviewPanel() {
height: 0, height: 0,
}); });
const [isExpanded, setIsExpanded] = useState(false); const [isExpanded, setIsExpanded] = useState(false);
const { activeProject } = useProjectStore();
const canvasSize = activeProject?.canvasSize || DEFAULT_CANVAS_SIZE;
const [dragState, setDragState] = useState<TextElementDragState>({ const [dragState, setDragState] = useState<TextElementDragState>({
isDragging: false, isDragging: false,
elementId: null, elementId: null,
@@ -867,7 +861,9 @@ function PreviewToolbar({
<Checkbox <Checkbox
id="none" id="none"
checked={layoutGuide.platform === null} checked={layoutGuide.platform === null}
onCheckedChange={() => toggleLayoutGuide(layoutGuide.platform || "tiktok")} onCheckedChange={() =>
toggleLayoutGuide(layoutGuide.platform || "tiktok")
}
/> />
<Label htmlFor="none">None</Label> <Label htmlFor="none">None</Label>
</div> </div>
@@ -876,7 +872,9 @@ function PreviewToolbar({
<Checkbox <Checkbox
id={platform} id={platform}
checked={layoutGuide.platform === platform} checked={layoutGuide.platform === platform}
onCheckedChange={() => toggleLayoutGuide(platform as PlatformLayout)} onCheckedChange={() =>
toggleLayoutGuide(platform as PlatformLayout)
}
/> />
<Label htmlFor={platform}>{label}</Label> <Label htmlFor={platform}>{label}</Label>
</div> </div>
+3 -1
View File
@@ -7,6 +7,8 @@ import { useTimelineStore } from "./timeline-store";
import { generateUUID } from "@/lib/utils"; import { generateUUID } from "@/lib/utils";
import { CanvasSize, CanvasMode } from "@/types/editor"; import { CanvasSize, CanvasMode } from "@/types/editor";
export const DEFAULT_CANVAS_SIZE: CanvasSize = { width: 1920, height: 1080 };
const DEFAULT_PROJECT: TProject = { const DEFAULT_PROJECT: TProject = {
id: generateUUID(), id: generateUUID(),
name: "Untitled", name: "Untitled",
@@ -18,7 +20,7 @@ const DEFAULT_PROJECT: TProject = {
blurIntensity: 8, blurIntensity: 8,
bookmarks: [], bookmarks: [],
fps: 30, fps: 30,
canvasSize: { width: 1920, height: 1080 }, canvasSize: DEFAULT_CANVAS_SIZE,
canvasMode: "preset", canvasMode: "preset",
}; };