"use client"; import { Bar, BarChart, Cell, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts"; import type { SynopStation } from "@/types/imgw"; import { Card } from "@/components/ui/card"; import { useI18n } from "@/lib/i18n"; const INITIAL_CHART_DIMENSION = { width: 1, height: 1 }; const SNAPSHOT_COLORS = [ "hsl(var(--chart-temperature))", "hsl(var(--chart-feels-like))", "hsl(var(--chart-rainfall))", ]; export function SnapshotChart({ station }: { station: SynopStation }) { const { t } = useI18n(); const rows = [ { name: t("weather.humidity"), value: station.humidity, unit: "%", max: 100, color: SNAPSHOT_COLORS[0] }, { name: t("weather.wind"), value: station.windSpeed, unit: "m/s", max: 20, color: SNAPSHOT_COLORS[1] }, { name: t("weather.rainfall"), value: station.rainfall, unit: "mm", max: 30, color: SNAPSHOT_COLORS[2] }, ].filter((row) => row.value !== null).map((row) => ({ ...row, normalized: Math.min(100, ((row.value ?? 0) / row.max) * 100) })); return (

{t("snapshot.label")}

{t("snapshot.title")}

{t("snapshot.description")}

[`${item.payload.value} ${item.payload.unit}`, item.payload.name]} /> {rows.map((row) => )}
); }