'use client' interface WeatherAnimationProps { condition: string size?: number } function getCondition(desc: string): 'clear' | 'partly' | 'cloudy' | 'rain' | 'snow' | 'thunder' | 'fog' { const d = desc?.toLowerCase() || '' if (d.includes('гроз')) return 'thunder' if (d.includes('снег') || d.includes('снегопад')) return 'snow' if (d.includes('дождь') || d.includes('ливен') || d.includes('морос')) return 'rain' if (d.includes('туман')) return 'fog' if (d.includes('пасмурн')) return 'cloudy' if (d.includes('облач') || d.includes('перем')) return 'partly' return 'clear' } export default function WeatherAnimation({ condition, size = 64 }: WeatherAnimationProps) { const c = getCondition(condition) const s = size return (
{/* Sun */} {(c === 'clear' || c === 'partly') && ( {/* Rays */} {[0,45,90,135,180,225,270,315].map(angle => ( ))} )} {/* Cloud */} {(c === 'partly' || c === 'cloudy' || c === 'rain' || c === 'snow' || c === 'thunder') && ( )} {/* Rain drops */} {(c === 'rain' || c === 'thunder') && ( {[ { x: 42, delay: 0 }, { x: 52, delay: 0.3 }, { x: 62, delay: 0.6 }, { x: 47, delay: 0.9 }, { x: 57, delay: 0.15 }, ].map((drop, i) => ( ))} )} {/* Thunder bolt */} {c === 'thunder' && ( )} {/* Snow flakes */} {c === 'snow' && ( {[ { x: 42, delay: 0 }, { x: 52, delay: 0.4 }, { x: 62, delay: 0.8 }, { x: 47, delay: 1.2 }, { x: 57, delay: 0.2 }, ].map((flake, i) => ( ))} )} {/* Fog lines */} {c === 'fog' && ( {[40, 52, 64].map((y, i) => ( ))} )}
) }