Skip to content

Open source alternative to Semrush and Ahrefs

Style the shadcn Button, Badge, Card, Alert, Spinner and Skeleton for OpenSEO (EVE-292) (#725)

Carter Smith8508f67b0ece
diff --git a/src/client/components/CardShell.tsx b/src/client/components/CardShell.tsx
index a43f83ba..bbacbfc7 100644
--- a/src/client/components/CardShell.tsx
+++ b/src/client/components/CardShell.tsx
@@ -1,4 +1,11 @@
import type { ReactNode } from "react";
+import {
+ Card,
+ CardAction,
+ CardContent,
+ CardHeader,
+ CardTitle,
+} from "@/client/components/ui/card";
/** Card with a header row and a divided body: dashboard and connection cards. */
export function CardShell({
@@ -15,24 +22,26 @@ export function CardShell({
children: ReactNode;
}) {
return (
- <div className="overflow-hidden rounded-xl border border-base-300 bg-base-100 shadow-sm">
- <div className="flex items-center justify-between gap-4 px-5 py-4">
- <div className="flex min-w-0 items-center gap-2.5">
+ <Card size="lg">
+ <CardHeader className="border-b">
+ <CardTitle className="flex min-w-0 items-center gap-2.5">
{icon ? (
- <span className="grid size-8 shrink-0 place-items-center rounded-lg border border-base-300 bg-base-100 shadow-sm">
+ <span className="grid size-8 shrink-0 place-items-center rounded-lg border border-border bg-card shadow-sm">
{icon}
</span>
) : null}
- <h2 className="text-base font-semibold leading-tight">{title}</h2>
- </div>
- {action}
- </div>
- <div className="border-t border-base-300 p-5">
+ <h2 className="leading-tight">{title}</h2>
+ </CardTitle>
+ {action ? (
+ <CardAction className="self-center">{action}</CardAction>
+ ) : null}
+ </CardHeader>
+ <CardContent>
{children}
{stamp ? (
- <p className="mt-4 text-[11px] text-base-content/45">{stamp}</p>
+ <p className="mt-4 text-[11px] text-muted-foreground">{stamp}</p>
) : null}
- </div>
- </div>
+ </CardContent>
+ </Card>
);
}
diff --git a/src/client/components/Skeleton.tsx b/src/client/components/Skeleton.tsx
deleted file mode 100644
index 8f0d586e..00000000
--- a/src/client/components/Skeleton.tsx
+++ /dev/null
@@ -1,4 +0,0 @@
-/** A placeholder block with the shape of content that has not loaded yet. Size it with `className`. */
-export function Skeleton({ className = "" }: { className?: string }) {
- return <div aria-hidden className={`skeleton ${className}`} />;
-}
diff --git a/src/client/components/SkeletonPresets.tsx b/src/client/components/SkeletonPresets.tsx
new file mode 100644
index 00000000..534a0a23
--- /dev/null
+++ b/src/client/components/SkeletonPresets.tsx
@@ -0,0 +1,62 @@
+import { cn } from "cn";
+import { Skeleton } from "@/client/components/ui/skeleton";
+
+// Loading layouts built from the shadcn Skeleton primitive.
+
+/** A row of stat cards: a small label over a large value. */
+export function SkeletonStatGrid({
+ count = 4,
+ className,
+}: {
+ count?: number;
+ className?: string;
+}) {
+ return (
+ <div
+ className={cn("grid grid-cols-2 gap-3 lg:grid-cols-4", className)}
+ aria-busy
+ >
+ {Array.from({ length: count }, (_, index) => (
+ <div
+ key={index}
+ className="space-y-2 rounded-lg border border-border bg-card p-4"
+ >
+ <Skeleton className="h-3 w-20" />
+ <Skeleton className="h-7 w-24" />
+ </div>
+ ))}
+ </div>
+ );
+}
+
+/** Table body rows. The first column is twice as wide, for the row label. */
+export function SkeletonTableRows({
+ rows = 8,
+ columns = 5,
+ className,
+}: {
+ rows?: number;
+ columns?: number;
+ className?: string;
+}) {
+ return (
+ <div className={cn("space-y-3", className)} aria-busy>
+ {Array.from({ length: rows }, (_, row) => (
+ <div
+ key={row}
+ className="grid gap-3"
+ style={{
+ gridTemplateColumns: `repeat(${columns + 1}, minmax(0, 1fr))`,
+ }}
+ >
+ {Array.from({ length: columns }, (_cell, column) => (
+ <Skeleton
+ key={column}
+ className={cn("h-4", column === 0 && "col-span-2")}
+ />
+ ))}
+ </div>
+ ))}
+ </div>
+ );
+}
diff --git a/src/client/components/Spinner.tsx b/src/client/components/Spinner.tsx
index cadcc31d..b796cd2f 100644
--- a/src/client/components/Spinner.tsx
+++ b/src/client/components/Spinner.tsx
@@ -1,25 +1,29 @@
-import { Loader2 } from "lucide-react";
+import { cn } from "cn";
+import { Spinner as SpinnerIcon } from "@/client/components/ui/spinner";
+/** A loading indicator with an optional visible label, e.g. "Checking…". */
export function Spinner({
size = "md",
label,
- className = "",
+ className,
}: {
size?: "sm" | "md";
- /** Shown beside the spinner, e.g. "Checking…". Screen readers get "Loading" without it. */
label?: string;
className?: string;
}) {
return (
<span
- role="status"
- className={`inline-flex items-center gap-2 text-sm text-base-content/60 ${className}`}
+ className={cn(
+ "inline-flex items-center gap-2 text-sm text-muted-foreground",
+ className,
+ )}
>
- <Loader2
- aria-hidden
- className={`${size === "sm" ? "size-4" : "size-6"} shrink-0 animate-spin`}
+ {/* The icon is the status element, so it carries the label for screen readers. */}
+ <SpinnerIcon
+ aria-label={label ?? "Loading"}
+ className={size === "sm" ? "size-4" : "size-6"}
/>
- {label ? <span>{label}</span> : <span className="sr-only">Loading</span>}
+ {label ? <span aria-hidden>{label}</span> : null}
</span>
);
}
diff --git a/src/client/components/ui/alert.tsx b/src/client/components/ui/alert.tsx
index 753782a8..31c95234 100644
--- a/src/client/components/ui/alert.tsx
+++ b/src/client/components/ui/alert.tsx
@@ -3,13 +3,21 @@ import { cva, type VariantProps } from "class-variance-authority";
import { cn } from "cn";
const alertVariants = cva(
- "group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",
+ "group/alert relative grid w-full gap-0.5 rounded-lg border border-border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",
{
variants: {
variant: {
default: "bg-card text-card-foreground",
+ info: "border-info/30 bg-info/10 *:[svg]:text-info",
+ success: "border-success/30 bg-success/10 *:[svg]:text-success",
+ warning:
+ "border-warning/40 bg-warning/15 *:[svg]:text-warning-foreground dark:*:[svg]:text-warning",
destructive:
- "bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current",
+ "border-destructive/30 bg-destructive/10 *:data-[slot=alert-title]:text-destructive *:[svg]:text-destructive",
+ },
+ /** A full-width strip with no side borders, for notices above the page content. */
+ banner: {
+ true: "rounded-none border-x-0 border-t-0 px-4 py-2.5 md:px-6",
},
},
defaultVariants: {
@@ -21,13 +29,14 @@ const alertVariants = cva(
function Alert({
className,
variant,
+ banner,
...props
}: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {
return (
<div
data-slot="alert"
role="alert"
- className={cn(alertVariants({ variant }), className)}
+ className={cn(alertVariants({ variant, banner }), className)}
{...props}
/>
);
diff --git a/src/client/components/ui/badge.tsx b/src/client/components/ui/badge.tsx
index 054ed3ee..d7c37da3 100644
--- a/src/client/components/ui/badge.tsx
+++ b/src/client/components/ui/badge.tsx
@@ -12,16 +12,25 @@ const badgeVariants = cva(
secondary:
"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
destructive:
- "bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
+ "border-destructive/30 bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
outline:
"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
+ success: "border-success/30 bg-success/10 text-success",
+ warning:
+ "border-warning/40 bg-warning/15 text-warning-foreground dark:text-warning",
+ info: "border-info/30 bg-info/10 text-info",
ghost:
"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
link: "text-primary underline-offset-4 hover:underline",
},
+ size: {
+ default: "",
+ sm: "h-4 px-1.5 text-[0.625rem]",
+ },
},
defaultVariants: {
variant: "default",
+ size: "default",
},
},
);
@@ -29,6 +38,7 @@ const badgeVariants = cva(
function Badge({
className,
variant = "default",
+ size = "default",
render,
...props
}: useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants>) {
@@ -36,7 +46,7 @@ function Badge({
defaultTagName: "span",
props: mergeProps<"span">(
{
- className: cn(badgeVariants({ variant }), className),
+ className: cn(badgeVariants({ variant, size }), className),
},
props,
),
diff --git a/src/client/components/ui/button.tsx b/src/client/components/ui/button.tsx
index 4212cbb9..0dee8fcd 100644
--- a/src/client/components/ui/button.tsx
+++ b/src/client/components/ui/button.tsx
@@ -1,6 +1,7 @@
import { Button as ButtonPrimitive } from "@base-ui/react/button";
import { cva, type VariantProps } from "class-variance-authority";
import { cn } from "cn";
+import { Spinner } from "@/client/components/ui/spinner";
const buttonVariants = cva(
"group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
@@ -43,14 +44,26 @@ function Button({
className,
variant = "default",
size = "default",
+ pending = false,
+ disabled,
+ children,
...props
-}: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>) {
+}: ButtonPrimitive.Props &
+ VariantProps<typeof buttonVariants> & {
+ /** Disables the button and shows a spinner before the label while a mutation runs. */
+ pending?: boolean;
+ }) {
return (
<ButtonPrimitive
data-slot="button"
className={cn(buttonVariants({ variant, size, className }))}
+ disabled={disabled || pending}
+ aria-busy={pending || undefined}
{...props}
- />
+ >
+ {pending ? <Spinner data-icon="inline-start" /> : null}
+ {children}
+ </ButtonPrimitive>
);
}
diff --git a/src/client/components/ui/card.tsx b/src/client/components/ui/card.tsx
index e89aa38e..e471aefb 100644
--- a/src/client/components/ui/card.tsx
+++ b/src/client/components/ui/card.tsx
@@ -5,13 +5,13 @@ function Card({
className,
size = "default",
...props
-}: React.ComponentProps<"div"> & { size?: "default" | "sm" }) {
+}: React.ComponentProps<"div"> & { size?: "sm" | "default" | "lg" }) {
return (
<div
data-slot="card"
data-size={size}
className={cn(
- "group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
+ "group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl border border-border bg-card py-(--card-spacing) text-sm text-card-foreground shadow-sm [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=lg]:[--card-spacing:--spacing(5)] data-[size=sm]:rounded-lg data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
className,
)}
{...props}
@@ -24,7 +24,7 @@ function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
<div
data-slot="card-header"
className={cn(
- "group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)",
+ "group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl border-border px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)",
className,
)}
{...props}
@@ -37,7 +37,7 @@ function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
<div
data-slot="card-title"
className={cn(
- "text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",
+ "text-base leading-snug font-semibold group-data-[size=sm]/card:text-sm",
className,
)}
{...props}
@@ -83,7 +83,7 @@ function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
<div
data-slot="card-footer"
className={cn(
- "flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)",
+ "flex items-center rounded-b-xl border-t border-border bg-muted/50 p-(--card-spacing)",
className,
)}
{...props}
diff --git a/src/client/components/ui/skeleton.tsx b/src/client/components/ui/skeleton.tsx
index 6181e3b2..373f8b60 100644
--- a/src/client/components/ui/skeleton.tsx
+++ b/src/client/components/ui/skeleton.tsx
@@ -1,10 +1,13 @@
import { cn } from "cn";
+// bg-muted is the page background in the light theme, so a muted skeleton
+// would not show outside a card. A foreground tint shows on both surfaces.
function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="skeleton"
- className={cn("animate-pulse rounded-md bg-muted", className)}
+ aria-hidden
+ className={cn("animate-pulse rounded-md bg-foreground/10", className)}
{...props}
/>
);
diff --git a/src/client/features/ai-search/components/AiSearchLoadingState.tsx b/src/client/features/ai-search/components/AiSearchLoadingState.tsx
index cbcc6a8b..8c6a8d37 100644
--- a/src/client/features/ai-search/components/AiSearchLoadingState.tsx
+++ b/src/client/features/ai-search/components/AiSearchLoadingState.tsx
@@ -1,4 +1,4 @@
-import { Skeleton } from "@/client/components/Skeleton";
+import { Skeleton } from "@/client/components/ui/skeleton";
export function AiSearchLoadingState() {
return (
diff --git a/src/client/features/ai-search/components/PromptExplorerLoadingState.tsx b/src/client/features/ai-search/components/PromptExplorerLoadingState.tsx
index 84aa02e0..2ba2e804 100644
--- a/src/client/features/ai-search/components/PromptExplorerLoadingState.tsx
+++ b/src/client/features/ai-search/components/PromptExplorerLoadingState.tsx
@@ -1,4 +1,4 @@
-import { Skeleton } from "@/client/components/Skeleton";
+import { Skeleton } from "@/client/components/ui/skeleton";
type Props = {
modelCount: number;
diff --git a/src/client/features/backlinks/BacklinksPageSections.tsx b/src/client/features/backlinks/BacklinksPageSections.tsx
index 22339b9f..8c8bd9e7 100644
--- a/src/client/features/backlinks/BacklinksPageSections.tsx
+++ b/src/client/features/backlinks/BacklinksPageSections.tsx
@@ -26,7 +26,7 @@ import {
type BacklinksTab,
} from "@/types/schemas/backlinks";
import type { ResearchScope } from "@/shared/researchScope";
-import { Skeleton } from "@/client/components/Skeleton";
+import { Skeleton } from "@/client/components/ui/skeleton";
import { QueryError } from "@/client/components/QueryState";
const BACKLINKS_RESULTS_TABS: Array<{
diff --git a/src/client/features/backlinks/BacklinksPageStates.tsx b/src/client/features/backlinks/BacklinksPageStates.tsx
index c069247d..acdaa154 100644
--- a/src/client/features/backlinks/BacklinksPageStates.tsx
+++ b/src/client/features/backlinks/BacklinksPageStates.tsx
@@ -1,5 +1,5 @@
import { ShieldAlert } from "lucide-react";
-import { Skeleton } from "@/client/components/Skeleton";
+import { Skeleton } from "@/client/components/ui/skeleton";
export function BacklinksLoadingState() {
return (
diff --git a/src/client/features/billing/BillingFeatureBreakdown.tsx b/src/client/features/billing/BillingFeatureBreakdown.tsx
index 8ce5162d..17826bd6 100644
--- a/src/client/features/billing/BillingFeatureBreakdown.tsx
+++ b/src/client/features/billing/BillingFeatureBreakdown.tsx
@@ -14,7 +14,7 @@ import {
type BillingUsageEvent,
} from "@/serverFunctions/billing";
import { QueryState } from "@/client/components/QueryState";
-import { Skeleton } from "@/client/components/Skeleton";
+import { Skeleton } from "@/client/components/ui/skeleton";
const BILLING_USAGE_FEATURE_IDS: string[] = [
AUTUMN_SEO_DATA_BALANCE_FEATURE_ID,
diff --git a/src/client/features/billing/FreePlanBanner.tsx b/src/client/features/billing/FreePlanBanner.tsx
index dcb62084..00c68f07 100644
--- a/src/client/features/billing/FreePlanBanner.tsx
+++ b/src/client/features/billing/FreePlanBanner.tsx
@@ -57,7 +57,7 @@ export function FreePlanBanner() {
if (isOutOfCredits) {
return (
- <AppBanner variant="error">
+ <AppBanner variant="destructive">
You&rsquo;ve used all your credits. {creditsActionLink} to continue
using OpenSEO.
</AppBanner>
diff --git a/src/client/features/crawler-access/CrawlerAccessForm.tsx b/src/client/features/crawler-access/CrawlerAccessForm.tsx
index 1b5ac6e8..c1b57e01 100644
--- a/src/client/features/crawler-access/CrawlerAccessForm.tsx
+++ b/src/client/features/crawler-access/CrawlerAccessForm.tsx
@@ -1,6 +1,7 @@
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { useState } from "react";
import { toast } from "sonner";
+import { Button } from "@/client/components/ui/button";
import { saveCrawlerCredential } from "@/serverFunctions/crawlerAccess";
import {
isCrawlerAccessExpired,
@@ -111,13 +112,13 @@ export function CrawlerAccessForm({
/>
</label>
- <button
+ <Button
type="submit"
- className="btn btn-primary btn-sm"
- disabled={!canSave || saveMutation.isPending}
+ pending={saveMutation.isPending}
+ disabled={!canSave}
>
- {saveMutation.isPending ? "Saving…" : "Save signature"}
- </button>
+ Save signature
+ </Button>
</form>
);
}
diff --git a/src/client/features/dashboard/DashboardCards.tsx b/src/client/features/dashboard/DashboardCards.tsx
index 165a4c11..4326526d 100644
--- a/src/client/features/dashboard/DashboardCards.tsx
+++ b/src/client/features/dashboard/DashboardCards.tsx
@@ -1,4 +1,5 @@
import { CardShell } from "@/client/components/CardShell";
+import { Button } from "@/client/components/ui/button";
import { Link } from "@tanstack/react-router";
import { useQuery } from "@tanstack/react-query";
import { Check } from "lucide-react";
@@ -23,7 +24,7 @@ import type {
DashboardAuditSummary,
DashboardBacklinkSummary,
} from "@/server/features/dashboard/services/DashboardService";
-import { Skeleton } from "@/client/components/Skeleton";
+import { Skeleton } from "@/client/components/ui/skeleton";
// Plain string-keyed view of the registry: issue types from the DB are not
// statically guaranteed to be registry keys.
@@ -128,13 +129,12 @@ export function AuditHealthCard({
<EmptyCardBody
message="Crawl your site for broken links, missing tags and indexability problems."
cta={
- <Link
- to="/p/$projectId/audit"
- params={{ projectId }}
- className="btn btn-primary btn-sm"
+ <Button
+ nativeButton={false}
+ render={<Link to="/p/$projectId/audit" params={{ projectId }} />}
>
Run an audit
- </Link>
+ </Button>
}
/>
</CardShell>
diff --git a/src/client/features/dashboard/DashboardPage.tsx b/src/client/features/dashboard/DashboardPage.tsx
index 1b81aa72..e73f0782 100644
--- a/src/client/features/dashboard/DashboardPage.tsx
+++ b/src/client/features/dashboard/DashboardPage.tsx
@@ -15,7 +15,7 @@ import {
getDashboardOverview,
refreshDashboardBacklinkSnapshot,
} from "@/serverFunctions/dashboard";
-import { Skeleton } from "@/client/components/Skeleton";
+import { Skeleton } from "@/client/components/ui/skeleton";
export function DashboardPage({ projectId }: { projectId: string }) {
const queryClient = useQueryClient();
diff --git a/src/client/features/dashboard/Ga4Card.tsx b/src/client/features/dashboard/Ga4Card.tsx
index fad32d93..799bc29d 100644
--- a/src/client/features/dashboard/Ga4Card.tsx
+++ b/src/client/features/dashboard/Ga4Card.tsx
@@ -20,7 +20,7 @@ import {
formatCtr,
} from "@/client/features/search-performance/SearchPerformanceColumns";
import { getGa4DashboardReport } from "@/serverFunctions/ga4";
-import { Skeleton } from "@/client/components/Skeleton";
+import { Skeleton } from "@/client/components/ui/skeleton";
function formatTrendDay(date: string): string {
// Construct in local time: Date.parse("2026-08-01") is UTC midnight, which
diff --git a/src/client/features/domain/components/DomainOverviewLoadingState.tsx b/src/client/features/domain/components/DomainOverviewLoadingState.tsx
index e0ebf73d..64243fcf 100644
--- a/src/client/features/domain/components/DomainOverviewLoadingState.tsx
+++ b/src/client/features/domain/components/DomainOverviewLoadingState.tsx
@@ -1,4 +1,4 @@
-import { Skeleton } from "@/client/components/Skeleton";
+import { Skeleton } from "@/client/components/ui/skeleton";
export function DomainOverviewLoadingState() {
return (
diff --git a/src/client/features/domain/components/DomainTableTabSurface.tsx b/src/client/features/domain/components/DomainTableTabSurface.tsx
index c71a5d19..52e745c8 100644
--- a/src/client/features/domain/components/DomainTableTabSurface.tsx
+++ b/src/client/features/domain/components/DomainTableTabSurface.tsx
@@ -1,7 +1,7 @@
import type { ReactNode } from "react";
import { SlidersHorizontal } from "lucide-react";
import { TableExportMenu } from "@/client/components/table/TableBulkActionBar";
-import { TableLoadingRows } from "@/client/features/domain/components/TableLoadingRows";
+import { SkeletonTableRows } from "@/client/components/SkeletonPresets";
type DomainTableExportAction = {
label: string;
@@ -84,7 +84,7 @@ export function DomainTableTabSurface({
: "transition-opacity"
}
>
- {showTableLoading ? <TableLoadingRows /> : children}
+ {showTableLoading ? <SkeletonTableRows className="py-4" /> : children}
</div>
</div>
diff --git a/src/client/features/domain/components/TableLoadingRows.tsx b/src/client/features/domain/components/TableLoadingRows.tsx
deleted file mode 100644
index c6da3599..00000000
--- a/src/client/features/domain/components/TableLoadingRows.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-import { Skeleton } from "@/client/components/Skeleton";
-
-export function TableLoadingRows() {
- return (
- <div className="space-y-3 py-4" aria-busy>
- {Array.from({ length: 8 }).map((_, index) => (
- <div key={index} className="grid grid-cols-6 gap-3">
- <Skeleton className="h-4 col-span-2" />
- <Skeleton className="h-4" />
- <Skeleton className="h-4" />
- <Skeleton className="h-4" />
- <Skeleton className="h-4" />
- </div>
- ))}
- </div>
- );
-}
diff --git a/src/client/features/integrations/GoogleConnectionCard.tsx b/src/client/features/integrations/GoogleConnectionCard.tsx
index 37686728..b5be4be7 100644
--- a/src/client/features/integrations/GoogleConnectionCard.tsx
+++ b/src/client/features/integrations/GoogleConnectionCard.tsx
@@ -1,6 +1,7 @@
import * as React from "react";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { toast } from "sonner";
+import { Badge } from "@/client/components/ui/badge";
import { CardShell } from "@/client/components/CardShell";
import { PermissionHint } from "@/client/components/PermissionHint";
import { GoogleConnectedState } from "@/client/features/integrations/GoogleConnectedState";
@@ -265,31 +266,15 @@ function ConnectionStatusPill({
setupRequired: boolean;
}) {
return (
- <span
- className={[
- "inline-flex shrink-0 items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium",
- connected
- ? "border-success/30 bg-success/10 text-success"
- : setupRequired
- ? "border-warning/30 bg-warning/10 text-warning"
- : "border-base-300 bg-base-200 text-base-content/60",
- ].join(" ")}
+ <Badge
+ variant={connected ? "success" : setupRequired ? "warning" : "outline"}
>
- <span
- className={[
- "size-1.5 rounded-full",
- connected
- ? "bg-success"
- : setupRequired
- ? "bg-warning"
- : "bg-base-content/40",
- ].join(" ")}
- />
+ <span className="size-1.5 rounded-full bg-current" />
{connected
? "Connected"
: setupRequired
? "Setup required"
: "Not connected"}
- </span>
+ </Badge>
);
}
diff --git a/src/client/features/integrations/GoogleLinkErrorAlert.tsx b/src/client/features/integrations/GoogleLinkErrorAlert.tsx
index 7bb56941..5ffbddab 100644
--- a/src/client/features/integrations/GoogleLinkErrorAlert.tsx
+++ b/src/client/features/integrations/GoogleLinkErrorAlert.tsx
@@ -1,5 +1,12 @@
import * as React from "react";
import { X } from "lucide-react";
+import {
+ Alert,
+ AlertAction,
+ AlertDescription,
+ AlertTitle,
+} from "@/client/components/ui/alert";
+import { Button } from "@/client/components/ui/button";
import { googleAuthErrorCopy } from "./googleAuthErrorCopy";
import {
clearGoogleLinkError,
@@ -39,25 +46,22 @@ export function GoogleLinkErrorAlert({
const copy = googleAuthErrorCopy(error.code, PROVIDER_LABELS[provider]);
return (
- <div
- role="alert"
- className={`flex items-start justify-between gap-3 rounded-lg border border-error/30 bg-error/10 p-3.5 text-sm ${className ?? ""}`}
- >
- <div className="space-y-1">
- <p className="font-semibold text-error">{copy.title}</p>
- <p className="text-base-content/70">{copy.description}</p>
- </div>
- <button
- type="button"
- aria-label="Dismiss"
- className="btn btn-ghost btn-xs shrink-0 px-1.5"
- onClick={() => {
- setDismissed(true);
- clearGoogleLinkError();
- }}
- >
- <X className="size-3.5" />
- </button>
- </div>
+ <Alert variant="destructive" className={className}>
+ <AlertTitle>{copy.title}</AlertTitle>
+ <AlertDescription>{copy.description}</AlertDescription>
+ <AlertAction>
+ <Button
+ variant="ghost"
+ size="icon-xs"
+ aria-label="Dismiss"
+ onClick={() => {
+ setDismissed(true);
+ clearGoogleLinkError();
+ }}
+ >
+ <X />
+ </Button>
+ </AlertAction>
+ </Alert>
);
}
diff --git a/src/client/features/keywords/page/KeywordResearchLoadingState.tsx b/src/client/features/keywords/page/KeywordResearchLoadingState.tsx
index f65c5365..7e543d19 100644
--- a/src/client/features/keywords/page/KeywordResearchLoadingState.tsx
+++ b/src/client/features/keywords/page/KeywordResearchLoadingState.tsx
@@ -1,4 +1,4 @@
-import { Skeleton } from "@/client/components/Skeleton";
+import { Skeleton } from "@/client/components/ui/skeleton";
// Mirrors KeywordResearchResults: tabs and the table below md, the SERP panel
// above the table from md, and side by side from xl.
diff --git a/src/client/features/rank-tracking/RankTrackingDomainList.tsx b/src/client/features/rank-tracking/RankTrackingDomainList.tsx
index d2bb1629..2b8f5c29 100644
--- a/src/client/features/rank-tracking/RankTrackingDomainList.tsx
+++ b/src/client/features/rank-tracking/RankTrackingDomainList.tsx
@@ -26,7 +26,7 @@ import {
getDomainListFilterOptions,
type DomainListFilters,
} from "./RankTrackingFilters";
-import { Skeleton } from "@/client/components/Skeleton";
+import { Skeleton } from "@/client/components/ui/skeleton";
import { useDebouncedDraft } from "@/client/hooks/useDebouncedDraft";
import type { RankTrackingListSearch } from "@/types/schemas/rank-tracking-search";
import { QueryError } from "@/client/components/QueryState";
diff --git a/src/client/features/saved-keywords/SavedKeywordsTable.tsx b/src/client/features/saved-keywords/SavedKeywordsTable.tsx
index bf950bec..b473a5b8 100644
--- a/src/client/features/saved-keywords/SavedKeywordsTable.tsx
+++ b/src/client/features/saved-keywords/SavedKeywordsTable.tsx
@@ -22,7 +22,7 @@ import {
formatSavedKeywordDate,
formatSavedKeywordNumber,
} from "./savedKeywordsUtils";
-import { Skeleton } from "@/client/components/Skeleton";
+import { Skeleton } from "@/client/components/ui/skeleton";
const columnHelper = createColumnHelper<SavedKeywordRow>();
diff --git a/src/client/features/search-performance/SearchPerformanceLoadingState.tsx b/src/client/features/search-performance/SearchPerformanceLoadingState.tsx
index 35424e55..32ddcbe1 100644
--- a/src/client/features/search-performance/SearchPerformanceLoadingState.tsx
+++ b/src/client/features/search-performance/SearchPerformanceLoadingState.tsx
@@ -1,4 +1,8 @@
-import { Skeleton } from "@/client/components/Skeleton";
+import {
+ SkeletonStatGrid,
+ SkeletonTableRows,
+} from "@/client/components/SkeletonPresets";
+import { Skeleton } from "@/client/components/ui/skeleton";
// Skeleton loading state for the Search Performance (GSC) page. Mirrors the
// loaded layout — four totals cards over a tabbed table panel — so the shell
@@ -7,17 +11,7 @@ import { Skeleton } from "@/client/components/Skeleton";
export function SearchPerformanceLoadingState() {
return (
<div className="space-y-4" aria-busy>
- <div className="grid grid-cols-2 gap-3 lg:grid-cols-4">
- {Array.from({ length: 4 }).map((_, index) => (
- <div
- key={index}
- className="rounded-lg border border-base-300 bg-base-100 p-4 space-y-2"
- >
- <Skeleton className="h-3 w-20" />
- <Skeleton className="h-7 w-24" />
- </div>
- ))}
- </div>
+ <SkeletonStatGrid />
<div className="overflow-hidden rounded-xl border border-base-300 bg-base-100">
<div className="flex flex-col gap-3 border-b border-base-300 px-4 py-3 lg:flex-row lg:items-center lg:justify-between">
@@ -33,16 +27,7 @@ export function SearchPerformanceLoadingState() {
</div>
</div>
- <div className="space-y-3 p-4">
- {Array.from({ length: 8 }).map((_, index) => (
- <div key={index} className="grid grid-cols-5 gap-3">
- <Skeleton className="col-span-2 h-4" />
- <Skeleton className="h-4" />
- <Skeleton className="h-4" />
- <Skeleton className="h-4" />
- </div>
- ))}
- </div>
+ <SkeletonTableRows columns={4} className="p-4" />
</div>
</div>
);
diff --git a/src/client/layout/AppBanner.tsx b/src/client/layout/AppBanner.tsx
index 754a6200..a1f8bda5 100644
--- a/src/client/layout/AppBanner.tsx
+++ b/src/client/layout/AppBanner.tsx
@@ -1,10 +1,5 @@
import type { ReactNode } from "react";
-
-const variantClass = {
- info: "alert-info",
- warning: "alert-warning",
- error: "alert-error",
-} as const;
+import { Alert, AlertDescription } from "@/client/components/ui/alert";
// The full-width notice strip above the page content in the app shell.
export function AppBanner({
@@ -12,18 +7,16 @@ export function AppBanner({
icon,
children,
}: {
- variant: keyof typeof variantClass;
+ variant: "info" | "warning" | "destructive";
icon?: ReactNode;
children: ReactNode;
}) {
return (
- <div className="shrink-0 px-4 py-2.5 md:px-6">
- <div className="mx-auto max-w-7xl">
- <div className={`alert text-sm ${variantClass[variant]}`}>
- {icon}
- <span>{children}</span>
- </div>
- </div>
- </div>
+ <Alert variant={variant} banner className="shrink-0">
+ {icon}
+ <AlertDescription className="text-foreground">
+ {children}
+ </AlertDescription>
+ </Alert>
);
}