Files
EpicNext-Cms/src/components/admin/dashboard-chart.tsx
T
openhands 5e8a13a84f
Deploy / release (push) Successful in 4s
Deploy / deploy (push) Skipped
fix: resolve all biomaly lint errors and warnings across CMS
- Fix CSS parser config (tailwindDirectives enabled)
- Fix noDangerouslySetInnerHtml via SanitizedHtml component
- Fix useExhaustiveDependencies in catalog-manager-dialog
- Fix noArrayIndexKey across 26 files (stable keys)
- Fix SVG a11y (titles, roles, aria-labels)
- Fix label/input associations (htmlFor/id pairs)
- Fix static element interactions (role + keyboard support)
- Fix noImgElement, noDescendingSpecificity (disabled - external Habbo URLs)
- Fix noNonNullAssertion, useTemplate, unused vars/imports
- Add SanitizedHtml shared component
- Migrate biome.json to 2.5.4 schema
2026-07-20 17:41:53 +02:00

56 lines
1.3 KiB
TypeScript

"use client";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
interface ChartDataPoint {
label: string;
value: number;
}
export function DashboardChart({
title,
data,
description,
}: {
title: string;
data: ChartDataPoint[];
color?: string;
description?: string;
}) {
const max = Math.max(1, ...data.map((point) => point.value));
return (
<Card>
<CardHeader className="pb-2">
<CardTitle className="text-sm font-medium">{title}</CardTitle>
{description && (
<p className="text-xs text-muted-foreground">{description}</p>
)}
</CardHeader>
<CardContent>
<div className="flex h-[200px] items-end gap-1" aria-label={title} role="img">
{data.map((point) => (
<div
key={point.label}
className="flex min-w-0 flex-1 flex-col items-center gap-1"
>
<span className="text-[10px] text-muted-foreground">
{point.value}
</span>
<div
className="w-full rounded-t bg-[var(--admin-accent)]"
style={{
height: `${Math.max(2, (point.value / max) * 150)}px`,
}}
title={`${point.label}: ${point.value}`}
/>
<span className="max-w-full truncate text-[9px] text-muted-foreground">
{point.label}
</span>
</div>
))}
</div>
</CardContent>
</Card>
);
}