Open source CapCut alternative.
TypeScript
fix(site): move the side panel's close button onto the first column
David Le9ab396fca6c0
diff --git a/site/src/cut/components/AudioPanel.tsx b/site/src/cut/components/AudioPanel.tsxindex f683c871..f46b1792 100644--- a/site/src/cut/components/AudioPanel.tsx+++ b/site/src/cut/components/AudioPanel.tsx@@ -79,7 +79,6 @@ export function AudioPanel({importing,sub,onSub,- closeInset,}: {projectId: string;importing: boolean;@@ -87,9 +86,6 @@ export function AudioPanel({* two columns (this panel + the sample library) like the Image/Video tabs. */sub: "voice" | "music";onSub: (v: "voice" | "music") => void;- /** When this is the panel's outermost column, the side panel's floating close- * button sits on this corner; keep the toggle clear of it. */- closeInset?: boolean;}) {const readOnly = useEditor((s) => s.readOnly);// The app-wide preview player: starting a clip stops the last one, here or@@ -111,7 +107,9 @@ export function AudioPanel({return (<>- <div className={cn("shrink-0 px-3.5 pt-4 pb-3", closeInset && "pr-12")}>+ {/* The side panel's floating close button sits on this corner; the+ right padding keeps the toggle clear of it. */}+ <div className="shrink-0 pt-4 pb-3 pr-12 pl-3.5"><AudioSubTabs value={sub} onChange={onSub} /></div>diff --git a/site/src/cut/components/SidePanel.tsx b/site/src/cut/components/SidePanel.tsxindex 4428544b..a467eacf 100644--- a/site/src/cut/components/SidePanel.tsx+++ b/site/src/cut/components/SidePanel.tsx@@ -315,7 +315,7 @@ export function SidePanel({</div>{tab === null ? null : (- <div className="relative flex min-h-0">+ <div className="flex min-h-0">{tab === "image" || tab === "video" ? (// The generate tabs are two columns: the generate input on the left,// the stock reference browser on the right. Clicking a stock tile loads@@ -323,10 +323,11 @@ export function SidePanel({<><divclassName={cn(- "flex w-[252px] min-h-0 shrink-0 flex-col",+ "relative flex w-[252px] min-h-0 shrink-0 flex-col",!sharedFeatures && "border-r border-border")}>+ <ClosePanelButton onClose={() => setTab(null)} />{tab === "image" ? (<ImageGenPanel projectId={projectId} />) : (@@ -352,16 +353,16 @@ export function SidePanel({<><divclassName={cn(- "flex w-[264px] min-h-0 shrink-0 flex-col",+ "relative flex w-[264px] min-h-0 shrink-0 flex-col",musicLibrary && "border-r border-border")}>+ <ClosePanelButton onClose={() => setTab(null)} /><AudioPanelprojectId={projectId}importing={importing}sub={audioSub}onSub={setAudioSub}- closeInset={!musicLibrary}/></div>{musicLibrary && (@@ -371,7 +372,8 @@ export function SidePanel({)}</>) : (- <div className="flex w-[264px] min-h-0 shrink-0 flex-col">+ <div className="relative flex w-[264px] min-h-0 shrink-0 flex-col">+ <ClosePanelButton onClose={() => setTab(null)} />{tab === "media" && (<MediaPanel projectId={projectId} onImport={onImport} importing={importing} />)}@@ -380,18 +382,6 @@ export function SidePanel({{tab === "publish" && <PublishPanel />}</div>)}- {/* Floats over the panel's own header row; a solid face keeps it- legible where a column scrolls beneath it. Same action as- clicking the active rail tile. */}- <button- type="button"- aria-label="Close panel"- title="Close panel"- className="absolute top-2.5 right-2.5 z-10 grid size-7 place-items-center rounded-md bg-card text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"- onClick={() => setTab(null)}- >- <X className="size-4" />- </button></div>)}</div>@@ -428,6 +418,23 @@ function forDrags(props: DragProps, takesRef: (ref: AssetRef) => boolean): DragP};}+/** Floats over the first column's header row, whatever panel owns it; a solid+ * face keeps it legible where the column scrolls beneath it. Same action as+ * clicking the active rail tile. */+function ClosePanelButton({ onClose }: { onClose: () => void }) {+ return (+ <button+ type="button"+ aria-label="Close panel"+ title="Close panel"+ className="absolute top-2.5 right-2.5 z-10 grid size-7 place-items-center rounded-md bg-card text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"+ onClick={onClose}+ >+ <X className="size-4" />+ </button>+ );+}+function PanelHead({ title }: { title: string }) {return (<div className="flex h-12 shrink-0 items-center pr-2.5 pl-4">diff --git a/site/src/cut/components/StockVideosPanel.tsx b/site/src/cut/components/StockVideosPanel.tsxindex e30be5f1..2c2a94b7 100644--- a/site/src/cut/components/StockVideosPanel.tsx+++ b/site/src/cut/components/StockVideosPanel.tsx@@ -101,13 +101,10 @@ export function StockVideosPanel() {</p>) : view === "root" ? (<>- {/* The topmost section head shares its row with the side panel's- floating close button; inset its View all clear of it. */}{characters.length > 0 && (<section className="shrink-0"><SectionHeadtitle="Talking Characters"- className="pr-7"onViewAll={characters.length > SECTION_PREVIEW ? () => go("characters") : undefined}@@ -118,7 +115,6 @@ export function StockVideosPanel() {<section className="mt-3 shrink-0"><SectionHeadtitle="Stock Videos"- className={characters.length === 0 ? "pr-7" : undefined}onViewAll={footage.length > SECTION_PREVIEW ? () => go("videos") : undefined}/>{footage.length > 0 ? (