import React from 'react'; import { WeatherNow, AirQuality, WeatherDaily } from '../types'; import { IcPlay } from '../res/icons'; import { strings } from '../res/strings'; import { stringsEn } from '../res/strings.en'; import { useAppStrings } from '@/os/useAppStrings'; import { useWeatherStore } from '../state'; import { getAqiLevelLabel, normalizeAqiLevel } from '../utils/airQuality'; import { getLocalizedWeatherText } from '../utils/localizedText'; import { convertTemp } from '../utils/unitConversion'; interface CurrentWeatherProps { weather: WeatherNow; airQuality: AirQuality | null; todayForecast: WeatherDaily | null; } export const CurrentWeather: React.FC = ({ weather, airQuality, todayForecast }) => { const s = useAppStrings(strings, stringsEn); const tempUnit = useWeatherStore((st) => st.settings.tempUnit); if (!weather) return null; const weatherText = getLocalizedWeatherText(weather.text, s); const airQualityLabel = airQuality ? getAqiLevelLabel(normalizeAqiLevel(airQuality.category, airQuality.level), s) : ''; return (
{/* Huge Temperature */}
{convertTemp(weather.temp, tempUnit)}°
{/* Weather Description & High/Low */}
{weatherText} {todayForecast && ( {s.temp_high}{convertTemp(todayForecast.tempMax, tempUnit)}° {s.temp_low}{convertTemp(todayForecast.tempMin, tempUnit)}° )}
{/* Pills/Capsules */}
{airQuality && (
🌿 {s.air_quality_prefix}{airQualityLabel} {airQuality.aqi}
)}
{s.weather_forecast_pill}
); };