From 7bd952b080e2bbba47a063b681d0a668b20ae8cb Mon Sep 17 00:00:00 2001 From: Kha Nguyen Date: Wed, 23 Jul 2025 17:08:56 -0500 Subject: [PATCH] fix: add breadcrumb to editor header --- apps/web/src/components/editor-header.tsx | 103 +++++++++++++--------- 1 file changed, 60 insertions(+), 43 deletions(-) diff --git a/apps/web/src/components/editor-header.tsx b/apps/web/src/components/editor-header.tsx index 7daf5270..848998ba 100644 --- a/apps/web/src/components/editor-header.tsx +++ b/apps/web/src/components/editor-header.tsx @@ -2,14 +2,21 @@ import Link from "next/link"; import { Button } from "./ui/button"; -import { ChevronLeft, Download } from "lucide-react"; +import { ChevronLeft, Download, SquarePen } from "lucide-react"; import { useTimelineStore } from "@/stores/timeline-store"; import { HeaderBase } from "./header-base"; import { formatTimeCode } from "@/lib/time"; import { useProjectStore } from "@/stores/project-store"; import { KeyboardShortcutsHelp } from "./keyboard-shortcuts-help"; -import { useState, useRef } from "react"; +import { useState, useRef, MouseEvent } from "react"; import { Input } from "@/components/ui/input"; +import { + Breadcrumb, + BreadcrumbItem, + BreadcrumbLink, + BreadcrumbList, + BreadcrumbSeparator, +} from "./ui/breadcrumb"; export function EditorHeader() { const { getTotalDuration } = useTimelineStore(); @@ -24,10 +31,11 @@ export function EditorHeader() { console.log("Export project"); }; - const handleNameClick = () => { + const handleNameEdit = (e: MouseEvent) => { if (!activeProject) return; - setNewName(activeProject.name); + e.stopPropagation(); setIsEditing(true); + setNewName(activeProject.name); }; const handleNameSave = async () => { @@ -49,58 +57,67 @@ export function EditorHeader() { const leftContent = (
- - - -
- {isEditing ? ( - setNewName(e.target.value)} - onBlur={handleNameSave} - onKeyDown={handleInputKeyDown} - onFocus={(e) => e.target.select()} - maxLength={64} - aria-label="Project name" - autoFocus - /> - ) : ( - e.key === "Enter" && handleNameClick()} - > -
- {activeProject?.name} -
-
- )} -
+ + + + + + All Projects + + + + + + {isEditing ? ( + setNewName(e.target.value)} + onBlur={handleNameSave} + onKeyDown={handleInputKeyDown} + onFocus={(e) => e.target.select()} + maxLength={64} + aria-label="Project name" + autoFocus + /> + ) : ( + +
+ {activeProject?.name} +
+ +
+ )} +
+
+
); const centerContent = ( -
+
{formatTimeCode( getTotalDuration(), "HH:MM:SS:FF", - activeProject?.fps || 30 + activeProject?.fps || 30, )}
); const rightContent = ( -