interface WeatherData { stationName: string; location: { lat: number; lon: number }; currentTime: string; wind: { speed: number; direction: number; directionLabel: string; speed_1k: number; speed_3k: number; }; wave: { height: number; maxHeight: number; period: number; direction: string; }; temperature: { current: number; feelsLike: number; }; pressure: number; visibility: number; salinity: number; astronomy?: { sunrise: string; sunset: string; moonrise: string; moonset: string; moonPhase: string; tidalRange: number; }; alert?: string; forecast: WeatherForecast[]; } interface WeatherForecast { time: string; hour: string; icon: string; temperature: number; windSpeed: number; } interface WeatherRightPanelProps { weatherData: WeatherData | null; } /** 풍속 등급 색상 */ function windColor(speed: number): string { if (speed >= 14) return '#ef4444'; if (speed >= 10) return '#f97316'; if (speed >= 6) return '#eab308'; return '#22c55e'; } /** 파고 등급 색상 */ function waveColor(height: number): string { if (height >= 3) return '#ef4444'; if (height >= 2) return '#f97316'; if (height >= 1) return '#eab308'; return '#22c55e'; } /** 풍향 텍스트 */ function windDirText(deg: number): string { const dirs = [ 'N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW', ]; return dirs[Math.round(deg / 22.5) % 16]; } export function WeatherRightPanel({ weatherData }: WeatherRightPanelProps) { if (!weatherData) { return (

지도에서 해양 지점을 클릭하세요

); } const { wind, wave, temperature, pressure, visibility, salinity, astronomy, alert, forecast } = weatherData; const wSpd = wind.speed; const wHgt = wave.height; const wTemp = temperature.current; const windDir = windDirText(wind.direction); return (
{/* 헤더 */}
📍 {weatherData.stationName} 기상예보관

{weatherData.location.lat.toFixed(2)}°N, {weatherData.location.lon.toFixed(2)}°E ·{' '} {weatherData.currentTime}

{/* 스크롤 콘텐츠 */}
{/* ── 핵심 지표 3칸 카드 ── */}
{wSpd.toFixed(1)}
풍속 (m/s)
{wHgt.toFixed(1)}
파고 (m)
{wTemp.toFixed(1)}
수온 (°C)
{/* ── 바람 상세 ── */}
🌬️ 바람 현황
{/* 풍향 컴파스 */}
{['N', 'E', 'S', 'W'].map((d, i) => { const angle = i * 90; const rad = ((angle - 90) * Math.PI) / 180; const x = 25 + 20 * Math.cos(rad); const y = 25 + 20 * Math.sin(rad); return ( {d} ); })} {/* 풍향 화살표 */}
풍향 {windDir} {wind.direction}°
기압 {pressure} hPa
1k 최고 {Number(wind.speed_1k).toFixed(1)}
3k 평균 {Number(wind.speed_3k).toFixed(1)}
가시거리 {visibility} km
{/* 풍속 게이지 바 */}
{wSpd.toFixed(1)}/20
{/* ── 파도 상세 ── */}
🌊 파도
{wHgt.toFixed(1)}m
유의파고
{wave.maxHeight.toFixed(1)}m
최고파고
{wave.period}s
주기
{wave.direction}
파향
{/* 파고 게이지 바 */}
{wHgt.toFixed(1)}/5m
{/* ── 수온/공기 ── */}
🌡️ 수온 · 공기
{wTemp.toFixed(1)}°
수온
{temperature.feelsLike.toFixed(1)}°
기온
{salinity.toFixed(1)}
염분(PSU)
{/* ── 시간별 예보 ── */}
⏰ 시간별 예보
{forecast.map((f, i) => (
{f.hour} {f.icon} {f.temperature}° {f.windSpeed}
))}
{/* ── 천문/조석 ── */} {astronomy && (
☀️ 천문 · 조석
{[ { icon: '🌅', label: '일출', value: astronomy.sunrise }, { icon: '🌄', label: '일몰', value: astronomy.sunset }, { icon: '🌙', label: '월출', value: astronomy.moonrise }, { icon: '🌜', label: '월몰', value: astronomy.moonset }, ].map((item, i) => (
{item.icon}
{item.label}
{item.value}
))}
🌓 {astronomy.moonPhase} 조차 {astronomy.tidalRange}m
)} {/* ── 날씨 특보 ── */} {alert && (
🚨 날씨 특보
주의 {alert}
)}
); }