TypeScript
refactor(web): consolidate setup wizards into shared components (#10832)
Julius Marminge3faeee49ac67
diff --git a/apps/web/src/components/GitActionsControl.tsx b/apps/web/src/components/GitActionsControl.tsxindex b0e74159da8..b766a846931 100644--- a/apps/web/src/components/GitActionsControl.tsx+++ b/apps/web/src/components/GitActionsControl.tsx@@ -58,7 +58,7 @@ import {resolveQuickAction,resolveThreadBranchUpdate,} from "./GitActionsControl.logic";-import { AnimatedHeight } from "./AnimatedHeight";+import { WizardPopup, WizardHeader, WizardSteps, WizardPanel, WizardFooter } from "./ui/wizard";import { StartTruncatedPath } from "./StartTruncatedPath";import { Button } from "~/components/ui/button";import { Checkbox } from "~/components/ui/checkbox";@@ -563,419 +563,360 @@ function PublishRepositoryDialog(props: PublishRepositoryDialogProps) {return (<Dialog open={props.open} onOpenChange={handleOpenChange}>- <DialogPopup className="max-w-xl overflow-hidden">- <div className="flex min-h-0 flex-col overflow-hidden border-foreground/10 bg-transparent">- <DialogHeader className="border-b border-border/70 bg-foreground/[0.025] dark:border-transparent dark:bg-transparent">- <DialogTitle>Publish repository</DialogTitle>- <DialogDescription>- Pick where to host it, then point us at a repo to push to.- </DialogDescription>- <div className="grid grid-cols-3 gap-2">- {publishWizardSteps.map((label, index) => {- const isComplete = index < publishWizardStep;- const isClickable =- publishWizardStep !== 2 &&- index < publishWizardSteps.length - 1 &&- index <= publishWizardStep;+ <WizardPopup>+ <WizardHeader+ title="Publish repository"+ description="Pick where to host it, then point us at a repo to push to."+ >+ <WizardSteps+ steps={publishWizardSteps}+ currentStep={publishWizardStep}+ summaries={publishWizardStepSummaries}+ showSummaries+ isStepDisabled={(index) =>+ publishWizardStep === 2 ||+ index >= publishWizardSteps.length - 1 ||+ index > publishWizardStep+ }+ onStepChange={setPublishWizardStep}+ />+ </WizardHeader>++ <WizardPanel>+ <div className={cn("space-y-2", publishWizardStep !== 0 && "hidden")}>+ <span id="publish-provider-cards-label" className="text-xs font-medium text-foreground">+ Provider+ </span>+ <RadioGroup+ value={publishProvider}+ onValueChange={(value) => {+ setSelectedPublishProvider(value as PublishProviderKind);+ setPublishRepositoryOverride(null);+ }}+ aria-labelledby="publish-provider-cards-label"+ className="grid grid-cols-2 gap-2.5"+ >+ {sortedPublishProviderOptions.map((option) => {+ const readiness = publishProviderReadiness[option.value];+ const isSelected = publishProvider === option.value && readiness.ready;+ if (!readiness.ready) {+ return (+ <div+ key={option.value}+ className="relative flex cursor-not-allowed items-center gap-3 rounded-lg border border-border bg-background px-3 py-3 text-left opacity-55 dark:border-transparent dark:bg-white/[0.035]"+ >+ <option.Icon className="size-5 shrink-0 text-muted-foreground" aria-hidden />+ <span className="min-w-0 flex-1 truncate text-sm font-medium text-foreground">+ {option.label}+ </span>+ <Tooltip>+ <TooltipTrigger+ render={+ <Button+ variant="outline"+ size="xs"+ className="h-5 rounded-[.25rem] px-1.5 text-[10px] text-warning-foreground"+ onClick={(event) => {+ event.preventDefault();+ event.stopPropagation();+ openSourceControlSettings();+ }}+ >+ Setup Required+ </Button>+ }+ />+ <TooltipPopup side="top" align="end" className="max-w-72">+ {readiness.hint ??+ "Open Settings -> Source Control to configure this provider."}+ </TooltipPopup>+ </Tooltip>+ </div>+ );+ }+return (- <button- key={label}- type="button"- onClick={isClickable ? () => setPublishWizardStep(index) : undefined}- disabled={!isClickable}+ <RadioPrimitive.Root+ key={option.value}+ value={option.value}className={cn(- "grid min-w-0 grid-cols-[1rem_minmax(0,1fr)] gap-x-2 rounded-lg border px-3 py-2 text-left",- index === publishWizardStep- ? "border-primary bg-primary/10 ring-1 ring-primary/25 dark:border-transparent"- : isComplete- ? "border-border bg-background dark:border-transparent dark:bg-white/[0.05]"- : "border-border bg-muted/40 dark:border-transparent dark:bg-white/[0.025]",- !isClickable && "cursor-default",+ "relative flex cursor-pointer items-center gap-3 rounded-lg border px-3 py-3 text-left outline-none transition-[background-color,border-color,box-shadow]",+ "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background",+ isSelected+ ? "border-primary bg-background shadow-sm ring-2 ring-primary/35 dark:border-transparent dark:bg-primary/10 dark:shadow-none dark:ring-1 dark:ring-primary/30"+ : "border-border bg-background hover:border-foreground/20 hover:bg-muted/50 dark:border-transparent dark:bg-white/[0.035] dark:hover:bg-accent",)}>- <span- aria-hidden- className={cn(- "row-span-2 mt-0.5 grid size-4 place-items-center rounded-full border",- isComplete- ? "border-primary bg-primary text-primary-foreground"- : index === publishWizardStep- ? "border-primary bg-background"- : "border-muted-foreground/35 bg-background",- )}- >- {isComplete ? <CheckIcon className="size-3" /> : null}- </span>- <span className="text-[10px] font-medium uppercase text-muted-foreground">- Step {index + 1}+ <option.Icon className="size-5 shrink-0" aria-hidden />+ <span className="min-w-0 flex-1 truncate text-sm font-medium text-foreground">+ {option.label}</span>- <span className="truncate text-xs font-semibold text-foreground">- {label}- {isComplete && publishWizardStepSummaries[index]- ? `: ${publishWizardStepSummaries[index]}`- : ""}- </span>- </button>+ </RadioPrimitive.Root>);})}- </div>- </DialogHeader>-- <DialogPanel className="space-y-5 border-b border-border/70 bg-muted/20 px-6 py-5 dark:border-transparent dark:bg-transparent">- <AnimatedHeight>- <div className={cn("space-y-2", publishWizardStep !== 0 && "hidden")}>- <span- id="publish-provider-cards-label"- className="text-xs font-medium text-foreground"- >- Provider+ </RadioGroup>+ </div>++ <div className={cn("space-y-5", publishWizardStep !== 1 && "hidden")}>+ <div className="space-y-2">+ <label+ htmlFor="publish-repository-path"+ className="text-xs font-medium text-foreground"+ >+ Repository+ </label>+ <div className="flex items-stretch overflow-hidden rounded-md border border-input bg-background focus-within:outline-2 focus-within:-outline-offset-1 focus-within:outline-ring">+ <span className="flex shrink-0 items-center gap-1.5 border-r border-input bg-muted/50 px-2.5 font-mono text-xs text-muted-foreground">+ <currentPublishProvider.Icon className="size-3.5" />+ {publishHost}/</span>- <RadioGroup- value={publishProvider}- onValueChange={(value) => {- setSelectedPublishProvider(value as PublishProviderKind);- setPublishRepositoryOverride(null);+ <input+ id="publish-repository-path"+ name="publish-repository-path"+ value={publishRepository}+ onChange={(event) => {+ setPublishRepositoryOverride(event.target.value);}}- aria-labelledby="publish-provider-cards-label"- className="grid grid-cols-2 gap-2.5"- >- {sortedPublishProviderOptions.map((option) => {- const readiness = publishProviderReadiness[option.value];- const isSelected = publishProvider === option.value && readiness.ready;- if (!readiness.ready) {- return (- <div- key={option.value}- className="relative flex cursor-not-allowed items-center gap-3 rounded-lg border border-border bg-background px-3 py-3 text-left opacity-55 dark:border-transparent dark:bg-white/[0.035]"- >- <option.Icon- className="size-5 shrink-0 text-muted-foreground"- aria-hidden- />- <span className="min-w-0 flex-1 truncate text-sm font-medium text-foreground">- {option.label}- </span>- <Tooltip>- <TooltipTrigger- render={- <Button- variant="outline"- size="xs"- className="h-5 rounded-[.25rem] px-1.5 text-[10px] text-warning-foreground"- onClick={(event) => {- event.preventDefault();- event.stopPropagation();- openSourceControlSettings();- }}- >- Setup Required- </Button>- }- />- <TooltipPopup side="top" align="end" className="max-w-72">- {readiness.hint ??- "Open Settings -> Source Control to configure this provider."}- </TooltipPopup>- </Tooltip>- </div>- );+ onKeyDown={(event) => {+ if (event.key === "Enter") {+ event.preventDefault();+ submitPublishRepository();}+ }}+ placeholder={publishPathPlaceholder}+ disabled={publishRepositoryAction.isPending}+ className="w-full bg-transparent px-3 py-2 font-mono text-sm placeholder:text-muted-foreground/60 focus:outline-none"+ />+ </div>+ </div>- return (- <RadioPrimitive.Root- key={option.value}- value={option.value}- className={cn(- "relative flex cursor-pointer items-center gap-3 rounded-lg border px-3 py-3 text-left outline-none transition-[background-color,border-color,box-shadow]",- "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background",- isSelected- ? "border-primary bg-background shadow-sm ring-2 ring-primary/35 dark:border-transparent dark:bg-primary/10 dark:shadow-none dark:ring-1 dark:ring-primary/30"- : "border-border bg-background hover:border-foreground/20 hover:bg-muted/50 dark:border-transparent dark:bg-white/[0.035] dark:hover:bg-accent",- )}- >- <option.Icon className="size-5 shrink-0" aria-hidden />- <span className="min-w-0 flex-1 truncate text-sm font-medium text-foreground">+ <div className="space-y-2">+ <span+ id="publish-visibility-cards-label"+ className="text-xs font-medium text-foreground"+ >+ Visibility+ </span>+ <RadioGroup+ value={publishVisibility}+ onValueChange={(value) =>+ setPublishVisibility(value as SourceControlRepositoryVisibility)+ }+ aria-labelledby="publish-visibility-cards-label"+ disabled={publishRepositoryAction.isPending}+ className="grid grid-cols-2 gap-2.5"+ >+ {[+ {+ value: "private" as const,+ label: "Private",+ description: "Only invited people",+ Icon: LockIcon,+ },+ {+ value: "public" as const,+ label: "Public",+ description: "Anyone on the web",+ Icon: GlobeIcon,+ },+ ].map((option) => {+ const isSelected = publishVisibility === option.value;+ return (+ <RadioPrimitive.Root+ key={option.value}+ value={option.value}+ className={cn(+ "relative flex cursor-pointer items-center gap-3 rounded-lg border px-3 py-2.5 text-left outline-none transition-[background-color,border-color,box-shadow]",+ "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background",+ isSelected+ ? "border-primary bg-background shadow-sm ring-2 ring-primary/35 dark:border-transparent dark:bg-primary/10 dark:shadow-none dark:ring-1 dark:ring-primary/30"+ : "border-border bg-background hover:border-foreground/20 hover:bg-muted/50 dark:border-transparent dark:bg-white/[0.035] dark:hover:bg-accent",+ )}+ >+ <option.Icon className="size-4 shrink-0 text-muted-foreground" aria-hidden />+ <span className="min-w-0 flex-1">+ <span className="block text-sm font-medium text-foreground">{option.label}</span>- </RadioPrimitive.Root>- );- })}- </RadioGroup>- </div>+ <span className="block text-xs text-muted-foreground">+ {option.description}+ </span>+ </span>+ </RadioPrimitive.Root>+ );+ })}+ </RadioGroup>+ </div>- <div className={cn("space-y-5", publishWizardStep !== 1 && "hidden")}>- <div className="space-y-2">- <label- htmlFor="publish-repository-path"- className="text-xs font-medium text-foreground"- >- Repository+ <div>+ <button+ type="button"+ onClick={() => setPublishAdvancedOpen((prev) => !prev)}+ aria-expanded={publishAdvancedOpen}+ className="flex items-center gap-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground"+ >+ <ChevronDownIcon+ className={cn(+ "size-3.5 transition-transform",+ publishAdvancedOpen ? "" : "-rotate-90",+ )}+ />+ Advanced+ </button>+ {publishAdvancedOpen ? (+ <div className="mt-3 grid gap-3 sm:grid-cols-2">+ <label className="space-y-1.5" htmlFor="publish-remote-name">+ <span className="text-xs font-medium text-foreground">Remote</span>+ <Input+ id="publish-remote-name"+ value={publishRemoteName}+ onChange={(event) => setPublishRemoteName(event.target.value)}+ placeholder="origin"+ disabled={publishRepositoryAction.isPending}+ /></label>- <div className="flex items-stretch overflow-hidden rounded-md border border-input bg-background focus-within:outline-2 focus-within:-outline-offset-1 focus-within:outline-ring">- <span className="flex shrink-0 items-center gap-1.5 border-r border-input bg-muted/50 px-2.5 font-mono text-xs text-muted-foreground">- <currentPublishProvider.Icon className="size-3.5" />- {publishHost}/+ <div className="space-y-1.5">+ <span+ id="publish-protocol-label"+ className="text-xs font-medium text-foreground"+ >+ Protocol</span>- <input- id="publish-repository-path"- name="publish-repository-path"- value={publishRepository}- onChange={(event) => {- setPublishRepositoryOverride(event.target.value);- }}- onKeyDown={(event) => {- if (event.key === "Enter") {- event.preventDefault();- submitPublishRepository();+ <RadioGroup+ className="w-fit flex-row gap-0.5 rounded-lg bg-input/40 p-0.5"+ value={publishProtocol}+ onValueChange={(protocol) => {+ if (protocol === "ssh" || protocol === "https") {+ setPublishProtocol(protocol);}}}- placeholder={publishPathPlaceholder}+ aria-labelledby="publish-protocol-label"disabled={publishRepositoryAction.isPending}- className="w-full bg-transparent px-3 py-2 font-mono text-sm placeholder:text-muted-foreground/60 focus:outline-none"- />- </div>- </div>-- <div className="space-y-2">- <span- id="publish-visibility-cards-label"- className="text-xs font-medium text-foreground"- >- Visibility- </span>- <RadioGroup- value={publishVisibility}- onValueChange={(value) =>- setPublishVisibility(value as SourceControlRepositoryVisibility)- }- aria-labelledby="publish-visibility-cards-label"- disabled={publishRepositoryAction.isPending}- className="grid grid-cols-2 gap-2.5"- >- {[- {- value: "private" as const,- label: "Private",- description: "Only invited people",- Icon: LockIcon,- },- {- value: "public" as const,- label: "Public",- description: "Anyone on the web",- Icon: GlobeIcon,- },- ].map((option) => {- const isSelected = publishVisibility === option.value;- return (+ >+ {(["ssh", "https"] as const).map((protocol) => (<RadioPrimitive.Root- key={option.value}- value={option.value}- className={cn(- "relative flex cursor-pointer items-center gap-3 rounded-lg border px-3 py-2.5 text-left outline-none transition-[background-color,border-color,box-shadow]",- "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background",- isSelected- ? "border-primary bg-background shadow-sm ring-2 ring-primary/35 dark:border-transparent dark:bg-primary/10 dark:shadow-none dark:ring-1 dark:ring-primary/30"- : "border-border bg-background hover:border-foreground/20 hover:bg-muted/50 dark:border-transparent dark:bg-white/[0.035] dark:hover:bg-accent",- )}+ key={protocol}+ value={protocol}+ data-pressed={publishProtocol === protocol ? "" : undefined}+ className={toggleVariants({+ variant: "segmented",+ size: "segmented",+ })}>- <option.Icon- className="size-4 shrink-0 text-muted-foreground"- aria-hidden- />- <span className="min-w-0 flex-1">- <span className="block text-sm font-medium text-foreground">- {option.label}- </span>- <span className="block text-xs text-muted-foreground">- {option.description}- </span>- </span>+ {protocol.toUpperCase()}</RadioPrimitive.Root>- );- })}- </RadioGroup>- </div>-- <div>- <button- type="button"- onClick={() => setPublishAdvancedOpen((prev) => !prev)}- aria-expanded={publishAdvancedOpen}- className="flex items-center gap-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground"- >- <ChevronDownIcon- className={cn(- "size-3.5 transition-transform",- publishAdvancedOpen ? "" : "-rotate-90",- )}- />- Advanced- </button>- {publishAdvancedOpen ? (- <div className="mt-3 grid gap-3 sm:grid-cols-2">- <label className="space-y-1.5" htmlFor="publish-remote-name">- <span className="text-xs font-medium text-foreground">Remote</span>- <Input- id="publish-remote-name"- value={publishRemoteName}- onChange={(event) => setPublishRemoteName(event.target.value)}- placeholder="origin"- disabled={publishRepositoryAction.isPending}- />- </label>- <div className="space-y-1.5">- <span- id="publish-protocol-label"- className="text-xs font-medium text-foreground"- >- Protocol- </span>- <RadioGroup- className="w-fit flex-row gap-0.5 rounded-lg bg-input/40 p-0.5"- value={publishProtocol}- onValueChange={(protocol) => {- if (protocol === "ssh" || protocol === "https") {- setPublishProtocol(protocol);- }- }}- aria-labelledby="publish-protocol-label"- disabled={publishRepositoryAction.isPending}- >- {(["ssh", "https"] as const).map((protocol) => (- <RadioPrimitive.Root- key={protocol}- value={protocol}- data-pressed={publishProtocol === protocol ? "" : undefined}- className={toggleVariants({- variant: "segmented",- size: "segmented",- })}- >- {protocol.toUpperCase()}- </RadioPrimitive.Root>- ))}- </RadioGroup>- </div>- </div>- ) : null}+ ))}+ </RadioGroup>+ </div></div>+ ) : null}+ </div>- {publishRepositoryAction.isPending ? (- <div- role="status"- aria-live="polite"- className="flex items-center gap-2 rounded-md border border-input bg-muted/40 px-3 py-2 text-xs text-muted-foreground dark:border-transparent dark:bg-white/[0.035]"- >- <Spinner className="size-3.5" aria-hidden />- Publishing repository to {publishProviderLabel}...- </div>- ) : null}- {publishError && !publishRepositoryAction.isPending ? (- <div- role="alert"- className="rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive"- >- <p className="font-medium">Publish failed</p>- <p className="mt-0.5 text-destructive/90">{publishError}</p>- </div>- ) : null}+ {publishRepositoryAction.isPending ? (+ <div+ role="status"+ aria-live="polite"+ className="flex items-center gap-2 rounded-md border border-input bg-muted/40 px-3 py-2 text-xs text-muted-foreground dark:border-transparent dark:bg-white/[0.035]"+ >+ <Spinner className="size-3.5" aria-hidden />+ Publishing repository to {publishProviderLabel}...</div>-- <div className={cn("space-y-4", publishWizardStep !== 2 && "hidden")}>- {publishResult ? (- <>- <div className="flex flex-col items-center gap-2 py-1 text-center">- <span className="grid size-8 place-items-center rounded-full bg-success/15 text-success">- <CheckIcon className="size-4" aria-hidden />- </span>- <h3 className="text-sm font-semibold text-foreground">- {publishResult.status === "pushed"- ? "Repository published"- : "Repository created"}- </h3>- <p className="max-w-xs text-pretty text-xs text-muted-foreground">- {publishResult.status === "pushed"- ? `${publishResult.branch} is now live on ${publishProviderLabel}.`- : `Remote "${publishResult.remoteName}" is set up. Make a commit and push it to share your code.`}- </p>- </div>- <div className="flex items-center gap-2 rounded-lg border border-input bg-muted/40 px-3 py-2 dark:border-transparent dark:bg-white/[0.035]">- <currentPublishProvider.Icon className="size-3.5 shrink-0 text-muted-foreground" />- <span className="min-w-0 flex-1 truncate font-mono text-xs text-foreground">- {publishResult.repository.nameWithOwner}- </span>- </div>- <Button- variant="outline"- size="sm"- className="w-full"- onClick={() => {- void openLink(publishResult.repository.url).catch(() => undefined);- }}- >- Open on {publishProviderLabel}- </Button>- </>- ) : (- <div className="rounded-md border border-input bg-background px-3 py-2 text-xs text-muted-foreground dark:border-transparent dark:bg-white/[0.035]">- Publish result unavailable.- </div>- )}+ ) : null}+ {publishError && !publishRepositoryAction.isPending ? (+ <div+ role="alert"+ className="rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive"+ >+ <p className="font-medium">Publish failed</p>+ <p className="mt-0.5 text-destructive/90">{publishError}</p></div>- </AnimatedHeight>- </DialogPanel>+ ) : null}+ </div>- <DialogFooter className="dark:border-transparent dark:bg-transparent">- {publishWizardStep === 2 ? (- <Button size="sm" onClick={() => handleOpenChange(false)}>- Done- </Button>- ) : (+ <div className={cn("space-y-4", publishWizardStep !== 2 && "hidden")}>+ {publishResult ? (<>+ <div className="flex flex-col items-center gap-2 py-1 text-center">+ <span className="grid size-8 place-items-center rounded-full bg-success/15 text-success">+ <CheckIcon className="size-4" aria-hidden />+ </span>+ <h3 className="text-sm font-semibold text-foreground">+ {publishResult.status === "pushed"+ ? "Repository published"+ : "Repository created"}+ </h3>+ <p className="max-w-xs text-pretty text-xs text-muted-foreground">+ {publishResult.status === "pushed"+ ? `${publishResult.branch} is now live on ${publishProviderLabel}.`+ : `Remote "${publishResult.remoteName}" is set up. Make a commit and push it to share your code.`}+ </p>+ </div>+ <div className="flex items-center gap-2 rounded-lg border border-input bg-muted/40 px-3 py-2 dark:border-transparent dark:bg-white/[0.035]">+ <currentPublishProvider.Icon className="size-3.5 shrink-0 text-muted-foreground" />+ <span className="min-w-0 flex-1 truncate font-mono text-xs text-foreground">+ {publishResult.repository.nameWithOwner}+ </span>+ </div><Buttonvariant="outline"size="sm"- disabled={publishRepositoryAction.isPending}+ className="w-full"onClick={() => {- if (publishWizardStep === 0) {- handleOpenChange(false);- return;- }- setPublishWizardStep((step) => Math.max(0, step - 1));+ void openLink(publishResult.repository.url).catch(() => undefined);}}>- {publishWizardStep === 0 ? "Cancel" : "Back"}+ Open on {publishProviderLabel}</Button>- {publishWizardStep < 1 ? (- <Button- size="sm"- disabled={!hasReadyPublishProvider || !selectedPublishProviderReadiness.ready}- onClick={() => setPublishWizardStep((step) => Math.min(1, step + 1))}- >- Next- </Button>- ) : (- <Button- size="sm"- disabled={!canSubmitPublishRepository}- onClick={submitPublishRepository}- >- {publishRepositoryAction.isPending ? (- <>- <Spinner className="size-3.5" aria-hidden />- Publishing...- </>- ) : (- "Publish"- )}- </Button>- )}</>+ ) : (+ <div className="rounded-md border border-input bg-background px-3 py-2 text-xs text-muted-foreground dark:border-transparent dark:bg-white/[0.035]">+ Publish result unavailable.+ </div>)}- </DialogFooter>- </div>- </DialogPopup>+ </div>+ </WizardPanel>++ <WizardFooter>+ {publishWizardStep === 2 ? (+ <Button onClick={() => handleOpenChange(false)}>Done</Button>+ ) : (+ <>+ <Button+ variant="outline"+ disabled={publishRepositoryAction.isPending}+ onClick={() => {+ if (publishWizardStep === 0) {+ handleOpenChange(false);+ return;+ }+ setPublishWizardStep((step) => Math.max(0, step - 1));+ }}+ >+ {publishWizardStep === 0 ? "Cancel" : "Back"}+ </Button>+ {publishWizardStep < 1 ? (+ <Button+ disabled={!hasReadyPublishProvider || !selectedPublishProviderReadiness.ready}+ onClick={() => setPublishWizardStep((step) => Math.min(1, step + 1))}+ >+ Next+ </Button>+ ) : (+ <Button disabled={!canSubmitPublishRepository} onClick={submitPublishRepository}>+ {publishRepositoryAction.isPending ? (+ <>+ <Spinner className="size-3.5" aria-hidden />+ Publishing...+ </>+ ) : (+ "Publish"+ )}+ </Button>+ )}+ </>+ )}+ </WizardFooter>+ </WizardPopup></Dialog>);}diff --git a/apps/web/src/components/cloud/ConnectOnboardingDialog.tsx b/apps/web/src/components/cloud/ConnectOnboardingDialog.tsxindex 656fb26bdcc..b605ba3facd 100644--- a/apps/web/src/components/cloud/ConnectOnboardingDialog.tsx+++ b/apps/web/src/components/cloud/ConnectOnboardingDialog.tsx@@ -15,18 +15,10 @@ import { useEnvironments, usePrimaryEnvironment } from "~/state/environments";import { CloudEnvironmentConnectRows } from "./CloudEnvironmentConnectList";import { Button } from "../ui/button";import { Checkbox } from "../ui/checkbox";-import {- Dialog,- DialogDescription,- DialogFooter,- DialogHeader,- DialogPanel,- DialogPopup,- DialogTitle,-} from "../ui/dialog";+import { Dialog } from "../ui/dialog";import { Switch } from "../ui/switch";import { toastManager } from "../ui/toast";-import { WizardSteps } from "../ui/wizard-steps";+import { WizardSteps, WizardPopup, WizardHeader, WizardPanel, WizardFooter } from "../ui/wizard";/*** Post-sign-in onboarding wizard for T3 Connect. Opens on every in-session@@ -216,23 +208,29 @@ function ConfiguredConnectOnboardingDialog() {if (!open && !isApplying) complete();}}>- <DialogPopup className="max-w-xl">- <DialogHeader>- <DialogTitle>Set up T3 Connect</DialogTitle>- <DialogDescription>- Mesh your devices together — publish this environment and connect the rest, all in one- place.- </DialogDescription>+ <WizardPopup>+ <WizardHeader+ title="Set up T3 Connect"+ description={+ <>+ Mesh your devices together — publish this environment and connect the rest, all in one+ place.+ </>+ }+ >{steps.length > 1 ? (<WizardSteps- steps={steps.map((id) => ({ id, label: STEP_LABELS[id] }))}- currentStep={step}- disabled={isApplying}- onStepSelect={setStep}+ steps={steps.map((id) => STEP_LABELS[id])}+ currentStep={steps.indexOf(step)}+ isStepDisabled={() => isApplying}+ onStepChange={(index) => {+ const next = steps[index];+ if (next) setStep(next);+ }}/>) : null}- </DialogHeader>- <DialogPanel>+ </WizardHeader>+ <WizardPanel>{step === "publish" ? (<PublishStepexposeEnvironment={exposeEnvironment}@@ -245,38 +243,37 @@ function ConfiguredConnectOnboardingDialog() {) : (<DevicesStep />)}- </DialogPanel>- <DialogFooter variant="bare" className="sm:justify-between">- <label className="flex cursor-pointer items-center gap-2 self-start text-xs text-muted-foreground sm:self-center">- <Checkbox- checked={dontShowAgain}- onCheckedChange={(checked) => setDontShowAgain(checked === true)}- />- Don't show this again- </label>- <div className="flex flex-col-reverse gap-2 sm:flex-row">- {step === "publish" ? (- <>- <Button variant="ghost" disabled={isApplying} onClick={() => setStep("devices")}>- Not now- </Button>- <Button- disabled={- isApplying || (controller.linkState.isPending && linkStateData === null)- }- onClick={() => void applyPublishSelection()}- >- {isApplying ? "Enabling…" : "Continue"}- </Button>- </>- ) : (- <Button disabled={isApplying} onClick={complete}>- Done+ </WizardPanel>+ <WizardFooter+ leading={+ <label className="flex cursor-pointer items-center gap-2 self-start text-xs text-muted-foreground sm:self-center">+ <Checkbox+ checked={dontShowAgain}+ onCheckedChange={(checked) => setDontShowAgain(checked === true)}+ />+ Don't show this again+ </label>+ }+ >+ {step === "publish" ? (+ <>+ <Button variant="ghost" disabled={isApplying} onClick={() => setStep("devices")}>+ Not now</Button>- )}- </div>- </DialogFooter>- </DialogPopup>+ <Button+ disabled={isApplying || (controller.linkState.isPending && linkStateData === null)}+ onClick={() => void applyPublishSelection()}+ >+ {isApplying ? "Enabling…" : "Continue"}+ </Button>+ </>+ ) : (+ <Button disabled={isApplying} onClick={complete}>+ Done+ </Button>+ )}+ </WizardFooter>+ </WizardPopup></Dialog>);}diff --git a/apps/web/src/components/onboarding/WelcomeWizard.tsx b/apps/web/src/components/onboarding/WelcomeWizard.tsxindex ca187b3475d..5c6517e154a 100644--- a/apps/web/src/components/onboarding/WelcomeWizard.tsx+++ b/apps/web/src/components/onboarding/WelcomeWizard.tsx@@ -71,8 +71,8 @@ import { Input } from "../ui/input";import { Tooltip, TooltipTrigger, TooltipPopup } from "../ui/tooltip";import { ScrollArea } from "../ui/scroll-area";import { Spinner } from "../ui/spinner";-import { WizardPanel, WizardSteps } from "../ui/wizard";-import { Dialog, DialogHeader, DialogPopup, DialogTitle } from "../ui/dialog";+import { WizardPanel, WizardSteps, WizardPopup, WizardHeader } from "../ui/wizard";+import { Dialog } from "../ui/dialog";import { toastManager } from "../ui/toast";import { cn } from "../../lib/utils";import { formatRelativeTime } from "../../timestampFormat";@@ -183,71 +183,71 @@ export function WelcomeWizard({return (<Dialog open disablePointerDismissal onOpenChange={(_, event) => event.cancel()}>- <DialogPopup- className="max-w-xl overflow-x-hidden overflow-y-auto"+ <WizardPopupbottomStickOnMobile={false}showCloseButton={false}initialFocus={() => document.getElementById("onboarding-pairing-url") ?? true}>- <DialogTitle className="sr-only">Set up T3 Code</DialogTitle>- <div className="flex min-h-0 flex-col">- <DialogHeader className="gap-4">+ <WizardHeader+ title="Set up T3 Code"+ identity={<div className="flex items-baseline gap-1.5" role="img" aria-label="T3 Code"><T3Wordmark className="h-4 w-auto shrink-0" aria-hidden /><span className="text-[1.4rem] font-medium tracking-tight text-muted-foreground">Code</span></div>- <WizardSteps- steps={ONBOARDING_STAGES}- currentStep={stageIndex}- isStepDisabled={(index) => isImporting || index >= stageIndex}- onStepChange={(index) => {- if (isImporting || index > stageIndex) return;- setStep(index === 0 ? "connection" : "agents");+ }+ >+ <WizardSteps+ steps={ONBOARDING_STAGES}+ currentStep={stageIndex}+ isStepDisabled={(index) => isImporting || index >= stageIndex}+ onStepChange={(index) => {+ if (isImporting || index > stageIndex) return;+ setStep(index === 0 ? "connection" : "agents");+ }}+ />+ </WizardHeader>++ <WizardPanel holdHeight={isLoadingProjects}>+ {step === "connection" ? (+ <ConnectionStep+ expandPairingInitially={!localAvailable && !hasCloudPublicConfig()}+ selectedIds={selectedIds}+ autoSelectedComputers={autoSelectedComputers.current}+ onSelectionChange={setSelection}+ onToggleEnvironment={(environmentId, checked) =>+ setSelection((current) => {+ const next = new Set(current ?? selectedIds);+ if (checked) next.add(environmentId);+ else next.delete(environmentId);+ return next;+ })+ }+ onContinue={() =>+ startSetup(+ environments+ .filter((environment) => selectedIds.has(environment.environmentId))+ .map((environment) => environment.environmentId),+ )+ }+ onPaired={(environmentId) => {+ setSelection(new Set([...selectedIds, environmentId]));}}/>- </DialogHeader>-- <WizardPanel className="min-w-0" holdHeight={isLoadingProjects}>- {step === "connection" ? (- <ConnectionStep- expandPairingInitially={!localAvailable && !hasCloudPublicConfig()}- selectedIds={selectedIds}- autoSelectedComputers={autoSelectedComputers.current}- onSelectionChange={setSelection}- onToggleEnvironment={(environmentId, checked) =>- setSelection((current) => {- const next = new Set(current ?? selectedIds);- if (checked) next.add(environmentId);- else next.delete(environmentId);- return next;- })- }- onContinue={() =>- startSetup(- environments- .filter((environment) => selectedIds.has(environment.environmentId))- .map((environment) => environment.environmentId),- )- }- onPaired={(environmentId) => {- setSelection(new Set([...selectedIds, environmentId]));- }}- />- ) : step === "agents" ? (- <AgentsStep environmentIds={setupIds} onContinue={() => setStep("import")} />- ) : (- <ImportStep- scans={scans}- isImporting={isImporting}- setIsImporting={setIsImporting}- onDone={finish}- />- )}- </WizardPanel>- </div>- </DialogPopup>+ ) : step === "agents" ? (+ <AgentsStep environmentIds={setupIds} onContinue={() => setStep("import")} />+ ) : (+ <ImportStep+ scans={scans}+ isImporting={isImporting}+ setIsImporting={setIsImporting}+ onDone={finish}+ />+ )}+ </WizardPanel>+ </WizardPopup></Dialog>);}diff --git a/apps/web/src/components/settings/AddProviderInstanceDialog.tsx b/apps/web/src/components/settings/AddProviderInstanceDialog.tsxindex d29d5fd04fe..dc61f006fca 100644--- a/apps/web/src/components/settings/AddProviderInstanceDialog.tsx+++ b/apps/web/src/components/settings/AddProviderInstanceDialog.tsx@@ -15,21 +15,14 @@ import { cn } from "../../lib/utils";import { normalizeProviderAccentColor } from "../../providerInstances";import { Button } from "../ui/button";import { ACPRegistryIcon, Gemini, GithubCopilotIcon, PiAgentIcon, type Icon } from "../Icons";-import {- Dialog,- DialogDescription,- DialogFooter,- DialogHeader,- DialogPopup,- DialogTitle,-} from "../ui/dialog";+import { Dialog } from "../ui/dialog";import { Badge } from "../ui/badge";import { Input } from "../ui/input";import { RadioGroup } from "../ui/radio-group";import { toastManager } from "../ui/toast";import { DRIVER_OPTION_BY_VALUE, DRIVER_OPTIONS } from "./providerDriverMeta";import { ProviderSettingsForm, deriveProviderSettingsFields } from "./ProviderSettingsForm";-import { WizardPanel } from "../ui/wizard";+import { WizardPanel, WizardPopup, WizardHeader, WizardFooter } from "../ui/wizard";import {ADD_PROVIDER_WIZARD_STEPS,resolveWizardNavigation,@@ -230,206 +223,204 @@ export function AddProviderInstanceDialog({return (<Dialog open={open} onOpenChange={onOpenChange}>- <DialogPopup className="max-w-xl overflow-hidden">- <div className="flex min-h-0 flex-col overflow-hidden">- <DialogHeader>- <DialogTitle>Add provider instance</DialogTitle>- <DialogDescription>+ <WizardPopup>+ <WizardHeader+ title="Add provider instance"+ description={+ <>Configure an additional provider instance on {environmentLabel} — for example, asecond Codex install pointed at a different workspace.- </DialogDescription>- <AddProviderInstanceWizardSteps- currentStep={wizardStep}- summaries={wizardStepSummaries}- instanceIdError={instanceIdError}- onNavigation={applyWizardNavigation}- />- </DialogHeader>+ </>+ }+ >+ <AddProviderInstanceWizardSteps+ currentStep={wizardStep}+ summaries={wizardStepSummaries}+ instanceIdError={instanceIdError}+ onNavigation={applyWizardNavigation}+ />+ </WizardHeader>- <WizardPanel>- <div className={cn("grid gap-2", wizardStep !== 0 && "hidden")}>- <div id="add-instance-driver-label" className="text-sm font-medium text-foreground">- Driver- </div>- <RadioGroup- value={driver}- onValueChange={(value) => setDriver(ProviderDriverKind.make(value))}- aria-labelledby="add-instance-driver-label"- className="grid grid-cols-1 gap-2 sm:grid-cols-2"- >- {DRIVER_OPTIONS.map((option) => {- const IconComponent = option.icon;- return (- <RadioPrimitive.Root- key={option.value}- value={option.value}- className="relative flex cursor-pointer items-center gap-3 rounded-lg bg-card px-3 py-3 text-left text-muted-foreground outline-none ring-1 ring-black/5 hover:bg-zinc-50 focus-visible:ring-2 focus-visible:ring-ring data-checked:bg-primary/8 data-checked:text-foreground data-checked:ring-2 data-checked:ring-primary data-checked:hover:bg-primary/8 dark:bg-white/3 dark:ring-white/5 dark:hover:bg-white/5 dark:data-checked:bg-primary/15 dark:data-checked:ring-primary dark:data-checked:hover:bg-primary/15"- >- <IconComponent className="size-4 shrink-0" aria-hidden />- <span className="min-w-0 flex-1 truncate text-sm font-medium text-foreground">- {option.label}- </span>- <RadioPrimitive.Indicator- className="grid size-5 shrink-0 place-items-center rounded-full bg-primary text-primary-foreground"- aria-hidden- >- <CheckIcon className="size-3.5 shrink-0" />- </RadioPrimitive.Indicator>- {option.badgeLabel ? (- <Badge variant="warning" size="sm">- {option.badgeLabel}- </Badge>- ) : null}- </RadioPrimitive.Root>- );- })}- {COMING_SOON_DRIVER_OPTIONS.map((option) => {- const IconComponent = option.icon;- return (- <RadioPrimitive.Root- key={option.value}- value={option.value}- disabled- className={cn(- "relative flex cursor-not-allowed items-center gap-3 rounded-lg bg-card/60 px-3 py-3 text-left opacity-55 outline-none ring-1 ring-black/5 dark:bg-white/2 dark:ring-white/5",- )}+ <WizardPanel>+ <div className={cn("grid gap-2", wizardStep !== 0 && "hidden")}>+ <div id="add-instance-driver-label" className="text-sm font-medium text-foreground">+ Driver+ </div>+ <RadioGroup+ value={driver}+ onValueChange={(value) => setDriver(ProviderDriverKind.make(value))}+ aria-labelledby="add-instance-driver-label"+ className="grid grid-cols-1 gap-2 sm:grid-cols-2"+ >+ {DRIVER_OPTIONS.map((option) => {+ const IconComponent = option.icon;+ return (+ <RadioPrimitive.Root+ key={option.value}+ value={option.value}+ className="relative flex cursor-pointer items-center gap-3 rounded-lg bg-card px-3 py-3 text-left text-muted-foreground outline-none ring-1 ring-black/5 hover:bg-zinc-50 focus-visible:ring-2 focus-visible:ring-ring data-checked:bg-primary/8 data-checked:text-foreground data-checked:ring-2 data-checked:ring-primary data-checked:hover:bg-primary/8 dark:bg-white/3 dark:ring-white/5 dark:hover:bg-white/5 dark:data-checked:bg-primary/15 dark:data-checked:ring-primary dark:data-checked:hover:bg-primary/15"+ >+ <IconComponent className="size-4 shrink-0" aria-hidden />+ <span className="min-w-0 flex-1 truncate text-sm font-medium text-foreground">+ {option.label}+ </span>+ <RadioPrimitive.Indicator+ className="grid size-5 shrink-0 place-items-center rounded-full bg-primary text-primary-foreground"+ aria-hidden>- <IconComponent- className="size-4 shrink-0 text-muted-foreground"- aria-hidden- />- <span className="min-w-0 flex-1 truncate text-sm font-medium text-foreground">- {option.label}- </span>+ <CheckIcon className="size-3.5 shrink-0" />+ </RadioPrimitive.Indicator>+ {option.badgeLabel ? (<Badge variant="warning" size="sm">- Coming Soon+ {option.badgeLabel}</Badge>- </RadioPrimitive.Root>- );- })}- </RadioGroup>- </div>+ ) : null}+ </RadioPrimitive.Root>+ );+ })}+ {COMING_SOON_DRIVER_OPTIONS.map((option) => {+ const IconComponent = option.icon;+ return (+ <RadioPrimitive.Root+ key={option.value}+ value={option.value}+ disabled+ className={cn(+ "relative flex cursor-not-allowed items-center gap-3 rounded-lg bg-card/60 px-3 py-3 text-left opacity-55 outline-none ring-1 ring-black/5 dark:bg-white/2 dark:ring-white/5",+ )}+ >+ <IconComponent className="size-4 shrink-0 text-muted-foreground" aria-hidden />+ <span className="min-w-0 flex-1 truncate text-sm font-medium text-foreground">+ {option.label}+ </span>+ <Badge variant="warning" size="sm">+ Coming Soon+ </Badge>+ </RadioPrimitive.Root>+ );+ })}+ </RadioGroup>+ </div>- <label className={cn("grid gap-2", wizardStep !== 1 && "hidden")}>- <span className="text-xs font-medium text-foreground">Label</span>- <Input- className="bg-background"- placeholder="e.g. Work"- value={label}- onChange={(event) => setLabel(event.target.value)}- />+ <label className={cn("grid gap-2", wizardStep !== 1 && "hidden")}>+ <span className="text-xs font-medium text-foreground">Label</span>+ <Input+ className="bg-background"+ placeholder="e.g. Work"+ value={label}+ onChange={(event) => setLabel(event.target.value)}+ />+ <span className="text-[11px] text-muted-foreground">+ Shown in the provider list. Optional.+ </span>+ </label>++ <label className={cn("grid gap-2", wizardStep !== 1 && "hidden")}>+ <span className="text-xs font-medium text-foreground">Instance ID</span>+ <Input+ className="bg-background"+ placeholder={`${driver}_work`}+ value={instanceId}+ onChange={(event) => {+ setInstanceIdOverride(event.target.value);+ }}+ aria-invalid={showInstanceIdError}+ />+ {showInstanceIdError ? (+ <span className="text-[11px] text-destructive">{instanceIdError}</span>+ ) : (<span className="text-[11px] text-muted-foreground">- Shown in the provider list. Optional.+ Routing key used by threads and sessions. Letters, digits, '-', or '_'.</span>- </label>+ )}+ </label>- <label className={cn("grid gap-2", wizardStep !== 1 && "hidden")}>- <span className="text-xs font-medium text-foreground">Instance ID</span>- <Input- className="bg-background"- placeholder={`${driver}_work`}- value={instanceId}- onChange={(event) => {- setInstanceIdOverride(event.target.value);- }}- aria-invalid={showInstanceIdError}+ <div className={cn("grid gap-2", wizardStep !== 1 && "hidden")}>+ <span className="text-xs font-medium text-foreground">Accent color</span>+ <div className="flex min-w-0 flex-wrap items-center gap-2">+ <input+ type="color"+ value={normalizeProviderAccentColor(accentColor) ?? PROVIDER_ACCENT_SWATCHES[0]}+ onChange={(event) => setAccentColor(event.target.value)}+ aria-label="Provider instance accent color"+ className="h-8 w-10 cursor-pointer rounded-xl border border-input bg-background p-0.5"/>- {showInstanceIdError ? (- <span className="text-[11px] text-destructive">{instanceIdError}</span>- ) : (- <span className="text-[11px] text-muted-foreground">- Routing key used by threads and sessions. Letters, digits, '-', or '_'.- </span>- )}- </label>-- <div className={cn("grid gap-2", wizardStep !== 1 && "hidden")}>- <span className="text-xs font-medium text-foreground">Accent color</span>- <div className="flex min-w-0 flex-wrap items-center gap-2">- <input- type="color"- value={normalizeProviderAccentColor(accentColor) ?? PROVIDER_ACCENT_SWATCHES[0]}- onChange={(event) => setAccentColor(event.target.value)}- aria-label="Provider instance accent color"- className="h-8 w-10 cursor-pointer rounded-xl border border-input bg-background p-0.5"- />- <div className="flex flex-wrap gap-1.5">- {PROVIDER_ACCENT_SWATCHES.map((swatch) => {- const selected = accentColor.toLowerCase() === swatch;- return (- <button- key={swatch}- type="button"- className={cn(- "size-6 cursor-pointer rounded-full border transition",- selected- ? "scale-110 border-foreground ring-2 ring-ring ring-offset-1 ring-offset-background"- : "border-black/10 hover:scale-105 dark:border-white/20",- )}- style={{ backgroundColor: swatch }}- onClick={() => setAccentColor(swatch)}- aria-label={`Use ${swatch} accent`}- />- );- })}- </div>- {accentColor ? (- <Button- type="button"- size="xs"- variant="ghost"- className="text-muted-foreground"- onClick={() => setAccentColor("")}- >- Clear- </Button>- ) : null}+ <div className="flex flex-wrap gap-1.5">+ {PROVIDER_ACCENT_SWATCHES.map((swatch) => {+ const selected = accentColor.toLowerCase() === swatch;+ return (+ <button+ key={swatch}+ type="button"+ className={cn(+ "size-6 cursor-pointer rounded-full border transition",+ selected+ ? "scale-110 border-foreground ring-2 ring-ring ring-offset-1 ring-offset-background"+ : "border-black/10 hover:scale-105 dark:border-white/20",+ )}+ style={{ backgroundColor: swatch }}+ onClick={() => setAccentColor(swatch)}+ aria-label={`Use ${swatch} accent`}+ />+ );+ })}</div>- <span className="text-[11px] text-muted-foreground">- Optional marker shown in the picker.- </span>+ {accentColor ? (+ <Button+ type="button"+ size="xs"+ variant="ghost"+ className="text-muted-foreground"+ onClick={() => setAccentColor("")}+ >+ Clear+ </Button>+ ) : null}</div>+ <span className="text-[11px] text-muted-foreground">+ Optional marker shown in the picker.+ </span>+ </div>- {driverSettingsFields.length > 0 ? (- <div className={cn("grid gap-4", wizardStep !== 2 && "hidden")}>- <ProviderSettingsForm- definition={driverOption}- value={configDraft}- idPrefix={`add-provider-${driver}`}- variant="dialog"- onChange={setConfigDraft}- />- </div>- ) : wizardStep === 2 ? (- <div className="grid gap-2">- <p className="text-sm text-muted-foreground">- This driver has no required configuration. You can add the instance now.- </p>- </div>- ) : null}- </WizardPanel>+ {driverSettingsFields.length > 0 ? (+ <div className={cn("grid gap-4", wizardStep !== 2 && "hidden")}>+ <ProviderSettingsForm+ definition={driverOption}+ value={configDraft}+ idPrefix={`add-provider-${driver}`}+ variant="dialog"+ onChange={setConfigDraft}+ />+ </div>+ ) : wizardStep === 2 ? (+ <div className="grid gap-2">+ <p className="text-sm text-muted-foreground">+ This driver has no required configuration. You can add the instance now.+ </p>+ </div>+ ) : null}+ </WizardPanel>- <DialogFooter variant="bare">- <Button- variant="outline"- onClick={() => {- if (wizardStep === 0) {- onOpenChange(false);- return;- }- setWizardStep((step) => Math.max(0, step - 1));- }}- >- {wizardStep === 0 ? "Cancel" : "Back"}- </Button>- {wizardStep < ADD_PROVIDER_WIZARD_STEPS.length - 1 ? (- <Button onClick={() => navigateToStep(wizardStep + 1)}>Next</Button>- ) : (- <Button onClick={handleSave}>Add instance</Button>- )}- </DialogFooter>- </div>- </DialogPopup>+ <WizardFooter>+ <Button+ variant="outline"+ onClick={() => {+ if (wizardStep === 0) {+ onOpenChange(false);+ return;+ }+ setWizardStep((step) => Math.max(0, step - 1));+ }}+ >+ {wizardStep === 0 ? "Cancel" : "Back"}+ </Button>+ {wizardStep < ADD_PROVIDER_WIZARD_STEPS.length - 1 ? (+ <Button onClick={() => navigateToStep(wizardStep + 1)}>Next</Button>+ ) : (+ <Button onClick={handleSave}>Add instance</Button>+ )}+ </WizardFooter>+ </WizardPopup></Dialog>);}diff --git a/apps/web/src/components/settings/SnapShotSetupDialog.tsx b/apps/web/src/components/settings/SnapShotSetupDialog.tsxindex fdf98023639..3b4689f044b 100644--- a/apps/web/src/components/settings/SnapShotSetupDialog.tsx+++ b/apps/web/src/components/settings/SnapShotSetupDialog.tsx@@ -7,16 +7,8 @@ import { CircleCheckIcon } from "lucide-react";import { useEffect, useId, useState, type ReactNode } from "react";import { CaptureShortcutConfig } from "./CaptureShortcutConfig";import { Button } from "../ui/button";-import {- Dialog,- DialogDescription,- DialogFooter,- DialogHeader,- DialogPanel,- DialogPopup,- DialogTitle,-} from "../ui/dialog";-import { WizardSteps } from "../ui/wizard-steps";+import { Dialog, DialogDescription } from "../ui/dialog";+import { WizardSteps, WizardPopup, WizardHeader, WizardPanel, WizardFooter } from "../ui/wizard";import {captureSetupAccessReady,captureSetupBackend,@@ -335,21 +327,19 @@ export function SnapShotSetupDialog({if (!open && !busy) void onClose(false);}}>- <DialogPopup className="max-w-xl" showCloseButton={!busy}>- <DialogHeader>- <DialogTitle>- {desktop ? `Set up snapshots for ${desktop}` : "Set up snapshots"}- </DialogTitle>+ <WizardPopup showCloseButton={!busy}>+ <WizardHeader title={desktop ? `Set up snapshots for ${desktop}` : "Set up snapshots"}><WizardSteps- steps={SETUP_STEPS.map((item, index) => ({ ...item, disabled: index > stepIndex }))}- currentStep={step}- disabled={busy}- onStepSelect={(next) => {- if (next !== step) changeStep(next);+ steps={SETUP_STEPS.map((item) => item.label)}+ currentStep={stepIndex}+ isStepDisabled={(index) => busy || index > stepIndex}+ onStepChange={(index) => {+ const next = SETUP_STEPS[index];+ if (next && next.id !== step) changeStep(next.id);}}/>- </DialogHeader>- <DialogPanel>+ </WizardHeader>+ <WizardPanel><div className="space-y-4 text-sm"><div className="space-y-2" aria-live="polite"><h3 className="flex items-center gap-2 font-medium">{title}</h3>@@ -479,8 +469,8 @@ export function SnapShotSetupDialog({</details>) : null}</div>- </DialogPanel>- <DialogFooter variant="bare">+ </WizardPanel>+ <WizardFooter>{step !== "access" ? (<Button variant="ghost" disabled={busy} onClick={() => changeStep("access")}>Back@@ -566,8 +556,8 @@ export function SnapShotSetupDialog({{busy ? "Saving…" : shortcutChanged ? "Save and finish" : "Done"}</Button>) : null}- </DialogFooter>- </DialogPopup>+ </WizardFooter>+ </WizardPopup></Dialog>);}diff --git a/apps/web/src/components/ui/wizard-steps.tsx b/apps/web/src/components/ui/wizard-steps.tsxdeleted file mode 100644index ccb639dd0fb..00000000000--- a/apps/web/src/components/ui/wizard-steps.tsx+++ /dev/null@@ -1,56 +0,0 @@-import { CheckIcon } from "lucide-react";-import { cn } from "~/lib/utils";--export function WizardSteps<Step extends string>({- steps,- currentStep,- disabled = false,- onStepSelect,-}: {- steps: readonly { id: Step; label: string; disabled?: boolean }[];- currentStep: Step;- disabled?: boolean;- onStepSelect: (step: Step) => void;-}) {- const currentIndex = steps.findIndex((step) => step.id === currentStep);- return (- <ol className="grid auto-cols-fr grid-flow-col gap-2" aria-label="Setup steps">- {steps.map((step, index) => (- <li key={step.id} className="min-w-0">- <button- type="button"- disabled={disabled || step.disabled}- aria-current={index === currentIndex ? "step" : undefined}- className={cn(- "grid w-full min-w-0 grid-cols-[1rem_minmax(0,1fr)] gap-x-2 rounded-lg border px-3 py-2 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-default",- index === currentIndex- ? "border-primary bg-primary/10 ring-1 ring-primary/25"- : index < currentIndex- ? "border-border bg-background"- : "border-border bg-muted/40",- )}- onClick={() => onStepSelect(step.id)}- >- <span- className={cn(- "row-span-2 mt-0.5 grid size-4 place-items-center rounded-full border",- index < currentIndex- ? "border-primary bg-primary text-primary-foreground"- : index === currentIndex- ? "border-primary bg-background"- : "border-muted-foreground/35 bg-background",- )}- aria-hidden- >- {index < currentIndex ? <CheckIcon className="size-3" /> : null}- </span>- <span className="text-[10px] font-medium uppercase text-muted-foreground">- Step {index + 1}- </span>- <span className="truncate text-xs font-semibold text-foreground">{step.label}</span>- </button>- </li>- ))}- </ol>- );-}diff --git a/apps/web/src/components/ui/wizard.tsx b/apps/web/src/components/ui/wizard.tsxindex 8843e265e03..925b263f453 100644--- a/apps/web/src/components/ui/wizard.tsx+++ b/apps/web/src/components/ui/wizard.tsx@@ -1,19 +1,75 @@import { CheckIcon } from "lucide-react";-import type { ComponentProps } from "react";+import type { ComponentProps, ReactNode } from "react";import { cn } from "../../lib/utils";import { AnimatedHeight } from "../AnimatedHeight";+import { DialogPopup, DialogHeader, DialogTitle, DialogDescription, DialogFooter } from "./dialog";++/** Compose a wizard from its header, panel, and footer; flow logic stays with the caller. */+export function WizardPopup({+ children,+ ...props+}: Omit<ComponentProps<typeof DialogPopup>, "className" | "style">) {+ return (+ <DialogPopup {...props} className="max-w-xl overflow-x-hidden overflow-y-auto">+ <div className="flex min-h-0 flex-col">{children}</div>+ </DialogPopup>+ );+}++export function WizardHeader({+ title,+ description,+ identity,+ children,+}: {+ readonly title: ReactNode;+ readonly description?: ReactNode;+ /** Optional branding shown in place of the visible title. The title remains accessible. */+ readonly identity?: ReactNode;+ readonly children?: ReactNode;+}) {+ return (+ <DialogHeader>+ <DialogTitle className={identity ? "sr-only" : undefined}>{title}</DialogTitle>+ {identity}+ {description ? <DialogDescription>{description}</DialogDescription> : null}+ {children}+ </DialogHeader>+ );+}++export function WizardFooter({+ children,+ leading,+}: {+ readonly children: ReactNode;+ readonly leading?: ReactNode;+}) {+ return (+ <DialogFooter variant="bare" className={leading ? "sm:justify-between" : undefined}>+ {leading}+ {leading ? (+ <div className="flex flex-col-reverse gap-2 sm:flex-row">{children}</div>+ ) : (+ children+ )}+ </DialogFooter>+ );+}export function WizardSteps({steps,currentStep,summaries,+ showSummaries = false,onStepChange,isStepDisabled,}: {readonly steps: readonly string[];readonly currentStep: number;readonly summaries?: readonly (string | null)[];+ readonly showSummaries?: boolean;readonly isStepDisabled?: (step: number) => boolean;readonly onStepChange?: (step: number) => void;}) {@@ -61,6 +117,9 @@ export function WizardSteps({)}>{step}+ {showSummaries && index < currentStep && summaries?.[index]+ ? `: ${summaries[index]}`+ : null}</span></Step></li>@@ -70,19 +129,16 @@ export function WizardSteps({}export function WizardPanel({- className,children,holdHeight = false,- ...props-}: ComponentProps<"div"> & { readonly holdHeight?: boolean }) {+}: {+ readonly children: ReactNode;+ readonly holdHeight?: boolean;+}) {return (<divdata-slot="dialog-panel"- className={cn(- "space-y-4 bg-zinc-25/80 px-6 py-5 ring-1 ring-black/5 dark:bg-white/2 dark:ring-white/5",- className,- )}- {...props}+ className="min-w-0 space-y-4 bg-zinc-25/80 px-6 py-5 ring-1 ring-black/5 dark:bg-white/2 dark:ring-white/5"><AnimatedHeight holdHeight={holdHeight}>{children}</AnimatedHeight></div>