// components/WeatherSection.js
import React from 'react';
import { Box, Text } from 'ink';
import { weatherCodeMap } from '../utils/weatherCodes.js';
function renderWeather(location, weather) {
if (!weather) return {location}: Loading weather...;
const weatherInfo = weatherCodeMap[weather.weathercode] || { desc: 'Unknown', color: 'white' };
return (
{location}: {weatherInfo.desc},{' '}
{weather.temperature}°C (Vent : {weather.windspeed} km/h)
);
}
export function WeatherSection({ weatherNancy, weatherParis, width }) {
const flexDirection = width >= 60 ? "row" : "column";
return (
{renderWeather('Nancy', weatherNancy)}
{renderWeather('Paris', weatherParis)}
);
}