"use client"; import { cn } from "@/lib/utils"; import type { ChartConfig } from "@openstatus/ui"; import { ChartContainer, ChartTooltip, ChartTooltipContent, } from "@openstatus/ui"; import { Line, LineChart, XAxis } from "recharts"; const chartConfig = { latency: { label: "Latency", color: "var(--color-success)", }, } as ChartConfig; export interface SimpleChartProps { data: { timestamp: string; latency: number | undefined }[]; className?: string; } export function SimpleChart({ data, className }: SimpleChartProps) { return ( { return new Date(value).toLocaleDateString("en-US", { day: "numeric", month: "short", hour: "numeric", minute: "numeric", }); }} formatter={(value, name) => ( <>
{chartConfig[name as keyof typeof chartConfig]?.label || name}
{value} ms
)} /> } /> ); }