TypeScript
fix(web): pairing, connect, error, and Clerk sign-in surfaces match the app's dialog style (#25281)
maria1cf14a498fa2
diff --git a/apps/web/src/components/SidebarStageBackdrop.tsx b/apps/web/src/components/SidebarStageBackdrop.tsxindex 9aa7ecc9af6..b5c9d34ac66 100644--- a/apps/web/src/components/SidebarStageBackdrop.tsx+++ b/apps/web/src/components/SidebarStageBackdrop.tsx@@ -60,7 +60,7 @@ export function SidebarStageBackdrop({ variant }: { variant: SidebarStageBackdro);}-export function StageBackdropArt({ variant }: { variant: SidebarStageBackdropVariant }) {+function StageBackdropArt({ variant }: { variant: SidebarStageBackdropVariant }) {return variant === "nightly" ? <NightlySkyArt /> : <DevBlueprintArt />;}diff --git a/apps/web/src/components/auth/AuthSurfaceShell.tsx b/apps/web/src/components/auth/AuthSurfaceShell.tsxdeleted file mode 100644index 8284a7cdcf6..00000000000--- a/apps/web/src/components/auth/AuthSurfaceShell.tsx+++ /dev/null@@ -1,37 +0,0 @@-import type { ReactNode } from "react";--import { APP_DISPLAY_NAME, APP_STAGE_LABEL } from "../../branding";-import { resolveSidebarStageBackdropVariant, StageBackdropArt } from "../SidebarStageBackdrop";-import { StandalonePage } from "../ui/standalone-page";--export function AuthSurfaceShell({ children }: { readonly children: ReactNode }) {- const stageVariant = resolveSidebarStageBackdropVariant(APP_STAGE_LABEL);-- return (- <StandalonePage- tone="brand"- masthead={- <header className="relative h-24 overflow-hidden bg-[linear-gradient(135deg,#1e61de,#17348e)] text-white">- {stageVariant ? (- <div className="absolute inset-0" aria-hidden>- <StageBackdropArt variant={stageVariant} />- </div>- ) : (- <div- aria-hidden- className="absolute inset-0 bg-[radial-gradient(circle_at_75%_25%,rgba(136,204,255,0.5),transparent_38%),linear-gradient(135deg,#2468df,#172f82)]"- />- )}- <div className="absolute inset-0 bg-[linear-gradient(to_bottom,transparent_20%,rgba(7,18,55,0.46)_100%)]" />- <div className="relative h-full p-5 sm:p-6">- <p className="text-3xs font-semibold tracking-widest text-white/80 uppercase">- {APP_DISPLAY_NAME}- </p>- </div>- </header>- }- >- {children}- </StandalonePage>- );-}diff --git a/apps/web/src/components/auth/ConnectAgentSurface.tsx b/apps/web/src/components/auth/ConnectAgentSurface.tsxindex aa5c526911c..86481902553 100644--- a/apps/web/src/components/auth/ConnectAgentSurface.tsx+++ b/apps/web/src/components/auth/ConnectAgentSurface.tsx@@ -22,7 +22,7 @@ import { Button } from "../ui/button";import { Input } from "../ui/input";import { RadioGroup } from "../ui/radio-group";import { Spinner } from "../ui/spinner";-import { AuthSurfaceShell } from "./AuthSurfaceShell";+import { StandalonePage, StandalonePageHeader } from "../ui/standalone-page";export const accessConfig: Record<AuthMcpClientAccess,@@ -138,24 +138,24 @@ export function ConnectAgentSurface() {if (loaded.status === "loading") {return (- <AuthSurfaceShell>+ <StandalonePage><ConnectAgentHeadingtitle="Checking the sign-in request"description="One moment while this environment verifies the agent's request."/><Spinner className="mt-6" size="lg" tone="muted" />- </AuthSurfaceShell>+ </StandalonePage>);}if (loaded.status === "invalid") {return (- <AuthSurfaceShell>+ <StandalonePage><ConnectAgentHeading title="This sign-in cannot continue" description={loaded.message} /><p className="mt-4 text-sm text-muted-foreground">Close this page and start the sign-in again from your agent.</p>- </AuthSurfaceShell>+ </StandalonePage>);}@@ -164,7 +164,7 @@ export function ConnectAgentSurface() {const canApprove = pending === null && (oneClick || pairingCode.trim().length > 0);return (- <AuthSurfaceShell>+ <StandalonePage><ConnectAgentHeadingtitle={`Connect ${details.clientName}`}description={@@ -259,7 +259,7 @@ export function ConnectAgentSurface() {</Button></div></form>- </AuthSurfaceShell>+ </StandalonePage>);}@@ -270,13 +270,7 @@ function ConnectAgentHeading({readonly title: string;readonly description: ReactNode;}) {- return (- <>- <p className="text-3xs font-semibold tracking-widest text-primary uppercase">Agent sign-in</p>- <h1 className="mt-2 text-2xl font-semibold tracking-tight sm:text-3xl">{title}</h1>- <p className="mt-2 text-sm leading-relaxed text-muted-foreground">{description}</p>- </>- );+ return <StandalonePageHeader context="Agent sign-in" title={title} description={description} />;}function AccessOption({diff --git a/apps/web/src/components/auth/PairingRouteSurface.tsx b/apps/web/src/components/auth/PairingRouteSurface.tsxindex 766029e93c7..926260af8e4 100644--- a/apps/web/src/components/auth/PairingRouteSurface.tsx+++ b/apps/web/src/components/auth/PairingRouteSurface.tsx@@ -3,7 +3,6 @@ import type { AuthSessionState } from "@t3tools/contracts";import { squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime";import React, { startTransition, useEffect, useEffectEvent, useRef, useState } from "react";-import { APP_DISPLAY_NAME } from "../../branding";import { connectPairing } from "../../connection/onboarding";import {peekPairingTokenFromUrl,@@ -18,9 +17,8 @@ import { useAtomCommand } from "../../state/use-atom-command";export function PairingPendingSurface() {return (- <StandalonePage tone="pairing">+ <StandalonePage><StandalonePageHeader- eyebrow={APP_DISPLAY_NAME}title="Pairing with this environment"description="Validating the pairing link and preparing your session."/>@@ -84,9 +82,8 @@ export function PairingRouteSurface({}, [autoPairToken]);return (- <StandalonePage tone="pairing">+ <StandalonePage><StandalonePageHeader- eyebrow={APP_DISPLAY_NAME}title="Pair with this environment"description={describeAuthGate(auth.bootstrapMethods)}/>@@ -208,9 +205,8 @@ export function HostedPairingRouteSurface() {}, []);return (- <StandalonePage tone="pairing">+ <StandalonePage><StandalonePageHeader- eyebrow={APP_DISPLAY_NAME}title={status === "paired"? "Backend paired"diff --git a/apps/web/src/components/clerk/clerkAppearance.ts b/apps/web/src/components/clerk/clerkAppearance.tsindex ff1f4d4d4ca..31b22995faf 100644--- a/apps/web/src/components/clerk/clerkAppearance.ts+++ b/apps/web/src/components/clerk/clerkAppearance.ts@@ -1,7 +1,17 @@import type { ClerkProviderProps } from "@clerk/react";+// Scoped to auth flows: UserProfile reuses formButtonPrimary for destructive confirmations.+const authFlowElements = {+ formButtonPrimary:+ "border-primary bg-primary bg-none text-primary-foreground shadow-xs shadow-primary/24 hover:bg-primary/90 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background",+};+export const clerkAppearance = {+ // index.css orders this layer below components and utilities so the element classes below win.+ cssLayerName: "clerk",+ options: { shimmer: false },variables: {+ borderRadius: "0.5rem",// Clerk reuses its primary color for filled buttons and bare links.colorPrimary: "var(--update-foreground)",colorPrimaryForeground: "var(--card)",@@ -19,10 +29,20 @@ export const clerkAppearance = {colorRing: "var(--ring)",},elements: {+ modalBackdrop: "dialog-backdrop",+ cardBox: "dialog-glass rounded-2xl border",+ card: "border-0 bg-transparent shadow-none",+ footer: "bg-transparent bg-none",+ header: "items-start text-start",+ headerTitle: "text-xl font-semibold",+ headerSubtitle: "text-sm text-muted-foreground",+ buttonArrowIcon: "hidden",formFieldErrorText: { color: "var(--error-foreground)" },formFieldWarningText: { color: "var(--warning-foreground)" },formFieldSuccessText: { color: "var(--success-foreground)" },otpCodeFieldErrorText: { color: "var(--error-foreground)" },otpCodeFieldSuccessText: { color: "var(--success-foreground)" },},+ signIn: { elements: authFlowElements },+ signUp: { elements: authFlowElements },} satisfies NonNullable<ClerkProviderProps["appearance"]>;diff --git a/apps/web/src/components/cloud/ConnectCliAuthSurface.tsx b/apps/web/src/components/cloud/ConnectCliAuthSurface.tsxindex 155b4471247..4eb372f3756 100644--- a/apps/web/src/components/cloud/ConnectCliAuthSurface.tsx+++ b/apps/web/src/components/cloud/ConnectCliAuthSurface.tsx@@ -7,32 +7,12 @@ import {connectCliSignInRedirectUrl,} from "../../cloud/connectCliAuth";import { isElectron } from "../../env";-import { AuthSurfaceShell } from "../auth/AuthSurfaceShell";+import { StandalonePage, StandalonePageHeader } from "../ui/standalone-page";import { resolveClerkSignInProps } from "../clerk/authRedirect";import { Button } from "../ui/button";-function ConnectCliAuthMessage({- eyebrow,- title,- description,-}: {- readonly eyebrow?: string;- readonly title: string;- readonly description: string;-}) {- return (- <>- {eyebrow ? (- <p className="text-3xs font-semibold tracking-widest text-primary uppercase">{eyebrow}</p>- ) : null}- <h1 className="mt-2 text-2xl font-semibold tracking-tight sm:text-3xl">{title}</h1>- <p className="mt-2 text-sm leading-relaxed text-muted-foreground">{description}</p>- </>- );-}-const invalidLinkMessage = {- eyebrow: "Authorization request",+ context: "Authorization request",title: "This connect link is incomplete",description:"The link is missing its authorization request. Re-run `t3 connect` in your terminal and open the freshly printed URL.",@@ -79,16 +59,16 @@ export function ConnectCliAuthorizeSurface() {if (!request) {return (- <AuthSurfaceShell>- <ConnectCliAuthMessage {...invalidLinkMessage} />- </AuthSurfaceShell>+ <StandalonePage>+ <StandalonePageHeader {...invalidLinkMessage} />+ </StandalonePage>);}return (- <AuthSurfaceShell>- <ConnectCliAuthMessage- eyebrow="Browser authorization"+ <StandalonePage>+ <StandalonePageHeader+ context="Browser authorization"title="Connecting your terminal"description={isSignedIn@@ -103,6 +83,6 @@ export function ConnectCliAuthorizeSurface() {</Button></div>) : null}- </AuthSurfaceShell>+ </StandalonePage>);}diff --git a/apps/web/src/components/promptLinks/HostedPromptLinkLanding.tsx b/apps/web/src/components/promptLinks/HostedPromptLinkLanding.tsxindex 6a512608516..69233976f16 100644--- a/apps/web/src/components/promptLinks/HostedPromptLinkLanding.tsx+++ b/apps/web/src/components/promptLinks/HostedPromptLinkLanding.tsx@@ -9,7 +9,7 @@ import { useLocation } from "@tanstack/react-router";import * as Schema from "effect/Schema";import { type ReactNode, useEffect, useRef, useState } from "react";-import { APP_DISPLAY_NAME, DESKTOP_DOWNLOAD_URL } from "~/branding";+import { DESKTOP_DOWNLOAD_URL } from "~/branding";import { useLocalStorage } from "~/hooks/useLocalStorage";import { isHostedStaticApp } from "~/hostedPairing";import { useEnvironments } from "~/state/environments";@@ -112,21 +112,16 @@ function HostedPromptLinkLanding({if (!summary.ok) {return (- <StandalonePage tone="error">- <StandalonePageHeader- eyebrow={APP_DISPLAY_NAME}- title="Could not open the link"- description={summary.error}- />+ <StandalonePage>+ <StandalonePageHeader title="Could not open the link" description={summary.error} /></StandalonePage>);}const { prompt, details } = summary.value;return (- <StandalonePage tone="brand">+ <StandalonePage><StandalonePageHeader- eyebrow={APP_DISPLAY_NAME}title="Open this prompt"description="It opens as a draft. Nothing runs until you press Send."/>diff --git a/apps/web/src/components/ui/standalone-page.tsx b/apps/web/src/components/ui/standalone-page.tsxindex aa9446442bb..0881b84c52f 100644--- a/apps/web/src/components/ui/standalone-page.tsx+++ b/apps/web/src/components/ui/standalone-page.tsx@@ -1,68 +1,36 @@import type { ReactNode } from "react";-const backdropClassNames = {- pairing:- "absolute inset-x-0 top-0 h-44 bg-[radial-gradient(44rem_16rem_at_top,color-mix(in_srgb,var(--color-emerald-500)_14%,transparent),transparent)]",- error:- "absolute inset-x-0 top-0 h-44 bg-[radial-gradient(44rem_16rem_at_top,color-mix(in_srgb,var(--color-red-500)_16%,transparent),transparent)]",- brand:- "absolute inset-x-0 top-0 h-72 bg-[radial-gradient(48rem_20rem_at_top,color-mix(in_srgb,var(--color-blue-500)_12%,transparent),transparent)]",-};+import { T3Wordmark } from "../T3Wordmark";-export function StandalonePage({- tone,- masthead,- children,-}: {- readonly tone: keyof typeof backdropClassNames;- readonly masthead?: ReactNode;- readonly children: ReactNode;-}) {+export function StandalonePage({ children }: { readonly children: ReactNode }) {return (// The page owns scrolling because root cannot scroll; safe centering keeps oversized cards top-aligned.- <div className="relative h-full overflow-hidden bg-background text-foreground">- <div className="pointer-events-none absolute inset-0 opacity-80" aria-hidden>- <div className={backdropClassNames[tone]} />- {tone === "pairing" ? (- <div className="absolute inset-y-0 left-0 w-72 bg-[radial-gradient(28rem_18rem_at_left,color-mix(in_srgb,var(--color-sky-500)_10%,transparent),transparent)]" />- ) : null}- <div- className={- tone === "brand"- ? "absolute inset-0 bg-[linear-gradient(145deg,color-mix(in_srgb,var(--background)_94%,var(--color-black))_0%,var(--background)_62%)]"- : "absolute inset-0 bg-[linear-gradient(145deg,color-mix(in_srgb,var(--background)_90%,var(--color-black))_0%,var(--background)_55%)]"- }- />- </div>-- <div className="relative flex h-full items-center-safe justify-center overflow-y-auto scrollbar-gutter-both px-4 py-10 sm:px-6">- <section- className={`relative w-full max-w-xl rounded-2xl border border-border/80 shadow-2xl shadow-black/20 backdrop-blur-md ${tone === "brand" ? "overflow-hidden bg-card/94" : "bg-card/90"}`}- >- {masthead}- <div className="p-6 sm:p-8">{children}</div>- </section>- </div>+ <div className="flex h-full items-center-safe justify-center overflow-y-auto scrollbar-gutter-both bg-background px-4 py-10 text-foreground sm:px-6">+ <section className="dialog-glass w-full max-w-xl rounded-2xl border p-6">{children}</section></div>);}export function StandalonePageHeader({- eyebrow,+ context,title,description,}: {- readonly eyebrow: ReactNode;+ readonly context?: ReactNode;readonly title: ReactNode;readonly description: ReactNode;}) {return (<>- <p className="text-[11px] font-semibold tracking-[0.18em] text-muted-foreground uppercase">- {eyebrow}- </p>- <h1 className="mt-3 text-2xl font-semibold tracking-tight sm:text-3xl">{title}</h1>- <p className="mt-2 text-sm leading-relaxed text-muted-foreground">{description}</p>+ <div className="flex items-baseline justify-between gap-3 text-muted-foreground">+ <span className="flex items-baseline gap-1.5" role="img" aria-label="T3 Code">+ <T3Wordmark className="h-3 w-auto shrink-0 text-foreground" aria-hidden />+ <span className="text-lg font-medium tracking-tight">Code</span>+ </span>+ {context ? <span className="text-sm">{context}</span> : null}+ </div>+ <h1 className="mt-6 text-xl leading-tight font-semibold">{title}</h1>+ <p className="mt-2 text-sm text-muted-foreground">{description}</p></>);}diff --git a/apps/web/src/index.css b/apps/web/src/index.cssindex 80c16a1b431..23029609141 100644--- a/apps/web/src/index.css+++ b/apps/web/src/index.css@@ -1,3 +1,5 @@+/* Clerk injects its component styles into the clerk layer (clerkAppearance.cssLayerName). */+@layer theme, base, clerk, components, utilities;@import "tailwindcss";@custom-variant dark (&:is(.dark, .dark *));diff --git a/apps/web/src/routes/__root.tsx b/apps/web/src/routes/__root.tsxindex 7444b3623dc..017b804dc5a 100644--- a/apps/web/src/routes/__root.tsx+++ b/apps/web/src/routes/__root.tsx@@ -226,12 +226,8 @@ function RootRouteErrorView({ error }: ErrorComponentProps) {const report = errorReport(error, pathname);return (- <StandalonePage tone="error">- <StandalonePageHeader- eyebrow={APP_DISPLAY_NAME}- title="Something went wrong."- description={message}- />+ <StandalonePage>+ <StandalonePageHeader title="Something went wrong." description={message} /><div className="mt-5 flex flex-wrap gap-2"><Button size="sm" onClick={() => void router.invalidate()}>diff --git a/vite.config.ts b/vite.config.tsindex 9492eb7f350..91ba06dc66b 100644--- a/vite.config.ts+++ b/vite.config.ts@@ -575,11 +575,6 @@ export default defineConfig({"t3code/no-manual-memo": "error",},},- {- // The sign-in masthead is T3 brand artwork: fixed gradients, not theme surfaces.- files: ["apps/web/src/components/auth/AuthSurfaceShell.tsx"],- rules: { "shadcn/no-arbitrary-values": "off" },- },{// ESNext types allow APIs absent from Hermes; restrict shared client code, exempting Node tests.files: [