Skip to content

Open source CapCut alternative.

TypeScript

fix(cut): replace the library panel title with the folder breadcrumb

David Le4b85229342e6
diff --git a/site/src/cut/components/SidePanel.tsx b/site/src/cut/components/SidePanel.tsx
index 6405c6d1..8d82e7e7 100644
--- a/site/src/cut/components/SidePanel.tsx
+++ b/site/src/cut/components/SidePanel.tsx
@@ -788,7 +788,20 @@ function LibraryPanel({ projectId }: { projectId: string }) {
return (
<>
- <PanelHead title="Library" />
+ {openFolder !== null ? (
+ <div className="flex h-12 shrink-0 items-center pr-2.5 pl-2.5">
+ <FolderCrumb
+ className="text-sm"
+ root="Library"
+ name={openFolderName ?? "Folder"}
+ mime={LIBRARY_MOVE_MIME}
+ onBack={() => setOpenFolder(null)}
+ onDropOut={(ids) => ids.forEach((id) => void move(id, null))}
+ />
+ </div>
+ ) : (
+ <PanelHead title="Library" />
+ )}
{templates.length > 0 && (
<div className="shrink-0 px-3.5 pb-3">
<div className="flex flex-col gap-1.5">
@@ -817,17 +830,7 @@ function LibraryPanel({ projectId }: { projectId: string }) {
</div>
</div>
)}
- {openFolder !== null ? (
- <div className="shrink-0 px-3.5 pb-2.5">
- <FolderCrumb
- root="Library"
- name={openFolderName ?? "Folder"}
- mime={LIBRARY_MOVE_MIME}
- onBack={() => setOpenFolder(null)}
- onDropOut={(ids) => ids.forEach((id) => void move(id, null))}
- />
- </div>
- ) : folders.length > 0 ? (
+ {openFolder === null && folders.length > 0 ? (
<div className="shrink-0 px-3.5">
<FolderShelf
folders={folders}
diff --git a/site/src/cut/components/desktopFolders.tsx b/site/src/cut/components/desktopFolders.tsx
index fac9b683..6ef40569 100644
--- a/site/src/cut/components/desktopFolders.tsx
+++ b/site/src/cut/components/desktopFolders.tsx
@@ -160,16 +160,21 @@ export function FolderCrumb({
mime,
onBack,
onDropOut,
+ className,
}: {
root: string;
name: string;
mime: string;
onBack: () => void;
onDropOut: (ids: string[]) => void;
+ className?: string;
}) {
const [over, setOver] = useState(false);
return (
- <div className="flex items-center gap-2 text-lg font-semibold tracking-tight" data-no-marquee>
+ <div
+ className={cn("flex items-center gap-2 text-lg font-semibold tracking-tight", className)}
+ data-no-marquee
+ >
<button
className={cn(
"rounded-md px-1.5 py-0.5 text-muted-foreground transition-colors hover:text-foreground",