Open source alternative to Semrush and Ahrefs
TypeScript backlink-analysisgoogle-search-console-mcpkeyword-researchmcpseoseo-agentseo-auditseo-automationseo-skillsseo-toolssite-audit
Style the shadcn Accordion, Collapsible and Progress for OpenSEO and add SearchCard, GateCard, StatusScreen and ExpandableList (EVE-298) (#739)
Carter Smith81033e48f2f3
diff --git a/src/client/components/ExpandableList.tsx b/src/client/components/ExpandableList.tsxnew file mode 100644index 00000000..531622fb--- /dev/null+++ b/src/client/components/ExpandableList.tsx@@ -0,0 +1,38 @@+import { useState, type ReactNode } from "react";+import { Button } from "@/client/components/ui/button";++const LIMIT = 3;++/**+ * A list that shows its first three items and a "+N more" toggle for the+ * rest. `renderItem` returns the `<li>`, with its key.+ */+export function ExpandableList<TItem>({+ items,+ renderItem,+ className,+}: {+ items: readonly TItem[];+ renderItem: (item: TItem, index: number) => ReactNode;+ className?: string;+}) {+ const [expanded, setExpanded] = useState(false);+ const visible = expanded ? items : items.slice(0, LIMIT);++ return (+ <div className="space-y-1">+ <ul className={className}>{visible.map(renderItem)}</ul>+ {items.length > LIMIT ? (+ <Button+ variant="link"+ size="xs"+ className="h-auto px-0 text-muted-foreground hover:text-foreground"+ aria-expanded={expanded}+ onClick={() => setExpanded((current) => !current)}+ >+ {expanded ? "Show less" : `+${items.length - LIMIT} more`}+ </Button>+ ) : null}+ </div>+ );+}diff --git a/src/client/components/GateCard.tsx b/src/client/components/GateCard.tsxnew file mode 100644index 00000000..81b5f1d5--- /dev/null+++ b/src/client/components/GateCard.tsx@@ -0,0 +1,81 @@+import type { ReactNode } from "react";+import type { LucideIcon } from "lucide-react";+import { cn } from "cn";+import { Card, CardContent } from "@/client/components/ui/card";++const ICON_TONES = {+ primary: "bg-primary/10 text-primary",+ warning: "bg-warning/15 text-warning-foreground dark:text-warning",+};++/**+ * The card that stands in for a feature the user cannot use yet: a paid-plan+ * upsell, a beta opt-in or a missing setup step. It says what the feature+ * does and gives the one action that unlocks it.+ */+export function GateCard({+ icon: Icon,+ tone = "primary",+ badge,+ title,+ description,+ actions,+ features,+ children,+ className,+}: {+ icon?: LucideIcon;+ tone?: keyof typeof ICON_TONES;+ /** A label above the title, such as a "Paid plan" Badge. */+ badge?: ReactNode;+ title: ReactNode;+ description: ReactNode;+ actions: ReactNode;+ /** What the feature gives, in a grid below the actions. */+ features?: { icon: LucideIcon; title: string; body: string }[];+ /** Status below the actions, such as an Alert. */+ children?: ReactNode;+ className?: string;+}) {+ return (+ <Card size="lg" className={cn("w-full gap-0 py-0", className)}>+ <CardContent className="space-y-5 py-6">+ <div className="space-y-3">+ {Icon ? (+ <div+ className={cn(+ "flex size-10 items-center justify-center rounded-lg",+ ICON_TONES[tone],+ )}+ >+ <Icon className="size-5" aria-hidden />+ </div>+ ) : null}+ {badge}+ <h2 className="text-xl font-semibold tracking-tight">{title}</h2>+ <div className="space-y-3 text-sm leading-relaxed text-muted-foreground">+ {description}+ </div>+ </div>+ <div className="flex flex-wrap items-center gap-3">{actions}</div>+ {children}+ </CardContent>++ {features ? (+ <CardContent className="grid grid-cols-1 gap-5 border-t border-border py-6 sm:grid-cols-3">+ {features.map((feature) => (+ <div key={feature.title} className="space-y-2">+ <div className="inline-flex size-9 items-center justify-center rounded-lg bg-primary/10 text-primary">+ <feature.icon className="size-4" aria-hidden />+ </div>+ <h3 className="text-sm font-semibold">{feature.title}</h3>+ <p className="text-xs leading-relaxed text-muted-foreground">+ {feature.body}+ </p>+ </div>+ ))}+ </CardContent>+ ) : null}+ </Card>+ );+}diff --git a/src/client/components/RecentSearches.tsx b/src/client/components/RecentSearches.tsxindex 3216d50c..b36cbffc 100644--- a/src/client/components/RecentSearches.tsx+++ b/src/client/components/RecentSearches.tsx@@ -1,5 +1,8 @@-import type { ComponentType, ReactNode } from "react";-import { ArrowLeft, Clock, History, X } from "lucide-react";+import type { ReactNode } from "react";+import { ArrowLeft, Clock, History, X, type LucideIcon } from "lucide-react";+import { EmptyState } from "@/client/components/EmptyState";+import { Button, buttonVariants } from "@/client/components/ui/button";+import { Card, CardContent, CardHeader } from "@/client/components/ui/card";// Props for the caller's clickable element. Spread them onto a <Link> so// cmd+click and "open in new tab" work, or onto a <button> for in-page state.@@ -12,7 +15,7 @@ type Props<TItem extends { timestamp: number }> = {renderLink: (item: TItem, props: ClickableProps) => ReactNode;getTitle: (item: TItem) => ReactNode;getSubtitle: (item: TItem) => ReactNode;- emptyIcon: ComponentType<{ className?: string }>;+ emptyIcon: LucideIcon;emptyTitle: string;emptyDescription?: string;};@@ -24,7 +27,7 @@ export function RecentSearches<TItem extends { timestamp: number }>({renderLink,getTitle,getSubtitle,- emptyIcon: EmptyIcon,+ emptyIcon,emptyTitle,emptyDescription,}: Props<TItem>) {@@ -34,72 +37,70 @@ export function RecentSearches<TItem extends { timestamp: number }>({if (items.length === 0) {return (- <section className="rounded-2xl border border-dashed border-base-300 bg-base-100/70 p-6 text-center text-base-content/55 space-y-2">- <EmptyIcon className="size-9 mx-auto opacity-35" />- <p className="text-base font-medium text-base-content/80">- {emptyTitle}- </p>- {emptyDescription ? (- <p className="text-sm max-w-md mx-auto">{emptyDescription}</p>- ) : null}- </section>+ <EmptyState+ icon={emptyIcon}+ title={emptyTitle}+ description={emptyDescription}+ />);}return (- <section className="rounded-2xl border border-base-300 bg-base-100 p-5 md:p-6">- <div className="flex items-center gap-2 mb-4">- <History className="size-4 text-base-content/45" />- <span className="text-sm text-base-content/60">- {items.length} recent search{items.length !== 1 ? "es" : ""}- </span>- </div>+ <Card size="lg">+ <CardHeader className="flex items-center gap-2 text-muted-foreground">+ <History className="size-4" aria-hidden />+ {items.length} recent search{items.length !== 1 ? "es" : ""}+ </CardHeader>- <div className="grid gap-2">- {items.map((item) => (- <div- key={item.timestamp}- className="group flex min-w-0 items-center gap-2 rounded-lg border border-base-300 bg-base-100 p-2"- >- {renderLink(item, {- className:- "flex min-w-0 flex-1 items-center gap-3 rounded-md px-1 py-1 text-left transition-colors hover:bg-base-200",- children: (- <>- <Clock className="size-4 text-base-content/40 shrink-0" />- <div className="min-w-0">- <p className="font-medium text-base-content truncate">- {getTitle(item)}- </p>- {getSubtitle(item) ? (- <p className="text-sm text-base-content/60 truncate">- {getSubtitle(item)}- </p>- ) : null}- </div>- </>- ),- })}- <div className="flex items-center gap-2 shrink-0">- <span className="text-xs text-base-content/40">- {new Date(item.timestamp).toLocaleDateString(undefined, {- month: "short",- day: "numeric",- })}- </span>- <button- type="button"- className="btn btn-ghost btn-xs p-1 reveal-on-hover"- onClick={() => onRemove(item.timestamp)}- aria-label="Remove from recent searches"- >- <X className="size-3" />- </button>- </div>- </div>- ))}- </div>- </section>+ <CardContent>+ <ul className="grid gap-2">+ {items.map((item) => (+ <li+ key={item.timestamp}+ className="group flex min-w-0 items-center gap-2 rounded-lg border border-border p-2"+ >+ {renderLink(item, {+ className:+ "flex min-w-0 flex-1 items-center gap-3 rounded-md px-1 py-1 text-left transition-colors outline-none hover:bg-foreground/5 focus-visible:ring-3 focus-visible:ring-ring/50",+ children: (+ <>+ <Clock+ className="size-4 shrink-0 text-muted-foreground"+ aria-hidden+ />+ <div className="min-w-0">+ <p className="truncate font-medium">{getTitle(item)}</p>+ {getSubtitle(item) ? (+ <p className="truncate text-muted-foreground">+ {getSubtitle(item)}+ </p>+ ) : null}+ </div>+ </>+ ),+ })}+ <div className="flex shrink-0 items-center gap-1">+ <span className="text-xs text-muted-foreground">+ {new Date(item.timestamp).toLocaleDateString(undefined, {+ month: "short",+ day: "numeric",+ })}+ </span>+ <Button+ variant="ghost"+ size="icon-xs"+ className="reveal-on-hover"+ onClick={() => onRemove(item.timestamp)}+ aria-label="Remove from recent searches"+ >+ <X />+ </Button>+ </div>+ </li>+ ))}+ </ul>+ </CardContent>+ </Card>);}@@ -112,11 +113,14 @@ export function RecentSearchesBackLink({return (<div>{render({- className:- "btn btn-ghost btn-sm gap-2 px-0 text-base-content/70 hover:bg-transparent",+ className: buttonVariants({+ variant: "ghost",+ size: "sm",+ className: "-ml-2.5 text-muted-foreground",+ }),children: (<>- <ArrowLeft className="size-4" />+ <ArrowLeft />Recent searches</>),diff --git a/src/client/components/ResearchScopeSelect.tsx b/src/client/components/ResearchScopeSelect.tsxindex 262a7d8a..6df57d42 100644--- a/src/client/components/ResearchScopeSelect.tsx+++ b/src/client/components/ResearchScopeSelect.tsx@@ -1,5 +1,5 @@import { useEffect, useRef, useState } from "react";-import { Check, ChevronDown } from "lucide-react";+import { Check } from "lucide-react";import {RESEARCH_SCOPES,RESEARCH_SCOPE_DESCRIPTIONS,@@ -103,7 +103,6 @@ export function ResearchScopeSelect({onKeyDown={handleKeyDown}><span className="truncate">{RESEARCH_SCOPE_LABELS[value]}</span>- <ChevronDown className="size-4 shrink-0 text-base-content/60" /></button>{open ? (diff --git a/src/client/components/SearchCard.tsx b/src/client/components/SearchCard.tsxnew file mode 100644index 00000000..9f8f8732--- /dev/null+++ b/src/client/components/SearchCard.tsx@@ -0,0 +1,76 @@+import type { ComponentProps, FormEvent, ReactNode } from "react";+import { Search } from "lucide-react";+import { cn } from "cn";+import { Button } from "@/client/components/ui/button";+import { Card, CardContent } from "@/client/components/ui/card";+import {+ InputGroup,+ InputGroupAddon,+ InputGroupInput,+} from "@/client/components/ui/input-group";++/**+ * The search form at the top of a research page: the fields in one row, the+ * submit button at the end, the validation error below.+ */+export function SearchCard({+ onSubmit,+ pending = false,+ error,+ errorId,+ children,+}: {+ onSubmit: (event: FormEvent<HTMLFormElement>) => void;+ /** Shows a spinner in the submit button while the search runs. */+ pending?: boolean;+ error?: string | null;+ /** Point the invalid field's `aria-describedby` at this id. */+ errorId?: string;+ /** The fields, laid out in one row on wide screens. */+ children: ReactNode;+}) {+ return (+ // ResearchScopeSelect opens an absolute menu below the row, so the card+ // must not clip it.+ <Card className="overflow-visible">+ <CardContent className="space-y-3">+ <form+ noValidate+ className="flex flex-col gap-3 lg:flex-row lg:items-center"+ onSubmit={onSubmit}+ >+ {children}+ {/* 40px, to match the DaisyUI selects that still sit in the row. */}+ <Button+ type="submit"+ size="lg"+ className="h-10 px-6"+ pending={pending}+ >+ Search+ </Button>+ </form>+ {error ? (+ <p id={errorId} role="alert" className="text-sm text-destructive">+ {error}+ </p>+ ) : null}+ </CardContent>+ </Card>+ );+}++/** The text input with a search icon that leads a SearchCard row. */+export function SearchInput({+ className,+ ...props+}: ComponentProps<typeof InputGroupInput>) {+ return (+ <InputGroup className={cn("h-10 lg:min-w-0 lg:flex-1", className)}>+ <InputGroupAddon>+ <Search />+ </InputGroupAddon>+ <InputGroupInput {...props} />+ </InputGroup>+ );+}diff --git a/src/client/components/StatusScreen.tsx b/src/client/components/StatusScreen.tsxnew file mode 100644index 00000000..37791123--- /dev/null+++ b/src/client/components/StatusScreen.tsx@@ -0,0 +1,72 @@+import type { ReactNode } from "react";+import { cn } from "cn";+import { Spinner } from "@/client/components/Spinner";++const WIDTHS = {+ sm: "max-w-xs",+ md: "max-w-lg",+ lg: "max-w-3xl",+};++/**+ * A state that fills the page: a spinner while the app finalizes or+ * redirects, a failure, or a gate. It centers its content and scrolls when+ * the content is taller than the page.+ */+export function StatusScreen({+ logo = false,+ title,+ description,+ pending = false,+ children,+ footer,+ size = "md",+}: {+ /** Show the OpenSEO logo, for screens outside the app shell. */+ logo?: boolean;+ title?: ReactNode;+ description?: ReactNode;+ /** Show a spinner below the title. */+ pending?: boolean;+ /** Content below the text, such as an ErrorState or a GateCard. It fills the width. */+ children?: ReactNode;+ footer?: ReactNode;+ /** The width of the content: `sm` for auth screens, `lg` for a wide GateCard. */+ size?: keyof typeof WIDTHS;+}) {+ return (+ // The auto-margin child centers when it fits and stays reachable when it+ // is taller than the page. Plain `justify-center` would clip the overflow.+ <div className="flex h-full w-full flex-col items-center overflow-y-auto p-4 md:p-6">+ <div+ className={cn(+ "m-auto flex w-full flex-col items-center gap-4",+ WIDTHS[size],+ )}+ >+ {logo ? (+ <img+ src="/transparent-logo.png"+ alt="OpenSEO"+ className="size-10 rounded-lg"+ />+ ) : null}+ {title ? (+ <h1 className="text-center text-xl font-semibold">{title}</h1>+ ) : null}+ {pending ? <Spinner /> : null}+ {description ? (+ <p className="text-center text-sm text-muted-foreground">+ {description}+ </p>+ ) : null}+ {children}+ {footer ? (+ <div className="text-center text-xs text-muted-foreground">+ {footer}+ </div>+ ) : null}+ </div>+ </div>+ );+}diff --git a/src/client/components/ui/accordion.tsx b/src/client/components/ui/accordion.tsxindex 3bf4d587..bf8243b0 100644--- a/src/client/components/ui/accordion.tsx+++ b/src/client/components/ui/accordion.tsx@@ -16,7 +16,7 @@ function AccordionItem({ className, ...props }: AccordionPrimitive.Item.Props) {return (<AccordionPrimitive.Itemdata-slot="accordion-item"- className={cn("not-last:border-b", className)}+ className={cn("border-border not-last:border-b", className)}{...props}/>);diff --git a/src/client/components/ui/badge.tsx b/src/client/components/ui/badge.tsxindex d7c37da3..706a3e1f 100644--- a/src/client/components/ui/badge.tsx+++ b/src/client/components/ui/badge.tsx@@ -9,6 +9,8 @@ const badgeVariants = cva(variants: {variant: {default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",+ /** A primary tint, for labels such as "Paid plan" that should not shout. */+ soft: "bg-primary/10 text-primary [a]:hover:bg-primary/20",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:diff --git a/src/client/components/ui/progress.tsx b/src/client/components/ui/progress.tsxindex 3a13b6a6..063a81db 100644--- a/src/client/components/ui/progress.tsx+++ b/src/client/components/ui/progress.tsx@@ -28,7 +28,7 @@ function ProgressTrack({ className, ...props }: ProgressPrimitive.Track.Props) {return (<ProgressPrimitive.TrackclassName={cn(- "relative flex h-1 w-full items-center overflow-x-hidden rounded-full bg-muted",+ "relative flex h-2 w-full items-center overflow-x-hidden rounded-full bg-foreground/10",className,)}data-slot="progress-track"diff --git a/src/client/features/ai-search/BrandLookupPage.tsx b/src/client/features/ai-search/BrandLookupPage.tsxindex 2af9e648..9de5d94f 100644--- a/src/client/features/ai-search/BrandLookupPage.tsx+++ b/src/client/features/ai-search/BrandLookupPage.tsx@@ -15,6 +15,7 @@ import {} from "@/client/components/RecentSearches";import { AiSearchLoadingState } from "@/client/features/ai-search/components/AiSearchLoadingState";import { AiSearchPaidPlanGate } from "@/client/features/ai-search/components/AiSearchPaidPlanGate";+import { Badge } from "@/client/components/ui/badge";import { useBrandLookupSearchHistory } from "@/client/hooks/useBrandLookupSearchHistory";import {BRAND_LOOKUP_MAX_INPUT_LENGTH,@@ -331,9 +332,9 @@ export function BrandLookupPage({{/* Only non-default scopes are stored, so this badge alwaysadds information the query string doesn't carry. */}{item.scope ? (- <span className="badge badge-ghost badge-sm ml-2">+ <Badge variant="secondary" className="ml-2">{RESEARCH_SCOPE_LABELS[item.scope]}- </span>+ </Badge>) : null}</>)}diff --git a/src/client/features/ai-search/components/AiSearchPaidPlanGate.tsx b/src/client/features/ai-search/components/AiSearchPaidPlanGate.tsxindex 82e0b5ab..4ab3c7fa 100644--- a/src/client/features/ai-search/components/AiSearchPaidPlanGate.tsx+++ b/src/client/features/ai-search/components/AiSearchPaidPlanGate.tsx@@ -1,6 +1,9 @@import { Link } from "@tanstack/react-router";import { Sparkles, type LucideIcon } from "lucide-react";import { SUBSCRIBE_ROUTE } from "@/shared/billing";+import { GateCard } from "@/client/components/GateCard";+import { Badge } from "@/client/components/ui/badge";+import { Button } from "@/client/components/ui/button";type Props = {feature: string;@@ -10,40 +13,26 @@ type Props = {export function AiSearchPaidPlanGate({ feature, description, bullets }: Props) {return (- <div className="mx-auto max-w-3xl overflow-hidden rounded-xl border border-base-300 bg-base-100 shadow-sm">- <div className="flex flex-col gap-5 px-6 py-6 sm:flex-row sm:items-start sm:justify-between">- <div className="max-w-xl space-y-2">- <span className="inline-flex items-center gap-1.5 rounded-full bg-primary/10 px-2.5 py-1 text-xs font-medium text-primary">- <Sparkles className="size-3.5" />- Paid plan- </span>- <h2 className="text-xl font-semibold tracking-tight">- Unlock {feature}- </h2>- <p className="text-sm text-base-content/70">{description}</p>- </div>- <Link- to={SUBSCRIBE_ROUTE}- search={{ upgrade: true }}- className="btn btn-primary shrink-0"+ <GateCard+ className="mx-auto max-w-3xl"+ badge={+ <Badge variant="soft">+ <Sparkles data-icon="inline-start" />+ Paid plan+ </Badge>+ }+ title={`Unlock ${feature}`}+ description={<p className="max-w-xl">{description}</p>}+ actions={+ <Button+ size="lg"+ nativeButton={false}+ render={<Link to={SUBSCRIBE_ROUTE} search={{ upgrade: true }} />}>Upgrade- </Link>- </div>-- <div className="grid grid-cols-1 gap-5 border-t border-base-300 px-6 py-6 sm:grid-cols-3">- {bullets.map(({ icon: Icon, title, body }) => (- <div key={title} className="space-y-2">- <div className="inline-flex size-9 items-center justify-center rounded-lg bg-primary/10 text-primary">- <Icon className="size-4" />- </div>- <h3 className="text-sm font-semibold">{title}</h3>- <p className="text-xs leading-relaxed text-base-content/65">- {body}- </p>- </div>- ))}- </div>- </div>+ </Button>+ }+ features={bullets}+ />);}diff --git a/src/client/features/ai-search/components/BrandLookupCitationTables.tsx b/src/client/features/ai-search/components/BrandLookupCitationTables.tsxindex f6e14890..d47b547f 100644--- a/src/client/features/ai-search/components/BrandLookupCitationTables.tsx+++ b/src/client/features/ai-search/components/BrandLookupCitationTables.tsx@@ -1,10 +1,10 @@-import { useState } from "react";import { createColumnHelper, type Table } from "@tanstack/react-table";import { Link } from "@tanstack/react-router";import { ExternalLink, Sparkles } from "lucide-react";import { AppDataTable } from "@/client/components/table/AppDataTable";import { SortableHeader } from "@/client/components/table/SortableHeader";import { HelpLabel } from "@/client/components/HelpLabel";+import { ExpandableList } from "@/client/components/ExpandableList";import { numericNullsLast } from "@/client/components/table/nullSafeSort";import {formatCount,@@ -130,50 +130,36 @@ function KeywordsCell({projectId: string;brand: string;}) {- const [expanded, setExpanded] = useState(false);-if (keywords.length === 0) {- return <span className="text-base-content/40">—</span>;+ return <span className="text-muted-foreground">—</span>;}- const visible = expanded ? keywords : keywords.slice(0, 3);- const remaining = keywords.length - visible.length;-return (- <div className="space-y-1">- <ul className="space-y-0.5">- {visible.map((keyword) => (- <li key={keyword.question}>- <Link- to="/p/$projectId/prompt-explorer"- params={{ projectId }}- search={{ q: keyword.question, hb: brand || undefined }}- className="group/kw inline-flex items-baseline gap-2 text-xs"- title="Run this prompt in Prompt Explorer"+ <ExpandableList+ items={keywords}+ className="space-y-0.5"+ renderItem={(keyword) => (+ <li key={keyword.question}>+ <Link+ to="/p/$projectId/prompt-explorer"+ params={{ projectId }}+ search={{ q: keyword.question, hb: brand || undefined }}+ className="group/kw inline-flex items-baseline gap-2 text-xs"+ title="Run this prompt in Prompt Explorer"+ >+ <span className="text-foreground/80 group-hover/kw:underline">+ {keyword.question}+ </span>+ <span+ className="shrink-0 text-muted-foreground tabular-nums"+ title="Prompt volume in the fetched sample">- <span className="text-base-content/80 group-hover/kw:underline">- {keyword.question}- </span>- <span- className="shrink-0 tabular-nums text-base-content/40"- title="Prompt volume in the fetched sample"- >- {formatCount(keyword.aiSearchVolume)} vol.- </span>- </Link>- </li>- ))}- </ul>- {keywords.length > 3 ? (- <button- type="button"- onClick={() => setExpanded((current) => !current)}- className="text-xs text-base-content/50 hover:text-base-content"- >- {expanded ? "Show less" : `+${remaining} more`}- </button>- ) : null}- </div>+ {formatCount(keyword.aiSearchVolume)} vol.+ </span>+ </Link>+ </li>+ )}+ />);}diff --git a/src/client/features/ai-search/components/PromptExplorerResults.tsx b/src/client/features/ai-search/components/PromptExplorerResults.tsxindex c796da4c..24ca23ba 100644--- a/src/client/features/ai-search/components/PromptExplorerResults.tsx+++ b/src/client/features/ai-search/components/PromptExplorerResults.tsx@@ -1,4 +1,3 @@-import { useState } from "react";import {AlertCircle,CheckCircle2,@@ -12,6 +11,8 @@ import {getModelAccent,} from "@/client/features/ai-search/platformLabels";import { formatUrlForDisplay } from "@/client/components/table/url";+import { ExpandableList } from "@/client/components/ExpandableList";+import { Badge } from "@/client/components/ui/badge";import type {PromptExplorerCitation,PromptExplorerModelResult,@@ -120,29 +121,26 @@ function CitationsList({citations: PromptExplorerCitation[];highlightBrand: string | null;}) {- const [expanded, setExpanded] = useState(false);-- const visible = expanded ? citations : citations.slice(0, 3);- const remaining = citations.length - visible.length;-return (- <div className="border-t border-base-200 bg-base-200/30 px-5 py-3">- <p className="mb-2 text-xs font-medium uppercase tracking-wider text-base-content/50">+ <div className="border-t border-border bg-muted/30 px-5 py-3">+ <p className="mb-2 text-xs font-medium tracking-wider text-muted-foreground uppercase">Cited sources ({citations.length})</p>- <ul className="space-y-1.5">- {visible.map((citation, index) => (+ <ExpandableList+ items={citations}+ className="space-y-1.5"+ renderItem={(citation, index) => (<likey={`${citation.url}-${index}`}className="flex items-start gap-2 text-sm">- <span className="mt-1 size-1 shrink-0 rounded-full bg-base-content/30" />+ <span className="mt-1 size-1 shrink-0 rounded-full bg-foreground/30" /><ahref={citation.url}target="_blank"rel="noreferrer"- className={`link inline-flex items-start gap-1 ${- citation.matchedBrand ? "link-primary font-medium" : ""+ className={`inline-flex items-start gap-1 underline underline-offset-2 ${+ citation.matchedBrand ? "font-medium text-primary" : ""}`}><span className="break-all">@@ -151,22 +149,11 @@ function CitationsList({<ExternalLink className="mt-1 size-3 shrink-0" /></a>{citation.matchedBrand && highlightBrand ? (- <span className="badge badge-primary badge-xs">- {highlightBrand}- </span>+ <Badge size="sm">{highlightBrand}</Badge>) : null}</li>- ))}- </ul>- {citations.length > 3 ? (- <button- type="button"- onClick={() => setExpanded((current) => !current)}- className="mt-1.5 text-xs text-base-content/50 hover:text-base-content"- >- {expanded ? "Show less" : `+${remaining} more`}- </button>- ) : null}+ )}+ /></div>);}diff --git a/src/client/features/audit/AuditDetail.tsx b/src/client/features/audit/AuditDetail.tsxindex 9162d4fa..31fbd357 100644--- a/src/client/features/audit/AuditDetail.tsx+++ b/src/client/features/audit/AuditDetail.tsx@@ -1,7 +1,22 @@-import { AlertCircle, Loader2 } from "lucide-react";+import { AlertCircle } from "lucide-react";import { useQuery } from "@tanstack/react-query";import { QueryError, QueryState } from "@/client/components/QueryState";import { PageLoading } from "@/client/components/Spinner";+import { Badge } from "@/client/components/ui/badge";+import {+ Card,+ CardAction,+ CardContent,+ CardDescription,+ CardHeader,+ CardTitle,+} from "@/client/components/ui/card";+import {+ Progress,+ ProgressLabel,+ ProgressValue,+} from "@/client/components/ui/progress";+import { Spinner } from "@/client/components/ui/spinner";import {getAuditResults,getAuditStatus,@@ -267,62 +282,52 @@ function ProgressCard({return (<div className="space-y-3">- <div className="card bg-base-100 border border-base-300">- <div className="card-body gap-3">- <div className="flex items-center justify-between">- <h2 className="font-medium flex items-center gap-2">- <Loader2 className="size-4 animate-spin text-primary" />+ <Card>+ <CardHeader>+ <CardTitle className="flex items-center gap-2 font-medium">+ <Spinner className="text-primary" aria-hidden />+ {isLighthousePhase ? "Running Lighthouse checks" : "Crawling pages"}+ </CardTitle>+ <CardAction>+ <Badge variant="secondary">{phaseLabel}</Badge>+ </CardAction>+ </CardHeader>+ <CardContent>+ <Progress value={progress}>+ <ProgressLabel className="font-normal">{isLighthousePhase- ? "Running Lighthouse checks"- : "Crawling pages"}- </h2>- <span className="badge badge-ghost badge-sm">{phaseLabel}</span>- </div>-- <progress- className="progress progress-primary w-full"- value={progress}- max={100}- />-- <div className="flex items-center justify-between text-sm">- {isLighthousePhase ? (- <span>- {lighthouseDone} / {status.lighthouseTotal} checks- {status.lighthouseFailed > 0- ? ` (${status.lighthouseFailed} failed)`- : ""}- </span>- ) : (- <span>- {status.pagesCrawled} / {status.pagesTotal} pages- </span>- )}- <span className="text-base-content/60">{progress}%</span>- </div>- </div>- </div>+ ? `${lighthouseDone} / ${status.lighthouseTotal} checks${+ status.lighthouseFailed > 0+ ? ` (${status.lighthouseFailed} failed)`+ : ""+ }`+ : `${status.pagesCrawled} / ${status.pagesTotal} pages`}+ </ProgressLabel>+ <ProgressValue />+ </Progress>+ </CardContent>+ </Card>{crawledUrls.length > 0 && (- <div className="card bg-base-100 border border-base-300">- <div className="card-body gap-2 p-4">- <h3 className="text-sm font-medium text-base-content/70">+ <Card size="sm">+ <CardHeader>+ <CardTitle className="font-medium text-muted-foreground">Crawled Pages ({crawledUrls.length})- </h3>- <p className="text-xs text-base-content/50">+ </CardTitle>+ <CardDescription className="text-xs">Updated {new Date(crawledUrls[0].crawledAt).toLocaleTimeString()}- </p>- <div className="max-h-[400px] overflow-y-auto -mx-1">- {crawledUrls.map((entry, i) => (- <ProgressRow- key={`${entry.url}-${entry.crawledAt}`}- entry={entry}- index={i}- />- ))}- </div>- </div>- </div>+ </CardDescription>+ </CardHeader>+ <CardContent className="max-h-[400px] overflow-y-auto">+ {crawledUrls.map((entry, i) => (+ <ProgressRow+ key={`${entry.url}-${entry.crawledAt}`}+ entry={entry}+ index={i}+ />+ ))}+ </CardContent>+ </Card>)}</div>);diff --git a/src/client/features/backlinks/BacklinksSearchCard.tsx b/src/client/features/backlinks/BacklinksSearchCard.tsxindex 24e0e5fe..72b3fe71 100644--- a/src/client/features/backlinks/BacklinksSearchCard.tsx+++ b/src/client/features/backlinks/BacklinksSearchCard.tsx@@ -1,12 +1,12 @@import { useEffect, useState } from "react";-import { useForm } from "@tanstack/react-form";-import { Search } from "lucide-react";+import { useForm, useStore } from "@tanstack/react-form";import {createFormValidationErrors,getFieldError,shouldValidateFieldOnChange,} from "@/client/lib/forms";import { ResearchScopeSelect } from "@/client/components/ResearchScopeSelect";+import { SearchCard, SearchInput } from "@/client/components/SearchCard";import {defaultScopeForInput,parseResearchTarget,@@ -72,75 +72,51 @@ export function BacklinksSearchCard({setUserSelectedScope(false);}, [form, initialValues]);- return (- <div className="card bg-base-100 border border-base-300">- <div className="card-body gap-4">- <form- className="space-y-3"- onSubmit={(event) => {- event.preventDefault();- void form.handleSubmit();- }}- >- <div className="space-y-3">- <div className="flex flex-col gap-3 lg:flex-row">- <form.Field name="target">- {(field) => {- const targetError = getFieldError(field.state.meta.errors);-- return (- <label- className={`input input-bordered flex flex-1 items-center gap-2 ${targetError ? "input-error" : ""}`}- >- <Search className="size-4 text-base-content/60" />- <input- placeholder="Enter a domain or URL"- value={field.state.value}- onChange={(event) => {- const nextTarget = event.target.value;- field.handleChange(nextTarget);- if (!userSelectedScope) {- form.setFieldValue(- "scope",- defaultScopeForInput(nextTarget),- );- }- }}- />- </label>- );- }}- </form.Field>-- <form.Field name="scope">- {(field) => (- <ResearchScopeSelect- value={field.state.value}- onChange={(scope) => {- setUserSelectedScope(true);- field.handleChange(scope);- }}- />- )}- </form.Field>-- <button type="submit" className="btn btn-primary shrink-0 px-6">- Search- </button>- </div>+ const targetError = useStore(form.store, (state) =>+ getFieldError(state.fieldMeta.target?.errors ?? []),+ );- <form.Field name="target">- {(field) => {- const targetError = getFieldError(field.state.meta.errors);+ return (+ <SearchCard+ onSubmit={(event) => {+ event.preventDefault();+ void form.handleSubmit();+ }}+ error={targetError}+ errorId="backlinks-target-error"+ >+ <form.Field name="target">+ {(field) => (+ <SearchInput+ placeholder="Enter a domain or URL"+ aria-label="Domain or URL"+ value={field.state.value}+ onChange={(event) => {+ const nextTarget = event.target.value;+ field.handleChange(nextTarget);+ if (!userSelectedScope) {+ form.setFieldValue("scope", defaultScopeForInput(nextTarget));+ }+ }}+ aria-invalid={targetError ? true : undefined}+ aria-describedby={+ targetError ? "backlinks-target-error" : undefined+ }+ />+ )}+ </form.Field>- return targetError ? (- <p className="text-sm text-error">{targetError}</p>- ) : null;- }}- </form.Field>- </div>- </form>- </div>- </div>+ <form.Field name="scope">+ {(field) => (+ <ResearchScopeSelect+ value={field.state.value}+ onChange={(scope) => {+ setUserSelectedScope(true);+ field.handleChange(scope);+ }}+ />+ )}+ </form.Field>+ </SearchCard>);}diff --git a/src/client/features/dashboard/DashboardOnboarding.tsx b/src/client/features/dashboard/DashboardOnboarding.tsxindex 76b1381b..d123eead 100644--- a/src/client/features/dashboard/DashboardOnboarding.tsx+++ b/src/client/features/dashboard/DashboardOnboarding.tsx@@ -8,6 +8,18 @@ import type { DashboardActivation } from "@/server/features/dashboard/services/Dimport type { DashboardSetupStep } from "@/types/schemas/dashboard";import { getStepStatus, setupSteps } from "./dashboardSteps";import { DashboardSetupAction } from "./DashboardSetupAction";+import {+ Accordion,+ AccordionContent,+ AccordionItem,+ AccordionTrigger,+} from "@/client/components/ui/accordion";+import { Button } from "@/client/components/ui/button";+import {+ Collapsible,+ CollapsibleContent,+ CollapsibleTrigger,+} from "@/client/components/ui/collapsible";export function DashboardOnboarding({projectId,@@ -52,123 +64,116 @@ export function DashboardOnboarding({return (<sectionaria-label="Onboarding checklist"- className="overflow-hidden rounded-xl border border-base-300 bg-base-100"+ className="overflow-hidden rounded-xl border border-border bg-card">- <header className="border-b border-base-300 px-5 py-5 sm:px-6">+ <header className="border-b border-border px-5 py-5 sm:px-6"><h2 className="text-lg font-semibold">Get started</h2>- <p className="mt-1 text-sm text-base-content/65">+ <p className="mt-1 text-sm text-muted-foreground">Research competitors and keywords, audit your site, and connect yourtools.</p></header>- {remaining.map((item) => {- const active = selected === item.id;- const Icon = item.icon;- return (- <div key={item.id} className="border-b border-base-300">- <button- type="button"- aria-expanded={active}- aria-controls={`setup-${item.id}`}- onClick={() => {- setSelected(active ? null : item.id);- if (!active)- captureClientEvent("dashboard:next_move_click", {- step: item.id,- });- }}- className={`flex w-full items-center gap-3 px-5 py-4 text-left sm:px-6 ${active ? "bg-primary/5" : "hover:bg-base-200/50"}`}- >- <span className="flex size-8 shrink-0 items-center justify-center rounded-lg bg-base-200">- <Icon className="size-4" />- </span>- <span className="min-w-0 flex-1">- <span className="block text-sm font-medium">{item.label}</span>- <span className="mt-1 hidden text-xs text-base-content/65 sm:block">- {item.detail}+ <Accordion+ value={selected ? [selected] : []}+ onValueChange={(value) => {+ const next = remaining.find((step) => step.id === value[0])?.id;+ setSelected(next ?? null);+ if (next)+ captureClientEvent("dashboard:next_move_click", { step: next });+ }}+ >+ {remaining.map((item) => {+ const Icon = item.icon;+ return (+ <AccordionItem key={item.id} value={item.id}>+ <AccordionTrigger className="items-center gap-3 rounded-none border-0 px-5 py-4 hover:bg-foreground/5 hover:no-underline focus-visible:ring-inset aria-expanded:bg-primary/5 sm:px-6">+ <span className="flex size-8 shrink-0 items-center justify-center rounded-lg bg-foreground/5">+ <Icon className="size-4" /></span>- </span>- <ChevronRight- className={`size-4 shrink-0 text-base-content/60 transition-transform ${active ? "rotate-90" : ""}`}- />- </button>- <div id={`setup-${item.id}`} hidden={!active}>- {active && (- <div className="space-y-5 px-5 py-5 sm:px-6">- <DashboardSetupAction- step={item.id}- projectId={projectId}- domain={activation.domain}- onComplete={() => setSelected(null)}- />- <div className="border-t border-base-300 pt-3">- <button- type="button"- className="btn btn-ghost btn-sm text-base-content/60"- disabled={dismiss.isPending}- onClick={() =>- dismiss.mutate({ step: item.id, dismissed: true })- }- >- {item.id === "project"- ? "I only need one project"- : "Skip for now"}- </button>- </div>+ <span className="min-w-0 flex-1">+ <span className="block">{item.label}</span>+ <span className="mt-1 hidden text-xs font-normal text-muted-foreground sm:block">+ {item.detail}+ </span>+ </span>+ </AccordionTrigger>+ <AccordionContent className="space-y-5 px-5 py-5 sm:px-6">+ <DashboardSetupAction+ step={item.id}+ projectId={projectId}+ domain={activation.domain}+ onComplete={() => setSelected(null)}+ />+ <div className="border-t border-border pt-3">+ <Button+ variant="ghost"+ className="text-muted-foreground"+ disabled={dismiss.isPending}+ onClick={() =>+ dismiss.mutate({ step: item.id, dismissed: true })+ }+ >+ {item.id === "project"+ ? "I only need one project"+ : "Skip for now"}+ </Button></div>- )}- </div>- </div>- );- })}+ </AccordionContent>+ </AccordionItem>+ );+ })}+ </Accordion>{deferred.length > 0 && (- <details className="group border-t border-base-300">- <summary className="flex cursor-pointer list-none items-center gap-2 px-5 py-4 text-sm text-base-content/65 sm:px-6 [&::-webkit-details-marker]:hidden">- <ChevronRight className="size-4 transition-transform group-open:rotate-90" />+ <Collapsible className="border-t border-border">+ <CollapsibleTrigger className="group flex w-full items-center gap-2 px-5 py-4 text-left text-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset sm:px-6">+ <ChevronRight className="size-4 transition-transform group-data-panel-open:rotate-90" />{deferred.length} saved for later- </summary>- <ul className="space-y-1 px-5 pb-4 sm:px-6">- {deferred.map((item) => (- <li- key={item.id}- className="flex items-center justify-between gap-3 rounded-lg bg-base-200/40 px-3 py-2"- >- <span className="text-sm">{item.label}</span>- <button- type="button"- aria-label={`Restore ${item.label}`}- className="btn btn-ghost btn-sm shrink-0"- disabled={dismiss.isPending}- onClick={() =>- dismiss.mutate({ step: item.id, dismissed: false })- }+ </CollapsibleTrigger>+ <CollapsibleContent>+ <ul className="space-y-1 px-5 pb-4 sm:px-6">+ {deferred.map((item) => (+ <li+ key={item.id}+ className="flex items-center justify-between gap-3 rounded-lg bg-foreground/5 px-3 py-2">- <RotateCcw className="size-3.5" /> Restore- </button>- </li>- ))}- </ul>- </details>+ <span className="text-sm">{item.label}</span>+ <Button+ variant="ghost"+ aria-label={`Restore ${item.label}`}+ disabled={dismiss.isPending}+ onClick={() =>+ dismiss.mutate({ step: item.id, dismissed: false })+ }+ >+ <RotateCcw data-icon="inline-start" /> Restore+ </Button>+ </li>+ ))}+ </ul>+ </CollapsibleContent>+ </Collapsible>)}{completed.length > 0 && (- <details className="group border-t border-base-300">- <summary className="flex cursor-pointer list-none items-center gap-2 px-5 py-4 text-sm sm:px-6 [&::-webkit-details-marker]:hidden">+ <Collapsible className="border-t border-border">+ <CollapsibleTrigger className="group flex w-full items-center gap-2 px-5 py-4 text-left text-sm outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset sm:px-6"><Check className="size-4 text-success" />{completed.length} completed- <ChevronRight className="ml-auto size-4 text-base-content/60 transition-transform group-open:rotate-90" />- </summary>- <ul className="space-y-3 px-5 pb-5 sm:px-6">- {completed.map((item) => (- <li- key={item.id}- className="flex items-center gap-3 text-sm text-base-content/65"- >- <Check className="size-4 shrink-0 text-success" />- {item.label}- </li>- ))}- </ul>- </details>+ <ChevronRight className="ml-auto size-4 text-muted-foreground transition-transform group-data-panel-open:rotate-90" />+ </CollapsibleTrigger>+ <CollapsibleContent>+ <ul className="space-y-3 px-5 pb-5 sm:px-6">+ {completed.map((item) => (+ <li+ key={item.id}+ className="flex items-center gap-3 text-sm text-muted-foreground"+ >+ <Check className="size-4 shrink-0 text-success" />+ {item.label}+ </li>+ ))}+ </ul>+ </CollapsibleContent>+ </Collapsible>)}</section>);diff --git a/src/client/features/domain/components/DomainSearchCard.tsx b/src/client/features/domain/components/DomainSearchCard.tsxindex 65a2d8f0..3e5d250a 100644--- a/src/client/features/domain/components/DomainSearchCard.tsx+++ b/src/client/features/domain/components/DomainSearchCard.tsx@@ -1,5 +1,5 @@import type { FormEvent } from "react";-import { Search } from "lucide-react";+import { useStore } from "@tanstack/react-form";import { getFieldError } from "@/client/lib/forms";import type { DomainOverviewControlsForm } from "@/client/features/domain/DomainOverviewPage";import { toSortMode } from "@/client/features/domain/utils";@@ -7,8 +7,24 @@ import type { DomainSortMode } from "@/client/features/domain/types";import { LABS_LOCATION_OPTIONS } from "@/client/features/keywords/locations";import { LocationSelect } from "@/client/components/LocationSelect";import { ResearchScopeSelect } from "@/client/components/ResearchScopeSelect";+import { SearchCard, SearchInput } from "@/client/components/SearchCard";+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from "@/client/components/ui/select";import type { ResearchScope } from "@/shared/researchScope";+const SORT_ITEMS: { value: DomainSortMode; label: string }[] = [+ { value: "rank", label: "By Rank" },+ { value: "traffic", label: "By Traffic" },+ { value: "volume", label: "By Volume" },+ { value: "score", label: "By Score" },+ { value: "cpc", label: "By CPC" },+];+type Props = {controlsForm: DomainOverviewControlsForm;isLoading: boolean;@@ -28,108 +44,87 @@ export function DomainSearchCard({onSortChange,onLocationChange,}: Props) {- return (- <div className="card bg-base-100 border border-base-300">- <div className="card-body gap-4">- <form- className="flex flex-col gap-3 lg:flex-row lg:items-center"- onSubmit={onSubmit}- >- <controlsForm.Field name="domain">- {(field) => {- const domainError = getFieldError(field.state.meta.errors);+ const domainError = useStore(controlsForm.store, (state) =>+ getFieldError(state.fieldMeta.domain?.errors ?? []),+ );- return (- <label- className={`input input-bordered flex items-center gap-2 w-full lg:flex-1 lg:min-w-0 lg:max-w-md ${domainError ? "input-error" : ""}`}- >- <Search className="size-4 text-base-content/60" />- <input- className="grow min-w-0"- placeholder="Enter a domain or URL"- value={field.state.value}- onChange={(event) => {- field.handleChange(event.target.value);- onDomainChange(event.target.value);- }}- aria-invalid={domainError ? true : undefined}- aria-describedby={- domainError ? "domain-input-error" : undefined- }- />- </label>- );+ return (+ <SearchCard+ onSubmit={onSubmit}+ pending={isLoading}+ error={domainError}+ errorId="domain-input-error"+ >+ <controlsForm.Field name="domain">+ {(field) => (+ <SearchInput+ placeholder="Enter a domain or URL"+ aria-label="Domain or URL"+ value={field.state.value}+ onChange={(event) => {+ field.handleChange(event.target.value);+ onDomainChange(event.target.value);}}- </controlsForm.Field>-- <controlsForm.Field name="scope">- {(field) => (- <ResearchScopeSelect- value={field.state.value}- className="w-full lg:w-40"- onChange={(scope) => {- field.handleChange(scope);- onScopeChange(scope);- }}- />- )}- </controlsForm.Field>+ aria-invalid={domainError ? true : undefined}+ aria-describedby={domainError ? "domain-input-error" : undefined}+ />+ )}+ </controlsForm.Field>- <controlsForm.Field name="locationCode">- {(field) => (- <LocationSelect- value={field.state.value}- options={LABS_LOCATION_OPTIONS}- className="w-full lg:w-44 lg:shrink-0"- onChange={(code) => {- field.handleChange(code);- onLocationChange(code);- }}- />- )}- </controlsForm.Field>+ <controlsForm.Field name="scope">+ {(field) => (+ <ResearchScopeSelect+ value={field.state.value}+ className="w-full lg:w-40"+ onChange={(scope) => {+ field.handleChange(scope);+ onScopeChange(scope);+ }}+ />+ )}+ </controlsForm.Field>- <controlsForm.Field name="sort">- {(field) => (- <select- className="select select-bordered shrink-0"- value={field.state.value}- onChange={(event) => {- const next = toSortMode(event.target.value) ?? "traffic";- field.handleChange(next);- onSortChange(next);- }}- >- <option value="rank">By Rank</option>- <option value="traffic">By Traffic</option>- <option value="volume">By Volume</option>- <option value="score">By Score</option>- <option value="cpc">By CPC</option>- </select>- )}- </controlsForm.Field>+ <controlsForm.Field name="locationCode">+ {(field) => (+ <LocationSelect+ value={field.state.value}+ options={LABS_LOCATION_OPTIONS}+ className="w-full lg:w-44 lg:shrink-0"+ onChange={(code) => {+ field.handleChange(code);+ onLocationChange(code);+ }}+ />+ )}+ </controlsForm.Field>- <button- type="submit"- className="btn btn-primary shrink-0 px-6"- disabled={isLoading}+ <controlsForm.Field name="sort">+ {(field) => (+ <Select+ items={SORT_ITEMS}+ value={field.state.value}+ onValueChange={(value) => {+ const next = toSortMode(value ?? "") ?? "traffic";+ field.handleChange(next);+ onSortChange(next);+ }}>- {isLoading ? "Loading..." : "Search"}- </button>- </form>-- <controlsForm.Field name="domain">- {(field) => {- const domainError = getFieldError(field.state.meta.errors);-- return domainError ? (- <p id="domain-input-error" className="text-sm text-error">- {domainError}- </p>- ) : null;- }}- </controlsForm.Field>- </div>- </div>+ <SelectTrigger+ aria-label="Sort keywords"+ className="h-10 w-full shrink-0 data-[size=default]:h-10 lg:w-36"+ >+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ {SORT_ITEMS.map((item) => (+ <SelectItem key={item.value} value={item.value}>+ {item.label}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ )}+ </controlsForm.Field>+ </SearchCard>);}diff --git a/src/client/features/rank-tracking/RankTrackingTableToolbar.tsx b/src/client/features/rank-tracking/RankTrackingTableToolbar.tsxindex 97131411..4b43585c 100644--- a/src/client/features/rank-tracking/RankTrackingTableToolbar.tsx+++ b/src/client/features/rank-tracking/RankTrackingTableToolbar.tsx@@ -1,6 +1,7 @@import { CalendarDays, Loader2, SlidersHorizontal, Table } from "lucide-react";import { SegmentedToggle } from "@/client/components/SegmentedToggle";import { ExportMenu } from "@/client/components/ExportMenu";+import { Progress } from "@/client/components/ui/progress";import { MoreMenu } from "./ToolbarMenus";export function RankTrackingTableToolbar({@@ -91,8 +92,9 @@ export function RankTrackingTableToolbar({{latestRun.keywordsChecked}/{latestRun.keywordsTotal || "?"}</span>{latestRun.keywordsTotal > 0 && (- <progress- className="progress progress-primary w-24"+ <Progress+ className="w-24"+ aria-label="Rank check progress"value={latestRun.keywordsChecked}max={latestRun.keywordsTotal}/>diff --git a/src/client/features/sam/SamBetaGate.tsx b/src/client/features/sam/SamBetaGate.tsxindex e4d3f059..b44f00d4 100644--- a/src/client/features/sam/SamBetaGate.tsx+++ b/src/client/features/sam/SamBetaGate.tsx@@ -1,5 +1,7 @@import { Link } from "@tanstack/react-router";import { Sparkles } from "lucide-react";+import { GateCard } from "@/client/components/GateCard";+import { Button } from "@/client/components/ui/button";/*** Shown on the chat route until the user opts into Sam. Sam is the OpenSEO@@ -9,13 +11,11 @@ import { Sparkles } from "lucide-react";*/export function SamBetaGate({ onContinue }: { onContinue: () => void }) {return (- <div className="flex h-full items-center justify-center overflow-auto px-4 py-8 md:px-6">- <div className="w-full max-w-lg rounded-2xl border border-base-300 bg-base-100 p-6 md:p-8">- <div className="flex size-10 items-center justify-center rounded-full bg-primary/10 text-primary">- <Sparkles className="size-5" />- </div>- <h2 className="mt-4 text-xl font-semibold">Sam is in beta</h2>- <div className="mt-3 space-y-3 text-sm leading-relaxed text-base-content/70">+ <GateCard+ icon={Sparkles}+ title="Sam is in beta"+ description={+ <><p>Sam is the OpenSEO MCP and skills wrapped in a chat window. Theagent you already use, like Claude Code, ChatGPT, Grok Bot, or@@ -23,16 +23,18 @@ export function SamBetaGate({ onContinue }: { onContinue: () => void }) {recommend using OpenSEO there.</p><p>You can still use Sam, but it is early and has rough edges.</p>- </div>- <div className="mt-6 flex flex-wrap items-center gap-3">- <Link to="/ai" className="btn btn-primary">+ </>+ }+ actions={+ <>+ <Button size="lg" nativeButton={false} render={<Link to="/ai" />}>Set up your agent- </Link>- <button type="button" className="btn btn-ghost" onClick={onContinue}>+ </Button>+ <Button size="lg" variant="ghost" onClick={onContinue}>Use Sam anyway- </button>- </div>- </div>- </div>+ </Button>+ </>+ }+ />);}diff --git a/src/client/features/sam/SamChat.tsx b/src/client/features/sam/SamChat.tsxindex ac864c0b..7a31822f 100644--- a/src/client/features/sam/SamChat.tsx+++ b/src/client/features/sam/SamChat.tsx@@ -2,7 +2,8 @@ import { Link } from "@tanstack/react-router";import { Suspense, useCallback, useEffect, useRef, useState } from "react";import { Brain } from "lucide-react";import { QueryError } from "@/client/components/QueryState";-import { Spinner } from "@/client/components/Spinner";+import { StatusScreen } from "@/client/components/StatusScreen";+import { Button } from "@/client/components/ui/button";import { useSamAccess } from "./useSamAccess";import { useSamSessions } from "./useSamSessions";import { optInToSamBeta, useSamBetaOptIn } from "./samBetaOptIn";@@ -92,27 +93,27 @@ export function SamChat({}, [isMissing, recheckedSessionId, activeSessionId, refetchSessions]);if (!optedIn) {- return <SamBetaGate onContinue={optInToSamBeta} />;+ return (+ <StatusScreen>+ <SamBetaGate onContinue={optInToSamBeta} />+ </StatusScreen>+ );}if (access.status === "checking") {- return (- <div className="flex h-full items-center justify-center p-4">- <Spinner />- </div>- );+ return <StatusScreen pending />;}if (access.status === "error") {return (- <div className="flex h-full items-center justify-center p-4">+ <StatusScreen><QueryErrorerror={access.error}fallback="Could not load AI agent setup status."onRetry={access.onRetry}isRetrying={access.isRetrying}/>- </div>+ </StatusScreen>);}@@ -120,15 +121,13 @@ export function SamChat({// instructions instead of letting a chat fail mid-stream (self-hosted only).if (access.status === "setup") {return (- <div className="overflow-auto px-4 py-4 md:px-6 md:py-6">- <div className="mx-auto max-w-3xl">- <SamSetupGate- errorMessage={access.errorMessage}- isRefetching={access.isRefetching}- onRetry={access.onRetry}- />- </div>- </div>+ <StatusScreen size="lg">+ <SamSetupGate+ errorMessage={access.errorMessage}+ isRefetching={access.isRefetching}+ onRetry={access.onRetry}+ />+ </StatusScreen>);}@@ -137,7 +136,7 @@ export function SamChat({// redirects into it. Either request can fail, and neither retries itself.const loadFailed = sessionsQuery.isError && !sessionsQuery.data;return (- <div className="flex h-full items-center justify-center p-4">+ <StatusScreen pending={!loadFailed && !createError}>{loadFailed ? (<QueryErrorerror={sessionsQuery.error}@@ -151,10 +150,8 @@ export function SamChat({fallback="Failed to start a new chat."onRetry={startChat}/>- ) : (- <Spinner />- )}- </div>+ ) : null}+ </StatusScreen>);}@@ -165,36 +162,23 @@ export function SamChat({sessionsQuery.data !== undefined &&recheckedSessionId === activeSessionId;if (sessionsQuery.isFetching || (!confirmed && !sessionsQuery.isError)) {- return (- <div className="flex h-full items-center justify-center p-4">- <Spinner />- </div>- );+ return <StatusScreen pending />;}if (sessionsQuery.isError) {return (- <div className="flex h-full items-center justify-center p-4">+ <StatusScreen><QueryErrorerror={sessionsQuery.error}fallback="Failed to load your chats."onRetry={() => void refetchSessions()}/>- </div>+ </StatusScreen>);}return (- <div className="flex h-full flex-col items-center justify-center gap-3 p-4 text-center">- <p className="text-sm text-base-content/70">- This chat was archived or does not exist.- </p>- <button- type="button"- className="btn btn-primary btn-sm"- onClick={() => goToSession()}- >- Go to your latest chat- </button>- </div>+ <StatusScreen description="This chat was archived or does not exist.">+ <Button onClick={() => goToSession()}>Go to your latest chat</Button>+ </StatusScreen>);}@@ -220,13 +204,7 @@ export function SamChat({boundary keeps that suspension inside the chat panel instead ofletting it bubble up and swap out the whole shell — which read asa full page refresh on every session switch. */}- <Suspense- fallback={- <div className="flex flex-1 items-center justify-center">- <Spinner />- </div>- }- >+ <Suspense fallback={<StatusScreen pending />}><SamConversationkey={activeSessionId}projectId={projectId}diff --git a/src/client/features/sam/SamSetupGate.tsx b/src/client/features/sam/SamSetupGate.tsxindex ab73f163..ae31d4d5 100644--- a/src/client/features/sam/SamSetupGate.tsx+++ b/src/client/features/sam/SamSetupGate.tsx@@ -1,5 +1,8 @@import { Link } from "@tanstack/react-router";import { ShieldAlert, Wrench } from "lucide-react";+import { GateCard } from "@/client/components/GateCard";+import { Alert, AlertDescription } from "@/client/components/ui/alert";+import { Button } from "@/client/components/ui/button";export function SamSetupGate({errorMessage,@@ -11,58 +14,60 @@ export function SamSetupGate({onRetry: () => void;}) {return (- <section>- <div className="rounded-2xl border border-base-300 bg-base-100 p-6 md:p-7 space-y-5">- <div className="flex items-start gap-3">- <div className="rounded-xl bg-warning/15 p-2.5 text-warning shrink-0">- <Wrench className="size-5" />- </div>- <div className="max-w-3xl space-y-1.5">- <h2 className="text-xl font-semibold">Enable AI Features</h2>- <div className="text-sm text-base-content/68">- SAM, OpenSEO's in-app AI agent, needs an OpenRouter API key.- Create a key on OpenRouter, set it as the{" "}- <code>OPENROUTER_API_KEY</code> environment variable, restart- OpenSEO, then confirm here.- </div>- <div className="text-xs text-base-content/50">- Step-by-step instructions for every deployment are in the{" "}- <Link- className="underline underline-offset-2 hover:text-base-content/70"- to="/help/openrouter-api-key"- >- OpenRouter API key setup guide- </Link>- .- </div>- </div>- </div>-- <div className="flex flex-wrap items-center gap-3">- <button- className="btn btn-primary"- onClick={onRetry}- disabled={isRefetching}- >- {isRefetching ? "Confirming..." : "Confirm API Key"}- </button>- <a- className="btn"- href="https://openrouter.ai/settings/keys"- target="_blank"- rel="noreferrer"+ <GateCard+ icon={Wrench}+ tone="warning"+ title="Enable AI Features"+ description={+ <>+ <p>+ SAM, OpenSEO's in-app AI agent, needs an OpenRouter API key.+ Create a key on OpenRouter, set it as the{" "}+ <code>OPENROUTER_API_KEY</code> environment variable, restart+ OpenSEO, then confirm here.+ </p>+ <p className="text-xs">+ Step-by-step instructions for every deployment are in the{" "}+ <Link+ className="underline underline-offset-2 hover:text-foreground"+ to="/help/openrouter-api-key"+ >+ OpenRouter API key setup guide+ </Link>+ .+ </p>+ </>+ }+ actions={+ <>+ <Button size="lg" pending={isRefetching} onClick={onRetry}>+ Confirm API Key+ </Button>+ <Button+ size="lg"+ variant="outline"+ nativeButton={false}+ render={+ <a+ href="https://openrouter.ai/settings/keys"+ target="_blank"+ rel="noreferrer"+ />+ }>Open OpenRouter Keys- </a>- </div>-- {errorMessage ? (- <div className="alert alert-warning">- <ShieldAlert className="size-4 shrink-0" />- <span>{errorMessage}</span>- </div>- ) : null}- </div>- </section>+ </Button>+ </>+ }+ >+ {errorMessage ? (+ <Alert variant="warning">+ <ShieldAlert />+ <AlertDescription className="text-foreground">+ {errorMessage}+ </AlertDescription>+ </Alert>+ ) : null}+ </GateCard>);}diff --git a/src/client/styles/app.css b/src/client/styles/app.cssindex 1a3249d8..026f0084 100644--- a/src/client/styles/app.css+++ b/src/client/styles/app.css@@ -285,6 +285,22 @@ select:not([data-slot]) {}}+/* DaisyUI draws a small triangle caret on .select. Draw the chevron that the+ shadcn Select uses instead, in the same place: 16px, 8px from the right+ edge, in the muted text color. A native select cannot hold an icon, so the+ chevron is a background image. */+.select {+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23161616' stroke-opacity='.6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");+ background-position: right 0.5rem center;+ background-size: 1rem 1rem;+ background-repeat: no-repeat;+ padding-inline-end: 2rem;+}++html[data-theme="openseo-dark"] .select {+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e5e5e5' stroke-opacity='.6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");+}+/* Dark mode: neutral interactive surfaces should lift above the panel, notsink below it. DaisyUI derives default buttons and the tabs-box well frombase-200, which is darker than the base-100 content panel in dark mode,diff --git a/src/routes/_app/index.tsx b/src/routes/_app/index.tsxindex ea66c223..8a67df94 100644--- a/src/routes/_app/index.tsx+++ b/src/routes/_app/index.tsx@@ -9,7 +9,7 @@ import {import { getErrorCode } from "@/client/lib/error-messages";import { AuthErrorCard } from "@/client/components/AuthErrorCard";import { QueryError } from "@/client/components/QueryState";-import { Spinner } from "@/client/components/Spinner";+import { StatusScreen } from "@/client/components/StatusScreen";import { SUBSCRIBE_ROUTE } from "@/shared/billing";export const Route = createFileRoute("/_app/")({@@ -56,13 +56,10 @@ function IndexRedirect() {if (errorCode === "PAYMENT_REQUIRED") {return (- <div className="flex items-center justify-center h-full p-4">- <div className="flex flex-col items-center gap-3 max-w-xl text-center">- <p className="text-base-content/80">- Redirecting you to billing so you can start a hosted subscription.- </p>- </div>- </div>+ <StatusScreen+ pending+ description="Redirecting you to billing so you can start a hosted subscription."+ />);}@@ -71,24 +68,18 @@ function IndexRedirect() {error={error}onRetry={() => void refetch()}fallback={- <div className="flex items-center justify-center h-full p-4">- <div className="w-full max-w-xl">- <QueryError- error={error}- fallback="An unexpected error occurred. Please check server logs."- onRetry={() => void refetch()}- isRetrying={isFetching}- />- </div>- </div>+ <StatusScreen>+ <QueryError+ error={error}+ fallback="An unexpected error occurred. Please check server logs."+ onRetry={() => void refetch()}+ isRetrying={isFetching}+ />+ </StatusScreen>}/>);}- return (- <div className="flex items-center justify-center h-full">- <Spinner />- </div>- );+ return <StatusScreen pending />;}diff --git a/src/routes/_authenticated.subscribe.tsx b/src/routes/_authenticated.subscribe.tsxindex a759cc45..8c5c84d8 100644--- a/src/routes/_authenticated.subscribe.tsx+++ b/src/routes/_authenticated.subscribe.tsx@@ -3,7 +3,7 @@ import { useCustomer } from "autumn-js/react";import { useEffect, useState } from "react";import { ArrowRight } from "lucide-react";import { QueryError } from "@/client/components/QueryState";-import { Spinner } from "@/client/components/Spinner";+import { StatusScreen } from "@/client/components/StatusScreen";import { PlanPageAccountMenu } from "@/client/features/billing/PlanPageAccountMenu";import { PlanOfferCard } from "@/client/features/billing/PlanOfferCard";import {@@ -128,54 +128,43 @@ function SubscribePage() {subscribeRouteState === "loading" ||subscribeRouteState === "redirectToApp") {- return <Spinner />;+ return <StatusScreen pending />;}if (subscribeRouteState === "finalizing") {return (- <div className="w-full max-w-xs space-y-4 text-center">- <img- src="/transparent-logo.png"- alt="OpenSEO"- className="mx-auto size-10 rounded-lg"- />- <h1 className="text-xl font-semibold">- Finalizing your subscription…- </h1>- <Spinner />- <p className="text-sm text-base-content/60">- This usually takes a few seconds.- </p>- <p className="text-xs text-base-content/50">- Taking longer?{" "}- <a className="link" href={`mailto:${SUPPORT_EMAIL}`}>- Email {SUPPORT_EMAIL}- </a>- .- </p>- </div>+ <StatusScreen+ logo+ size="sm"+ title="Finalizing your subscription…"+ pending+ description="This usually takes a few seconds."+ footer={+ <>+ Taking longer?{" "}+ <a+ className="underline underline-offset-2 hover:text-foreground"+ href={`mailto:${SUPPORT_EMAIL}`}+ >+ Email {SUPPORT_EMAIL}+ </a>+ .+ </>+ }+ />);}if (subscribeRouteState === "error") {return (- <div className="w-full max-w-xs space-y-4">- <div className="text-center space-y-3">- <img- src="/transparent-logo.png"- alt="OpenSEO"- className="mx-auto size-10 rounded-lg"- />- <h1 className="text-xl font-semibold">Billing unavailable</h1>- </div>-+ <StatusScreen logo title="Billing unavailable" size="sm"><QueryErrorerror={customerQuery.error}fallback="We couldn't verify your billing status right now. Please try again."onRetry={() => void customerQuery.refetch()}isRetrying={customerQuery.isFetching}/>- </div>+ </StatusScreen>);}