Skip to content

Open source CapCut alternative.

TypeScript

fix(site): let the editor shell track the window

David Lea2227cf20c73
diff --git a/site/src/cut/components/Editor.tsx b/site/src/cut/components/Editor.tsx
index 6e66d2c4..aab9edcd 100644
--- a/site/src/cut/components/Editor.tsx
+++ b/site/src/cut/components/Editor.tsx
@@ -662,7 +662,15 @@ export function Editor({
: true;
return (
- <div className="flex h-full min-w-[900px] overflow-hidden">
+ // The shell tracks the window rather than flooring at a width the window
+ // has to scroll to reach. A floor moved the problem instead of solving it:
+ // the editor kept its full size and the page scrolled sideways, so the
+ // preview ran off the edge, the top bar measured a header wider than the
+ // screen and never folded its buttons away, and the chat panel opened into
+ // space that was not there. Shrinking, each of those resolves on its own —
+ // the panels give up width, the top bar collapses to a menu, and the
+ // timeline scrolls inside itself as it always has.
+ <div className="flex h-full min-w-0 overflow-hidden">
<div className="grid min-w-0 flex-1 grid-rows-[46px_minmax(0,1fr)_auto]">
{viewer ? (
<ViewerTopBar />
diff --git a/site/src/cut/hooks/useIsNarrow.ts b/site/src/cut/hooks/useIsNarrow.ts
index 799274ca..61c3cc30 100644
--- a/site/src/cut/hooks/useIsNarrow.ts
+++ b/site/src/cut/hooks/useIsNarrow.ts
@@ -2,8 +2,10 @@
import { useEffect, useState } from "react";
-/** Below this the editor cannot lay out: its shell alone floors at 900px of
- * fixed chrome before the preview canvas gets a pixel. */
+/** The width below which the editor stops being worth opening. It still lays
+ * out down here — the panels give up width, the top bar folds its buttons into
+ * a menu, the chat panel overlays rather than docking — but its fixed chrome
+ * leaves the preview so little room that there is nothing left to edit with. */
export const NARROW_MAX_WIDTH = 900;
/**