added rankings but ugly and tired

This commit is contained in:
2025-10-13 16:44:48 +02:00
parent 1139cfd5f0
commit 174e3e94ed
18 changed files with 721 additions and 51 deletions

View File

@@ -0,0 +1,28 @@
// 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 <Text>{location}: Loading weather...</Text>;
const weatherInfo = weatherCodeMap[weather.weathercode] || { desc: 'Unknown', color: 'white' };
return (
<Text>
{location}: <Text color={weatherInfo.color}>{weatherInfo.desc}</Text>,{' '}
<Text color="cyan">{weather.temperature}°C</Text> (Vent : {weather.windspeed} km/h)
</Text>
);
}
export function WeatherSection({ weatherNancy, weatherParis, width }) {
const flexDirection = width >= 60 ? "row" : "column";
return (
<Box flexDirection={flexDirection} justifyContent="space-between" width={width}>
{renderWeather('Nancy', weatherNancy)}
{renderWeather('Paris', weatherParis)}
</Box>
);
}