Some checks failed
build-images / web (push) Has been cancelled
vision2026-ci / Python SDK resource tests (push) Has been cancelled
build-images / api (push) Has been cancelled
build-images / worker-gpu (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Has been cancelled
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Has been cancelled
codeql / Analyze (javascript-typescript) (push) Has been cancelled
codeql / Analyze (python) (push) Has been cancelled
perf / API hot-path micro-smoke (budgeted) (push) Has been cancelled
perf / Desktop engine crates (release build check) (push) Has been cancelled
vision2026-ci / API phase modules (ruff + pytest) (push) Has been cancelled
vision2026-ci / Alembic upgrade + drift check (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Has been cancelled
Paid, hosted product at menivor.com, now retired as a company project. Fresh squashed history of the cleaned working tree (secret-scanned, no .env, no customer data, no outreach logs). Built on MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
66 lines
2.0 KiB
TypeScript
66 lines
2.0 KiB
TypeScript
import * as React from "react";
|
|
import type { LucideIcon } from "lucide-react";
|
|
import { Card, CardContent } from "@/components/ui/card";
|
|
import { cn } from "@/lib/utils";
|
|
|
|
/** Accent colour applied to the icon chip; maps to the theme tokens. */
|
|
export type StatAccent = "primary" | "accent" | "success" | "destructive";
|
|
|
|
const ACCENT_CLASSES: Record<StatAccent, string> = {
|
|
primary: "bg-primary/10 text-primary",
|
|
accent: "bg-accent/10 text-accent",
|
|
success: "bg-success/10 text-success",
|
|
destructive: "bg-destructive/10 text-destructive",
|
|
};
|
|
|
|
export interface StatCardProps {
|
|
/** Short metric label, e.g. "Videos generated". */
|
|
label: string;
|
|
/** Preformatted metric value, e.g. "1,204" or "$12.50". */
|
|
value: string;
|
|
/** Optional secondary line under the value. */
|
|
hint?: string;
|
|
/** Optional leading icon. */
|
|
icon?: LucideIcon;
|
|
/** Icon chip accent colour (default "primary"). */
|
|
accent?: StatAccent;
|
|
}
|
|
|
|
/**
|
|
* A single number card for the insights grid. Presentational only — the caller
|
|
* supplies an already-formatted `value`. Props are read-only (no mutation).
|
|
*/
|
|
export function StatCard({
|
|
label,
|
|
value,
|
|
hint,
|
|
icon: Icon,
|
|
accent = "primary",
|
|
}: Readonly<StatCardProps>) {
|
|
return (
|
|
<Card>
|
|
<CardContent className="flex items-start justify-between gap-3 p-5">
|
|
<div className="min-w-0">
|
|
<p className="truncate text-sm text-muted-foreground">{label}</p>
|
|
<p className="mt-1 text-2xl font-bold tracking-tight tabular-nums">
|
|
{value}
|
|
</p>
|
|
{hint ? (
|
|
<p className="mt-1 truncate text-xs text-muted-foreground">{hint}</p>
|
|
) : null}
|
|
</div>
|
|
{Icon ? (
|
|
<span
|
|
className={cn(
|
|
"flex size-9 shrink-0 items-center justify-center rounded-lg",
|
|
ACCENT_CLASSES[accent],
|
|
)}
|
|
>
|
|
<Icon className="size-4" aria-hidden />
|
|
</span>
|
|
) : null}
|
|
</CardContent>
|
|
</Card>
|
|
);
|
|
}
|