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 (
지도에서 해양 지점을 클릭하세요
{weatherData.location.lat.toFixed(2)}°N, {weatherData.location.lon.toFixed(2)}°E ·{' '} {weatherData.currentTime}