"use client"; import { Bar, CartesianGrid, ComposedChart, Legend, Line, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts"; import { Card } from "@/components/ui/card"; import { useI18n } from "@/lib/i18n"; import { formatForecastRainfall, formatForecastTemperature } from "@/lib/forecast-utils"; import type { HourlyForecast } from "@/types/forecast"; function formatHour(value: string) { return value.slice(11, 16); } export function DayForecastCharts({ hours }: { hours: HourlyForecast[] }) { const { language, t } = useI18n(); const rows = hours.map((hour) => ({ time: formatHour(hour.time), temperature: hour.temperature, feelsLike: hour.feelsLike, precipitation: hour.precipitation, precipitationProbability: hour.precipitationProbability, })); return (

{t("forecast.temperatureChart")}

{t("forecast.temperatureChartDescription")}

[formatForecastTemperature(typeof value === "number" ? value : null, language)]} />

{t("forecast.rainfallChart")}

{t("forecast.rainfallChartDescription")}

[ name === t("forecast.precipitation") ? formatForecastRainfall(typeof value === "number" ? value : null, language) : `${typeof value === "number" ? value : "—"}%`, name, ]} />
); }