interface WeatherData { stationName: string location: { lat: number; lon: number } currentTime: string wind: { speed: number direction: number speed_1k: number speed_3k: number } wave: { height: number period: number } temperature: { current: number feelsLike: number } pressure: number visibility: number 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 sunriseTime = '07:12' const sunsetTime = '17:58' const moonrise = '19:35' const moonset = '01:50' const windDir = windDirText(weatherData.wind.direction) const wSpd = Number(weatherData.wind.speed) const wHgt = Number(weatherData.wave.height) const wTemp = Number(weatherData.temperature.current) 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} {weatherData.wind.direction}°
기압{weatherData.pressure} hPa
1k 최고{Number(weatherData.wind.speed_1k).toFixed(1)}
3k 평균{Number(weatherData.wind.speed_3k).toFixed(1)}
가시거리{weatherData.visibility} km
{/* 풍속 게이지 바 */}
{wSpd.toFixed(1)}/20
{/* ── 파도 상세 ── */}
🌊 파도
{wHgt.toFixed(1)}m
유의파고
{(wHgt * 1.6).toFixed(1)}m
최고파고
{weatherData.wave.period}s
주기
NW
파향
{/* 파고 게이지 바 */}
{wHgt.toFixed(1)}/5m
{/* ── 수온/공기 ── */}
🌡️ 수온 · 공기
{wTemp.toFixed(1)}°
수온
2.1°
기온
31.2
염분(PSU)
{/* ── 시간별 예보 ── */}
⏰ 시간별 예보
{weatherData.forecast.map((f, i) => (
{f.hour} {f.icon} {f.temperature}° {f.windSpeed}
))}
{/* ── 천문/조석 ── */}
☀️ 천문 · 조석
{[ { icon: '🌅', label: '일출', value: sunriseTime }, { icon: '🌄', label: '일몰', value: sunsetTime }, { icon: '🌙', label: '월출', value: moonrise }, { icon: '🌜', label: '월몰', value: moonset }, ].map((item, i) => (
{item.icon}
{item.label}
{item.value}
))}
🌓 상현달 14일 조차 6.7m
{/* ── 날씨 특보 ── */}
🚨 날씨 특보
주의 풍랑주의보 예상 08:00~
) }