"use client"; import { OctagonAlert, Orbit } from "lucide-react"; import Link from "next/link"; import { Progress } from "@/components/ui/progress"; import { cn } from "@/lib/utils"; interface QuotaBarProps { used: number; limit: number; warningThreshold: number; className?: string; } export function QuotaBar({ used, limit, warningThreshold, className }: QuotaBarProps) { const percentage = Math.min((used / limit) * 100, 100); const remaining = Math.max(limit - used, 0); const isWarning = used >= warningThreshold; const isExceeded = used >= limit; return (
{used.toLocaleString()} / {limit.toLocaleString()} tokens {isExceeded ? ( Limit reached ) : isWarning ? ( {remaining.toLocaleString()} remaining ) : ( {percentage.toFixed(0)}% )}
div]:bg-red-500", isWarning && !isExceeded && "[&>div]:bg-amber-500" )} /> {isExceeded && ( Create free account for 5M more tokens )}
); }