From 73db65c0b2969455be0cb504f5bead499ea0bb61 Mon Sep 17 00:00:00 2001 From: Usman Baig Date: Wed, 11 Mar 2026 23:10:16 +0100 Subject: [PATCH] feat: redesign chart stat headers and fix badge semantic colors --- components/dashboard/Chart.tsx | 24 ++++++++++++------------ components/ui/badge-2.tsx | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/components/dashboard/Chart.tsx b/components/dashboard/Chart.tsx index 88e1bbe..56b22eb 100644 --- a/components/dashboard/Chart.tsx +++ b/components/dashboard/Chart.tsx @@ -4,12 +4,11 @@ import { useState, useMemo, useRef, useCallback, useEffect } from 'react' import { useTheme } from '@ciphera-net/ui' import { Line, LineChart, XAxis, YAxis, ReferenceLine } from 'recharts' import { ChartContainer, ChartTooltip, type ChartConfig } from '@/components/ui/line-charts-6' -import { Badge } from '@/components/ui/badge-2' import { Card, CardContent, CardHeader } from '@/components/ui/card' import { formatNumber, formatDuration, formatUpdatedAgo, DatePicker } from '@ciphera-net/ui' import { Select, DownloadIcon, PlusIcon, XIcon } from '@ciphera-net/ui' import { Checkbox } from '@ciphera-net/ui' -import { ArrowUp, ArrowDown } from '@phosphor-icons/react' +import { ArrowUpRight, ArrowDownRight } from '@phosphor-icons/react' import { cn } from '@/lib/utils' const ANNOTATION_COLORS: Record = { @@ -345,22 +344,23 @@ export default function Chart({ key={m.key} onClick={() => setMetric(m.key)} className={cn( - 'cursor-pointer flex-1 text-start p-4 border-b md:border-b-0 md:border-r md:last:border-r-0 border-neutral-200 dark:border-neutral-800 transition-all', + 'relative cursor-pointer flex-1 text-start p-4 border-b md:border-b-0 md:border-r md:last:border-r-0 border-neutral-200 dark:border-neutral-800 transition-all', metric === m.key && 'bg-neutral-50 dark:bg-neutral-800/40', )} > -
- {m.label} +
{m.label}
+
+ {m.format(m.value)} {m.change !== null && ( - - {m.isPositive ? : } - {Math.abs(m.change).toFixed(1)}% - + + {m.isPositive ? : } + {Math.abs(m.change).toFixed(0)}% + )}
-
{m.format(m.value)}
- {m.previousValue != null && ( -
from {m.format(m.previousValue)}
+
vs yesterday
+ {metric === m.key && ( +
)} ))} diff --git a/components/ui/badge-2.tsx b/components/ui/badge-2.tsx index 4bffe13..bcd3fb4 100644 --- a/components/ui/badge-2.tsx +++ b/components/ui/badge-2.tsx @@ -100,7 +100,7 @@ const badgeVariants = cva( variant: 'success', appearance: 'outline', className: - 'text-green-700 border-green-200 bg-green-50 dark:bg-green-950 dark:border-green-900 dark:text-green-600', + 'text-[#10B981] border-[#10B981]/20 bg-[#10B981]/10', }, { variant: 'warning', @@ -118,7 +118,7 @@ const badgeVariants = cva( variant: 'destructive', appearance: 'outline', className: - 'text-red-700 border-red-100 bg-red-50 dark:bg-red-950 dark:border-red-900 dark:text-red-600', + 'text-[#EF4444] border-[#EF4444]/20 bg-[#EF4444]/10', }, /* Ghost */ {