import type { MouseEvent } from "react"; import { RotateCcw, RotateCw, Camera } from "../icons/SystemIcons"; import { STUDIO_INSPECTOR_PANELS_ENABLED, STUDIO_MANUAL_EDITING_DISABLED_TITLE, STUDIO_STORYBOARD_ENABLED, } from "./editor/manualEditingAvailability"; import { getHistoryShortcutLabel } from "../utils/studioHelpers"; import { useStudioShellContext } from "../contexts/StudioContext"; import { usePanelLayoutContext } from "../contexts/PanelLayoutContext"; import { useViewMode, type StudioViewMode } from "../contexts/ViewModeContext"; import { trackStudioEvent } from "../utils/studioTelemetry"; export interface StudioHeaderProps { captureFrameHref: string; captureFrameFilename: string; handleCaptureFrameClick: (event: MouseEvent) => void; refreshCaptureFrameTime: () => void; inspectorButtonActive: boolean; inspectorPanelActive: boolean; onExport?: () => void; } function HyperframesLogo() { // Full logo from logo-dark.svg (263×79): heygen label + gradient mark + hyperframes wordmark. // All fill="black" paths inverted to white for the dark header. const height = 28; const width = Math.round(height * (263 / 79)); return ( {/* heygen label */} {/* gradient icon mark */} {/* hyperframes wordmark */} ); } const VIEW_MODE_OPTIONS: Array<{ mode: StudioViewMode; label: string }> = [ { mode: "storyboard", label: "Storyboard" }, { mode: "timeline", label: "Preview" }, ]; /** Segmented control switching the main stage between storyboard and preview. */ function ViewModeToggle() { const { viewMode, setViewMode } = useViewMode(); return (
{VIEW_MODE_OPTIONS.map(({ mode, label }) => { const active = viewMode === mode; return ( ); })}
); } // fallow-ignore-next-line complexity export function StudioHeader({ captureFrameHref, captureFrameFilename, handleCaptureFrameClick, refreshCaptureFrameTime, inspectorButtonActive, inspectorPanelActive, onExport, }: StudioHeaderProps) { const { projectId, editHistory, handleUndo, handleRedo } = useStudioShellContext(); const { rightCollapsed, setRightCollapsed, setRightPanelTab } = usePanelLayoutContext(); return (
{/* Left: logo + project name */}
{projectId}
{/* Center: storyboard / preview toggle (flag-gated) */} {STUDIO_STORYBOARD_ENABLED && } {/* Right: toolbar buttons */}
{ trackStudioEvent("toolbar_action", { action: "capture_frame" }); handleCaptureFrameClick(e); }} onFocus={refreshCaptureFrameTime} onPointerDown={refreshCaptureFrameTime} className="h-7 flex items-center gap-1.5 px-2.5 rounded-md text-[11px] font-medium text-neutral-400 transition-colors hover:text-neutral-200 hover:bg-neutral-800" title="Capture current frame" aria-label="Capture current frame" > Capture
); }