Files
OpenCut/apps/web/src/components/editor-header.tsx
T

69 lines
1.8 KiB
TypeScript
Raw Normal View History

2025-06-22 13:07:02 +02:00
"use client";
import Link from "next/link";
import { Button } from "./ui/button";
import { ChevronLeft, Download } from "lucide-react";
import { useTimelineStore } from "@/stores/timeline-store";
import { HeaderBase } from "./header-base";
import { formatTimeCode } from "@/lib/time";
2025-07-01 16:06:36 +02:00
import { useProjectStore } from "@/stores/project-store";
import { KeyboardShortcutsHelp } from "./keyboard-shortcuts-help";
2025-06-22 13:07:02 +02:00
export function EditorHeader() {
2025-06-22 22:10:50 +02:00
const { getTotalDuration } = useTimelineStore();
2025-07-01 16:06:36 +02:00
const { activeProject } = useProjectStore();
2025-06-22 13:07:02 +02:00
const handleExport = () => {
// TODO: Implement export functionality
console.log("Export project");
};
const leftContent = (
<div className="flex items-center gap-2">
<Link
2025-07-01 16:06:36 +02:00
href="/projects"
className="font-medium tracking-tight flex items-center gap-2 hover:opacity-80 transition-opacity"
>
<ChevronLeft className="h-4 w-4" />
2025-07-01 16:06:36 +02:00
<span className="text-sm">{activeProject?.name}</span>
</Link>
</div>
2025-06-22 13:07:02 +02:00
);
const centerContent = (
2025-07-09 21:45:25 +02:00
<div className="flex items-center gap-2 text-xs">
<span>
{formatTimeCode(
getTotalDuration(),
"HH:MM:SS:FF",
activeProject?.fps || 30
)}
</span>
2025-06-22 13:07:02 +02:00
</div>
);
const rightContent = (
<nav className="flex items-center gap-2">
<KeyboardShortcutsHelp />
<Button
size="sm"
variant="primary"
className="h-7 text-xs"
onClick={handleExport}
>
2025-06-22 13:07:02 +02:00
<Download className="h-4 w-4" />
<span className="text-sm">Export</span>
</Button>
</nav>
);
return (
<HeaderBase
leftContent={leftContent}
centerContent={centerContent}
rightContent={rightContent}
2025-07-09 21:45:25 +02:00
className="bg-background h-[3.2rem] px-4"
2025-06-22 13:07:02 +02:00
/>
);
}