ucode-agent 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,46 @@
1
+ import { Card, CardContent } from "@/components/ui/card";
2
+
3
+ export type Stat = {
4
+ label: string;
5
+ value: string;
6
+ /** Change since the last period, e.g. 12 or -3.4. Omit for no delta. */
7
+ change?: number;
8
+ hint?: string;
9
+ };
10
+
11
+ /**
12
+ * The row of numbers at the top of a dashboard.
13
+ *
14
+ * A number on its own says nothing, so each one carries what it is measured
15
+ * against. Rising is not always good, so the colour follows the sign and the
16
+ * caller words the label.
17
+ */
18
+ export function StatCards({ stats }: { stats: Stat[] }) {
19
+ return (
20
+ <div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-4">
21
+ {stats.map((stat) => (
22
+ <Card key={stat.label}>
23
+ <CardContent className="space-y-2 p-5">
24
+ <p className="text-sm font-medium text-muted-foreground">{stat.label}</p>
25
+ <div className="flex items-baseline gap-2">
26
+ <span className="text-2xl font-semibold tabular-nums tracking-tight">{stat.value}</span>
27
+ {stat.change !== undefined ? (
28
+ <span
29
+ className={
30
+ stat.change >= 0
31
+ ? "text-xs font-medium text-emerald-600 dark:text-emerald-400"
32
+ : "text-xs font-medium text-rose-600 dark:text-rose-400"
33
+ }
34
+ >
35
+ {stat.change >= 0 ? "+" : ""}
36
+ {stat.change}%
37
+ </span>
38
+ ) : null}
39
+ </div>
40
+ {stat.hint ? <p className="text-xs text-muted-foreground">{stat.hint}</p> : null}
41
+ </CardContent>
42
+ </Card>
43
+ ))}
44
+ </div>
45
+ );
46
+ }