YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix(onboarding): one window size for every setup step (#6194)
Louis Beaumont6e75a85d2971
diff --git a/apps/screenpipe-app-tauri/app/onboarding/page.test.tsx b/apps/screenpipe-app-tauri/app/onboarding/page.test.tsxindex 50e2f26a7..6fc66c511 100644--- a/apps/screenpipe-app-tauri/app/onboarding/page.test.tsx+++ b/apps/screenpipe-app-tauri/app/onboarding/page.test.tsx@@ -237,13 +237,33 @@ describe("enterprise onboarding authentication", () => {render(<OnboardingPage />);await waitFor(() =>- expect(mocks.setWindowSize).toHaveBeenCalledWith("Onboarding", 500, 620),+ expect(mocks.setWindowSize).toHaveBeenCalledWith("Onboarding", 500, 680),);expect(screen.getByTestId("onboarding-scroll-region")).toHaveClass("overflow-y-auto",);});+ // Per-slide sizes made the window jump on every step and blew up to 760x720+ // on the payment slide. One size, applied once, for the whole flow.+ it("sizes the window once instead of resizing per slide", async () => {+ mocks.enterprisePolicy.isManagedDeployment = false;+ mocks.settings.user = { has_payment_method: false, token: "tok" };+ onboardingData.currentStep = "engine";++ render(<OnboardingPage />);+ await waitFor(() =>+ expect(mocks.setWindowSize).toHaveBeenCalledWith("Onboarding", 500, 680),+ );++ // Advancing onto the payment slide, the step that used to widen the window+ // to 760x720, must not resize it again.+ fireEvent.click(await screen.findByRole("button", { name: "finish engine" }));+ expect(await screen.findByText("plan selection")).toBeInTheDocument();++ expect(mocks.setWindowSize).toHaveBeenCalledTimes(1);+ });+it("managed onboarding completes from engine without consumer pricing", async () => {onboardingData.currentStep = "engine";diff --git a/apps/screenpipe-app-tauri/app/onboarding/page.tsx b/apps/screenpipe-app-tauri/app/onboarding/page.tsxindex 11477b2d1..c53a9c32c 100644--- a/apps/screenpipe-app-tauri/app/onboarding/page.tsx+++ b/apps/screenpipe-app-tauri/app/onboarding/page.tsx@@ -29,19 +29,18 @@ type SlideKey =| "engine"| "plan";-const SLIDE_WINDOW_SIZES: Record<SlideKey, { width: number; height: number }> =- {- login: { width: 500, height: 480 },- acquisition: { width: 500, height: 560 },- // Taller than the other 560 slides: the wheel now sits under the data dir- // chip and above the pause note, and at 560 the note was clipped by the- // window edge (caught by the trust-affordance E2E screenshot, which is why- // that spec asserts the note is inside the viewport).- permissions: { width: 500, height: 660 },- timeline: { width: 500, height: 680 },- engine: { width: 500, height: 620 },- plan: { width: 760, height: 720 },- };+// One size for the whole flow. Per-slide sizes made the window jump on every+// step, worst on "plan", which widened to 760 even though the content column is+// capped at max-w-lg — 124px of dead margin per side — and was still 42px too+// short to show the free-plan link. 680 is the tallest any slide previously+// asked for (timeline), so every other step only gains slack: the permissions+// wheel and its pause note, which the trust-affordance E2E asserts stay inside+// the viewport, still fit. Steps that need less stay centered by the wrapper's+// justify-center, and anything taller still scrolls.+//+// Must match the inner_size the Rust side creates the window at, in+// window/show.rs, so opening onboarding doesn't resize on first paint.+const ONBOARDING_WINDOW_SIZE = { width: 500, height: 680 };// When shown, the timeline choice sits before "engine" so disableTimeline is// persisted before the engine spawns and reads it — no restart needed.@@ -108,9 +107,12 @@ const EndowedProgress = ({</div>);-const setWindowSizeForSlide = async (slide: SlideKey) => {+// Corrective only: Rust already builds the window at this size. It still runs+// so a window left at an old per-slide size — an install that upgraded midway+// through onboarding — snaps back to the shared size instead of staying wide.+const applyOnboardingWindowSize = async () => {try {- const { width, height } = SLIDE_WINDOW_SIZES[slide];+ const { width, height } = ONBOARDING_WINDOW_SIZE;await commands.setWindowSize("Onboarding", width, height);} catch {// non-critical@@ -280,9 +282,13 @@ export default function OnboardingPage() {onboardingData.isCompleted,]);- // Set window size + track view when slide changes+ // The window is sized once, not per slide, so stepping through setup no+ // longer resizes it under the user.+ useEffect(() => {+ void applyOnboardingWindowSize();+ }, []);+useEffect(() => {- setWindowSizeForSlide(currentSlide);setIsVisible(true);posthog.capture(`onboarding_${currentSlide}_viewed`);}, [currentSlide]);diff --git a/apps/screenpipe-app-tauri/components/onboarding/plan-selection-step.test.tsx b/apps/screenpipe-app-tauri/components/onboarding/plan-selection-step.test.tsxindex 67a2d54eb..76e5e7b6d 100644--- a/apps/screenpipe-app-tauri/components/onboarding/plan-selection-step.test.tsx+++ b/apps/screenpipe-app-tauri/components/onboarding/plan-selection-step.test.tsx@@ -91,6 +91,22 @@ describe("onboarding card capture", () => {);});+ // The step used to hard-code a 520px iframe inside a 460px box, which forced+ // the onboarding window wider and taller than every other slide and still cut+ // off the free-plan link. It now fills whatever the shared window leaves.+ it("fills the available height instead of forcing a fixed iframe size", async () => {+ render(<PlanSelectionStep handleNextSlide={vi.fn()} />);++ const root = screen.getByTestId("onboarding-card-capture");+ expect(root.className).toContain("flex-1");+ expect(root.className).not.toMatch(/max-w-/);++ const frame = await screen.findByTestId("onboarding-card-frame");+ expect(frame.className).toContain("h-full");+ expect(frame.className).not.toMatch(/h-\[\d+px\]/);+ expect(frame.parentElement?.className).toContain("flex-1");+ });+it("recreates embedded checkout with monthly billing when switched", async () => {render(<PlanSelectionStep handleNextSlide={vi.fn()} />);await waitFor(() => expect(mocks.fetch).toHaveBeenCalledOnce());diff --git a/apps/screenpipe-app-tauri/components/onboarding/plan-selection-step.tsx b/apps/screenpipe-app-tauri/components/onboarding/plan-selection-step.tsxindex 77c957e6a..5151b3e99 100644--- a/apps/screenpipe-app-tauri/components/onboarding/plan-selection-step.tsx+++ b/apps/screenpipe-app-tauri/components/onboarding/plan-selection-step.tsx@@ -212,8 +212,12 @@ export default function PlanSelectionStep({};return (+ // Grows into whatever the shared onboarding window leaves after the heading+ // and interval toggle, so the checkout box never overflows the window the+ // way the old fixed 520px iframe did. max-w-2xl was dead: the onboarding+ // page wraps every slide in max-w-lg.<div- className="mx-auto w-full max-w-2xl"+ className="mx-auto flex min-h-0 w-full flex-1 flex-col"data-testid="onboarding-card-capture"><div className="mb-4 text-center">@@ -239,7 +243,7 @@ export default function PlanSelectionStep({</button></div>- <div className="relative min-h-[460px] border bg-white">+ <div className="relative min-h-[360px] flex-1 border bg-white">{busy && (<div className="absolute inset-0 flex items-center justify-center font-mono text-[11px] text-muted-foreground">loading secure payment form@@ -251,7 +255,10 @@ export default function PlanSelectionStep({src={frameUrl}title="secure Stripe payment form"allow="payment"- className="h-[520px] w-full border-0"+ // Fills the box exactly. A percentage height would not resolve+ // against a flex-grown parent for a replaced element, leaving the+ // iframe at its 150px intrinsic default.+ className="absolute inset-0 h-full w-full border-0"data-testid="onboarding-card-frame"/>)}diff --git a/apps/screenpipe-app-tauri/src-tauri/src/window/show.rs b/apps/screenpipe-app-tauri/src-tauri/src/window/show.rsindex 1c386761c..76fd93e5f 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/window/show.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/window/show.rs@@ -1541,13 +1541,16 @@ impl ShowRewindWindow {return ShowRewindWindow::Home { page: None }.show(app);}- // Clamp onboarding window size to primary monitor to prevent min > max panic+ // One size for every onboarding slide (see ONBOARDING_WINDOW_SIZE in+ // app/onboarding/page.tsx) so stepping through setup never resizes+ // the window. Still clamped to the primary monitor to prevent a+ // min > max panic on small displays; slides scroll when clamped.let (width, height) = if let Ok(Some(monitor)) = app.primary_monitor() {let logical: tauri::LogicalSize<f64> =monitor.size().to_logical(monitor.scale_factor());- (500.0_f64.min(logical.width), 560.0_f64.min(logical.height))+ (500.0_f64.min(logical.width), 680.0_f64.min(logical.height))} else {- (500.0, 560.0)+ (500.0, 680.0)};let min = self.id().min_size().unwrap_or((0.0, 0.0));let clamped_min = (min.0.min(width), min.1.min(height));