From e55b475f3007f59e6ffcec9a1466ddb6fa1e5d1f Mon Sep 17 00:00:00 2001 From: Tonio Date: Mon, 30 Nov 2026 05:42:22 +0000 Subject: [PATCH] Polish the onboarding model connection cards (#23255) ## Thinking Path > - Paperclip helps people manage AI agents. > - Onboarding connects the first agent to a model provider. > - Both subscription flows ask the user to complete an authorization step. > - Moving that action into the provider card keeps the footer stable. > - The updated cards also keep their spacing through loading and mode changes. ## Linked Issues or Issue Description **Subsystem affected** First-agent onboarding. **Current behavior** The sign-in action changes the footer label during connection. Switching credential modes shifts the layout. **Proposed behavior** Show the provider sign-in action beside its code. Keep Next disabled while connecting. Advance after verification. ## What Changed - Align the Claude and OpenAI code controls, instructions and provider marks. - Reserve the loaded card height and animate the API controls together. - Update the standalone walkthrough with simulated provider approvals. ## Verification - Browser walkthroughs covered both simulated approvals and automatic advance to Review before integration with master. - Measured equal loading and ready heights, API field spacing, and mode-switch positions in the local preview. - On revision `7c07c13c5f`, UI typecheck passed, 31 focused tests passed, and the Chromium Claude paste-to-chat journey passed. ## Risks Local and hosted login use different retry paths. Check both during review. ## Model Used OpenAI Codex, GPT-6, with repository and browser tools. ## Checklist - [x] Included project context, issue description, verification scope and risks. - [x] Described the model and tools used. - [x] Checked the roadmap for overlapping onboarding work. - [ ] Verify final revision in CI and resolve review feedback. - [x] I have searched GitHub for duplicate or related PRs and linked them above Related prior work includes #19557 and #13499. --------- Co-authored-by: Paperclip --- .../e2e/conference-room-typing-intro.spec.ts | 3 +- tests/e2e/onboarding-resume.spec.ts | 4 +- tests/e2e/onboarding.spec.ts | 10 ++- ui/src/components/AdapterLoginChrome.tsx | 65 +++++++++++++++++-- ui/src/components/OnboardingWizard.tsx | 63 +++++++++++------- ui/src/components/onboarding/FooterNav.tsx | 4 +- .../onboarding/SavedProviderKeySelect.tsx | 2 +- ui/src/index.css | 6 ++ ui/src/wizard-preview-main.tsx | 33 ++++++++-- 9 files changed, 147 insertions(+), 43 deletions(-) diff --git a/tests/e2e/conference-room-typing-intro.spec.ts b/tests/e2e/conference-room-typing-intro.spec.ts index 40f675d78b9..e251a62946a 100644 --- a/tests/e2e/conference-room-typing-intro.spec.ts +++ b/tests/e2e/conference-room-typing-intro.spec.ts @@ -144,7 +144,8 @@ test.describe("Chat launch after onboarding wizard", () => { await runOnboardingWizard(page, companyName, { source: /Claude/, complete: async () => { const code = page.getByRole("textbox", { name: "Authorization code", exact: true }); await expect(code).toBeVisible({ timeout: 20_000 }); - await expect(page.getByRole("button", { name: "Sign in to Claude", exact: true })).toBeEnabled(); + await expect(page.getByRole("link", { name: "Sign in", exact: true })).toBeVisible(); + await expect(page.getByRole("button", { name: "Next", exact: true })).toBeDisabled(); await expect(page.getByRole("button", { name: "Connect", exact: true })).toHaveCount(0); await code.evaluate(input => { const clipboardData = new DataTransfer(); diff --git a/tests/e2e/onboarding-resume.spec.ts b/tests/e2e/onboarding-resume.spec.ts index 50e0800751d..9af9bf635e0 100644 --- a/tests/e2e/onboarding-resume.spec.ts +++ b/tests/e2e/onboarding-resume.spec.ts @@ -195,8 +195,8 @@ test.describe("Onboarding wizard", () => { await source.waitFor({ timeout: 30_000 }); await source.click(); - const cardInstruction = page.getByText("then come back and enter authorization code"); - const authorizationLink = page.getByRole("link", { name: /^Sign in to / }); + const cardInstruction = page.getByText("Return to this window and enter the authorization code."); + const authorizationLink = page.getByRole("link", { name: "Sign in", exact: true }); await expect(cardInstruction).toBeVisible({ timeout: 30_000 }); await expect(authorizationLink).toBeVisible({ timeout: 15_000 }); diff --git a/tests/e2e/onboarding.spec.ts b/tests/e2e/onboarding.spec.ts index c9a90b78079..cae3be267ff 100644 --- a/tests/e2e/onboarding.spec.ts +++ b/tests/e2e/onboarding.spec.ts @@ -388,7 +388,7 @@ test.describe("Onboarding wizard", () => { // Nothing before the row is answered: the card is the answer to the tile, // and the button has nothing to do until there is a source to do it with. - const cardInstruction = page.getByText("then come back and enter authorization code"); + const cardInstruction = page.getByText("Return to this window and enter the authorization code."); await expect(cardInstruction).toHaveCount(0); await expect(page.getByRole("button", { name: "Next", exact: true })).toBeDisabled(); @@ -399,9 +399,7 @@ test.describe("Onboarding wizard", () => { await source.click(); await expect(cardInstruction).toBeVisible({ timeout: 30_000 }); - // One destination, two ways to it: the card's own link for anyone - // finishing in another browser, and the step's button for the flow. - const cardLink = page.getByRole("link", { name: /^Sign in to / }); + const cardLink = page.getByRole("link", { name: "Sign in", exact: true }); await expect(cardLink).toBeVisible({ timeout: 15_000 }); await expect(cardLink).toHaveAttribute("href", /claude\.ai\/oauth\/authorize/); await expect.poll(() => persistedAgentStatus).toBe(200); @@ -409,8 +407,8 @@ test.describe("Onboarding wizard", () => { expect(persisted.ok()).toBe(true); expect(await persisted.json()).toMatchObject({ id: persistedAgentId, name: "Ada", defaultEnvironmentId: null }); await expect( - page.getByRole("button", { name: /^Sign in to / }), - ).toBeEnabled({ timeout: 15_000 }); + page.getByRole("button", { name: "Next", exact: true }), + ).toBeDisabled({ timeout: 15_000 }); // No "Use saved login" here: the hire step applies a stored login itself. await expect(page.getByRole("button", { name: "Use saved login" })).toHaveCount(0); expect(hireCalled).toBe(false); diff --git a/ui/src/components/AdapterLoginChrome.tsx b/ui/src/components/AdapterLoginChrome.tsx index f72e5eb7e46..645eaa897bd 100644 --- a/ui/src/components/AdapterLoginChrome.tsx +++ b/ui/src/components/AdapterLoginChrome.tsx @@ -1,4 +1,4 @@ -import { useEffect, useId, useRef, useState, type ClipboardEvent, type ReactNode } from "react"; +import { createContext, useContext, useEffect, useId, useRef, useState, type ClipboardEvent, type ReactNode } from "react"; import { AnimatePresence, motion } from "motion/react"; import { Copy, Check, Loader2 } from "lucide-react"; @@ -72,6 +72,7 @@ export function connectSourceName(adapterType: string): string { */ export function OnboardingLoginCard({ instruction, + revealTogether = false, loading = false, children, }: { @@ -81,6 +82,7 @@ export function OnboardingLoginCard({ * be mono to read as a name rather than as prose. */ instruction: ReactNode; + revealTogether?: boolean; /** * Show a spinner instead of the contents, at the same height. * @@ -93,6 +95,25 @@ export function OnboardingLoginCard({ loading?: boolean; children: ReactNode; }) { + if (revealTogether) { + return ( +
+
+
{instruction}
+ {children} +
+ {loading && ( +
+ +
+ )} +
+ ); + } + if (loading) { return (
{/* The row is the instruction alone. It shared this line with a Cancel @@ -339,6 +361,10 @@ export const onboardingCardInputClass = "placeholder:font-sans placeholder:text-sm placeholder:text-muted-foreground " + "outline-none focus-visible:ring-ring/50 focus-visible:ring-(length:--rad-3)"; +function focusWithoutScrolling(input: HTMLInputElement | null) { + input?.focus({ preventScroll: true }); +} + /** * The card's single-line field, whatever the card is asking for. * @@ -366,6 +392,7 @@ export function OnboardingCardField({ disabled, label = "Authorization code", description, + describedBy, placeholder = "Paste authorization code here", masked = false, autoFocus = false, @@ -378,6 +405,7 @@ export function OnboardingCardField({ disabled?: boolean; label?: string; description?: string; + describedBy?: string; placeholder?: string; /** * Dots instead of the value. The key card asks for it because a provider key @@ -400,10 +428,9 @@ export function OnboardingCardField({ const descriptionId = useId(); const input = ( (null); + /** Shared authentication presentation. Hosts retain their existing session lifecycle. */ export function ProviderSubscriptionCard({ providerName, @@ -453,6 +482,31 @@ export function ProviderSubscriptionCard({ loading?: boolean; children: ReactNode; }) { + const mark = useContext(OnboardingSignInMark); + if (mark && !failure && (mode === "submitted_code" || mode === "displayed_code")) { + return ( + + 1. Sign into your {providerName} account{mode === "submitted_code" && " and copy the authorization code"}. + 2. {mode === "submitted_code" ? "Return to this window and enter the authorization code." : "Enter the code below in the sign-in window."} + + }> +
+ +
{children}
+
+
+ ); + } return ( void; login?: { isolated?: boolean; command?: string; authorizationUrl?: string | null; code?: string | null; accountLabel?: string | null; submitCode?: (code: string) => Promise; preparing: boolean; status?: "ready" | "sign_in_required" | "expired" | null; error: string | null; retry: () => void }; }) { + const onboardingSignIn = useContext(OnboardingSignInMark); const [showCommand, setShowCommand] = useState(false); const [browserCode, setBrowserCode] = useState(""); const [submitting, setSubmitting] = useState(false); @@ -706,7 +761,7 @@ export function LocalProviderLoginInstructions({ adapterType, login, hostedRedir onSubmit={() => void submitBrowserCode()} disabled={submitting} /> - + {!onboardingSignIn && }
: hostedGoogleRedirect ?

{optionalHostedGoogleRedirect diff --git a/ui/src/components/OnboardingWizard.tsx b/ui/src/components/OnboardingWizard.tsx index dd509235fb6..835eba6e3b3 100644 --- a/ui/src/components/OnboardingWizard.tsx +++ b/ui/src/components/OnboardingWizard.tsx @@ -1,3 +1,4 @@ +import { OnboardingSignInMark } from "./AdapterLoginChrome"; import type { AiConnectionLoginIntent } from "@paperclipai/shared"; import { cancelAdapterLoginSession, cancelPendingAdapterLogin, matchesAdapterLoginTarget } from "./useAdapterLoginCancellation"; import { useQueryView } from "@/components/QueryView"; @@ -72,6 +73,7 @@ type ConnectPhase = | "unwindRow"; function resolveOnboardingConnectCta(input: { + passiveSubscriptionFooter: boolean; setupError: boolean; retryLogin: boolean; connectProgress: string | null; @@ -87,6 +89,7 @@ function resolveOnboardingConnectCta(input: { }): { label: string; icon: FooterPrimaryIcon; disabled: boolean } { if (input.setupError) return { label: "Retry", icon: "arrow", disabled: false }; if (input.retryLogin) return { label: "Retry sign-in", icon: "arrow", disabled: false }; + if (input.passiveSubscriptionFooter) return { label: "Next", icon: "arrow", disabled: true }; if (input.connectProgress) { return { label: input.adapterEnvLoading ? "Testing…" : input.connectProgress, icon: "spinner", disabled: true }; } @@ -267,7 +270,7 @@ const MODEL_SOURCE_BRAND_MARKS: Record = { */ function OpenAiBlossom({ className }: { className?: string }) { return ( - + {/* Full-length progress bar (brand .wsteps/.wstep) — segment N @@ -3343,6 +3355,7 @@ function OnboardingWizardInner({ not, and they outlive the space by a beat. See `connectCardMounted`. */} + : null}> {!connectCardMounted ? null : connectProgress ? (

@@ -3350,9 +3363,13 @@ function OnboardingWizardInner({

) : credentialMode === "api" ? ( + {hasGatewaySelection || connectionModels ? "Choose a model for your saved connection" : savedKeys.options.length ? "Choose a saved API key or enter a new one" : `Provide your ${ CONNECT_SOURCE_NAMES[adapterType] ?? adapterType - } API key to connect`} + } API key to connect.`} + {showApiAccountNote && This will be your default {connectSourceLabel} account.} + } > {!hasGatewaySelection && { setGatewayConnection(undefined); @@ -3362,7 +3379,8 @@ function OnboardingWizardInner({ }} />} {!selectedApiKey && !hasGatewaySelection && !connectionModels && ) : browserSignInUnavailable ?

This environment does not support browser sign-in. Go back to use an API key or choose another model.

: null ) : null} + + {showAdvancedSetup && ( +
+ Advanced + { + setGatewayConnection({ companyId: createdCompanyId, adapterType, binding }); + setApiKey(""); + setModel(""); + setError(null); + }} /> +
+ )} - {sourceSelected && connectCardLive && connectCardMounted && !connectProgress && credentialMode === "api" && createdCompanyId && (adapterType === "codex_local" || adapterType === "claude_local") && ( -
- Advanced - { - setGatewayConnection({ companyId: createdCompanyId, adapterType, binding }); - setApiKey(""); - setModel(""); - setError(null); - }} /> -
- )} - {/* Conditional adapter fields */} {/* Progress is shown above; failed checks remain actionable here. */} @@ -3704,6 +3722,7 @@ function OnboardingWizardInner({ `canGoBackFromOnboardingStep` returns false for it. */} {(isAgentArcStep || step === 1) && ( void; primaryLabel: string; primaryDisabled?: boolean; @@ -49,7 +51,7 @@ export function FooterNav({ const icon: FooterPrimaryIcon = primaryIcon ?? (loading ? "spinner" : "arrow"); return ( -
+
{onBack ? ( // Same size as the primary, not a tier down. Back is ghost until you // point at it, and a shorter pill made the hover surface read as a diff --git a/ui/src/components/onboarding/SavedProviderKeySelect.tsx b/ui/src/components/onboarding/SavedProviderKeySelect.tsx index 955d9ec3e78..11157847a28 100644 --- a/ui/src/components/onboarding/SavedProviderKeySelect.tsx +++ b/ui/src/components/onboarding/SavedProviderKeySelect.tsx @@ -84,7 +84,7 @@ export function SavedProviderKeySelect({ kind?: "api" | "subscription"; }) { return ( -
+
{options.length > 0 && (