import classNames from '~/lib/classNames' interface HorizontalBarChartProps { items: Array<{ label: string value: number // percentage total: string used: string type?: string }> statuses?: Array<{ label: string min_threshold: number color_class: string }> progressiveBarColor?: boolean } export default function HorizontalBarChart({ items, statuses, progressiveBarColor = false, }: HorizontalBarChartProps) { const sortedStatus = statuses?.sort((a, b) => b.min_threshold - a.min_threshold) || [] const getBarColor = (value: number) => { if (!progressiveBarColor) return 'bg-desert-green' if (value >= 90) return 'bg-desert-red' if (value >= 75) return 'bg-desert-orange' if (value >= 50) return 'bg-desert-tan' return 'bg-desert-olive' } const getGlowColor = (value: number) => { if (value >= 90) return 'shadow-desert-red/50' if (value >= 75) return 'shadow-desert-orange/50' if (value >= 50) return 'shadow-desert-tan/50' return 'shadow-desert-olive/50' } const getStatusLabel = (value: number) => { if (sortedStatus.length === 0) return '' for (const status of sortedStatus) { if (value >= status.min_threshold) { return status.label } } return '' } const getStatusColor = (value: number) => { if (sortedStatus.length === 0) return '' for (const status of sortedStatus) { if (value >= status.min_threshold) { return status.color_class } } return '' } return (