diff --git a/apps/web/src/components/editor-header.tsx b/apps/web/src/components/editor-header.tsx
index 5131230..aaea97b 100644
--- a/apps/web/src/components/editor-header.tsx
+++ b/apps/web/src/components/editor-header.tsx
@@ -6,6 +6,7 @@ import { ChevronLeft, Download } from "lucide-react";
import { useTimelineStore } from "@/stores/timeline-store";
import { HeaderBase } from "./header-base";
import { ProjectNameEditor } from "./editor/project-name-editor";
+import { formatTimeCode } from "@/lib/time";
export function EditorHeader() {
const { getTotalDuration } = useTimelineStore();
@@ -15,13 +16,6 @@ export function EditorHeader() {
console.log("Export project");
};
- // Format duration from seconds to MM:SS format
- const formatDuration = (seconds: number): string => {
- const minutes = Math.floor(seconds / 60);
- const remainingSeconds = Math.floor(seconds % 60);
- return `${minutes}:${remainingSeconds.toString().padStart(2, "0")}`;
- };
-
const leftContent = (
- {formatDuration(getTotalDuration())}
+ {formatTimeCode(getTotalDuration(), "HH:MM:SS:CS")}
);
diff --git a/apps/web/src/components/editor/preview-panel.tsx b/apps/web/src/components/editor/preview-panel.tsx
index 21d39d4..6590136 100644
--- a/apps/web/src/components/editor/preview-panel.tsx
+++ b/apps/web/src/components/editor/preview-panel.tsx
@@ -24,6 +24,7 @@ import {
import { Play, Pause, Volume2, VolumeX, Plus, Square } from "lucide-react";
import { useState, useRef, useEffect } from "react";
import { cn } from "@/lib/utils";
+import { formatTimeCode } from "@/lib/time";
interface ActiveClip {
clip: TimelineClip;
@@ -236,7 +237,7 @@ export function PreviewPanel() {
}
function PreviewToolbar({ hasAnyClips }: { hasAnyClips: boolean }) {
- const { isPlaying, toggle } = usePlaybackStore();
+ const { isPlaying, toggle, currentTime } = usePlaybackStore();
const {
canvasSize,
canvasPresets,
@@ -244,7 +245,7 @@ function PreviewToolbar({ hasAnyClips }: { hasAnyClips: boolean }) {
setCanvasSizeFromAspectRatio,
} = useEditorStore();
const { mediaItems } = useMediaStore();
- const { tracks } = useTimelineStore();
+ const { tracks, getTotalDuration } = useTimelineStore();
// Find the current preset based on canvas size
const currentPreset = canvasPresets.find(
@@ -289,11 +290,12 @@ function PreviewToolbar({ hasAnyClips }: { hasAnyClips: boolean }) {
- 00:00:00:00/00:00:00:00
+ {formatTimeCode(currentTime, "HH:MM:SS:CS")}/
+ {formatTimeCode(getTotalDuration(), "HH:MM:SS:CS")}