"use client" import { Area, AreaChart, CartesianGrid, XAxis } from "recharts" import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card" import { ChartContainer, ChartLegend, ChartLegendContent, ChartTooltip, ChartTooltipContent } from "@/components/ui/chart" import type { ChartConfig } from "@/components/ui/chart"; const defaultChartConfig = { today: { label: "Hari Ini", color: "var(--chart-1)", }, yesterday: { label: "Kemarin", color: "var(--chart-2)", }, } satisfies ChartConfig interface SalesByHourChartProps { data: any[]; config?: ChartConfig; title?: string; description?: string; } export function SalesByHourChart({ data, config = defaultChartConfig, title = "Jam Sibuk", description = "Menampilkan aktivitas toko berdasarkan pesanan yang masuk per jam." }: SalesByHourChartProps) { const keys = Object.keys(config); return (
{title} {description}
{keys.map((key) => ( ))} } /> {/* Render Areas in reverse order so first key in config is on top */} {[...keys].reverse().map((key) => ( ))} } />
) }