"use client"; import { motion } from "framer-motion"; import { Droplets, Wind } from "lucide-react"; function getWeatherEmoji(code: string): string { const c = parseInt(code); if (c === 113) return "☀️"; if (c === 116) return "⛅"; if (c === 119 || c === 122) return "☁️"; if (c >= 176 && c <= 182) return "🌦️"; if (c >= 185 && c <= 200) return "🌧️"; if (c >= 200 && c <= 210) return "⛈️"; if (c >= 210 && c <= 260) return "❄️"; if (c >= 260 && c <= 300) return "🌨️"; if (c >= 300 && c <= 400) return "🌧️"; return "🌤️"; } function formatDate(dateStr: string): string { const d = new Date(dateStr); return d.toLocaleDateString("ru-RU", { weekday: "short", day: "numeric" }); } interface Props { weather: any; } export default function WeatherCard({ weather }: Props) { if (!weather) { return ( Загрузка погоды... ); } return ( {/* Location */} 📍 Санкт-Петербург {/* Current weather */} {getWeatherEmoji(weather.weatherCode)} {weather.temp}° {weather.desc} {/* Stats */} {weather.humidity}% {weather.windSpeed} км/ч Ощущается {weather.feelsLike}° {/* Forecast */} {(weather.forecast || []).slice(0, 3).map((day: any, i: number) => ( {i === 0 ? "Сег." : formatDate(day.date)} {getWeatherEmoji(day.weatherCode)} {day.maxTemp}°/{day.minTemp}° ))} ); }