Skip to content

Open source CapCut alternative.

TypeScript

fix(site): a share opens on a panel it actually offers

David Le6cb7134bae12
diff --git a/site/src/app/cut/s/[token]/SharedProjectView.tsx b/site/src/app/cut/s/[token]/SharedProjectView.tsx
index a1847c04..895ee52b 100644
--- a/site/src/app/cut/s/[token]/SharedProjectView.tsx
+++ b/site/src/app/cut/s/[token]/SharedProjectView.tsx
@@ -127,8 +127,14 @@ export function SharedProjectView() {
// Dynamic viewport units, not h-screen: on a phone the browser's own chrome
// slides in and out, and 100vh measures the tallest state — so the bottom of
// a fixed-height page sits under the toolbar for most of a visit.
+ //
+ // `app-surface` is what repoints --background to the product white for the
+ // whole document (see globals.css). A share mounts the editor, so it needs
+ // the same surface the app runs on: without it every bg-background control
+ // inside — the preview's zoom pill, the panel chrome — resolves against the
+ // cream landing token and the viewer sees a beige editor on a white page.
return (
- <div className="h-[100dvh] bg-white font-system text-foreground antialiased">
+ <div className="app-surface h-[100dvh] bg-white font-system text-foreground antialiased">
<Suspense>
<SharedProject />
</Suspense>
diff --git a/site/src/cut/components/SidePanel.tsx b/site/src/cut/components/SidePanel.tsx
index 3216f67e..58b4b688 100644
--- a/site/src/cut/components/SidePanel.tsx
+++ b/site/src/cut/components/SidePanel.tsx
@@ -168,8 +168,14 @@ export function SidePanel({
const [tabPref, setTab] = useLocalPref<Tab | null>("cut-side-tab", "media", (v) =>
v === null || TABS.some((t) => t.id === v)
);
- // The remembered tab may be hidden in this share; fall back to collapsed.
- const tab = tabPref !== null && !visibleTabs.some((t) => t.id === tabPref) ? null : tabPref;
+ // The remembered tab may be hidden in this share — the viewer's own last tab
+ // in their own editor, which this share never offered. A share opens on what
+ // it does offer, so a link shared for its subtitles lands on the transcript
+ // with the rail open.
+ const tab =
+ tabPref !== null && !visibleTabs.some((t) => t.id === tabPref)
+ ? (visibleTabs[0]?.id ?? null)
+ : tabPref;
// The Audio tab's Voice/Music sub-tab lives here so the Music sub-tab can lay
// out as two columns — the generator plus the sample library — like Image/Video.
const [audioSub, setAudioSub] = useLocalPref<"voice" | "music">(