mirror of
https://github.com/soconnor0919/beenvoice.git
synced 2026-05-08 09:38:55 -04:00
93 lines
2.2 KiB
TypeScript
93 lines
2.2 KiB
TypeScript
"use client";
|
|
|
|
import {
|
|
TrendingDown,
|
|
TrendingUp,
|
|
Minus,
|
|
DollarSign,
|
|
Clock,
|
|
Users,
|
|
} from "lucide-react";
|
|
import { Card, CardContent } from "~/components/ui/card";
|
|
|
|
type IconName = "DollarSign" | "Clock" | "Users" | "TrendingDown";
|
|
|
|
interface AnimatedStatsCardProps {
|
|
title: string;
|
|
value: string;
|
|
change: string;
|
|
trend: "up" | "down" | "neutral";
|
|
iconName: IconName;
|
|
description: string;
|
|
delay?: number;
|
|
isCurrency?: boolean;
|
|
numericValue?: number;
|
|
}
|
|
|
|
const iconMap = {
|
|
DollarSign,
|
|
Clock,
|
|
Users,
|
|
TrendingDown,
|
|
} as const;
|
|
|
|
export function AnimatedStatsCard({
|
|
title,
|
|
value,
|
|
change,
|
|
trend,
|
|
iconName,
|
|
description,
|
|
delay = 0,
|
|
isCurrency = false,
|
|
numericValue,
|
|
}: AnimatedStatsCardProps) {
|
|
const Icon = iconMap[iconName];
|
|
|
|
let TrendIcon = Minus;
|
|
if (trend === "up") TrendIcon = TrendingUp;
|
|
if (trend === "down") TrendIcon = TrendingDown;
|
|
|
|
const isPositive = trend === "up";
|
|
const isNeutral = trend === "neutral";
|
|
|
|
// For now, always use the formatted value prop to ensure correct display
|
|
// Animation can be added back once the basic display is working correctly
|
|
const displayValue = value;
|
|
|
|
// Suppress unused parameter warnings for now
|
|
void delay;
|
|
void isCurrency;
|
|
void numericValue;
|
|
|
|
return (
|
|
<Card>
|
|
<CardContent className="p-6">
|
|
<div className="flex items-center justify-between space-y-0 pb-2">
|
|
<div className="flex items-center space-x-2">
|
|
<Icon className="text-muted-foreground h-5 w-5" />
|
|
<p className="text-muted-foreground text-sm font-medium">{title}</p>
|
|
</div>
|
|
<div
|
|
className="flex items-center space-x-1 text-xs"
|
|
style={{
|
|
color: isNeutral
|
|
? "hsl(var(--muted-foreground))"
|
|
: isPositive
|
|
? "oklch(var(--chart-2))"
|
|
: "oklch(var(--chart-3))",
|
|
}}
|
|
>
|
|
<TrendIcon className="h-3 w-3" />
|
|
<span>{change}</span>
|
|
</div>
|
|
</div>
|
|
<div className="space-y-1">
|
|
<p className="animate-count-up text-2xl font-bold">{displayValue}</p>
|
|
<p className="text-muted-foreground text-xs">{description}</p>
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
);
|
|
}
|