"use client"; import { motion } from "framer-motion"; import { Droplets, Gauge, MapPin, Navigation, Umbrella, Wind } from "lucide-react"; import { calculateFeelsLike, formatDateTime, formatHumidity, formatPressure, formatRainfall, formatTemperature, formatWind, getWeatherDescription, getWeatherMoodFromData, moodGradient, } from "@/lib/weather-utils"; import type { SynopStation } from "@/types/imgw"; import { WeatherIcon } from "@/components/weather/weather-icon"; import { WeatherEffects } from "@/components/weather/weather-effects"; import { useI18n } from "@/lib/i18n"; export function WeatherHero({ station, locationName, distanceKm }: { station: SynopStation; locationName?: string; distanceKm?: number }) { const { language, t } = useI18n(); const mood = getWeatherMoodFromData(station); const feelsLike = calculateFeelsLike(station.temperature, station.humidity, station.windSpeed); const metrics = [ { icon: Droplets, label: t("weather.humidity"), value: formatHumidity(station.humidity, language) }, { icon: Wind, label: t("weather.wind"), value: formatWind(station.windSpeed, null, language) }, { icon: Umbrella, label: t("weather.rainfallTotal"), value: formatRainfall(station.rainfall, language) }, { icon: Gauge, label: t("weather.pressure"), value: formatPressure(station.pressure, language) }, ]; return (
{locationName ?? station.name} {locationName && {t("location.heroSource", { station: station.name, distance: distanceKm ?? 0 })}}
{formatTemperature(station.temperature, language)}

{getWeatherDescription(station, language)}

{t("weather.feelsLike")} {formatTemperature(feelsLike, language)} · {t("weather.measurement")} {formatDateTime(station.measuredAt, language)}

{metrics.map(({ icon: Icon, label, value }) => (
{label}

{value}

))}
{station.windDirection !== null && (

{t("weather.windDirection")}: {station.windDirection}°

)}
); }