fix: use IMGW Hybrid for current weather

This commit is contained in:
zv
2026-06-02 16:18:10 +02:00
parent 22b8969379
commit fe73bc23ef
13 changed files with 267 additions and 36 deletions

View File

@@ -10,6 +10,7 @@ import type {
} from "@/types/imgw";
import { translate, type Language } from "@/lib/i18n";
import { getProvinceFromTeryt, normalizeProvinceName } from "@/lib/provinces";
import type { CurrentWeatherCondition } from "@/types/imgw-current";
const locales: Record<Language, string> = { pl: "pl-PL", en: "en-GB" };
@@ -174,7 +175,10 @@ export function getWeatherMoodFromData(station: SynopStation, date = new Date())
return "mild";
}
export function getWeatherDescription(station: SynopStation, language: Language = "pl") {
export function getWeatherDescription(station: SynopStation, language: Language = "pl", condition?: CurrentWeatherCondition) {
if (condition === "thunderstorm") return translate(language, "weather.thunderstorm");
if (condition === "snow") return translate(language, "weather.currentSnow");
if (condition === "rain") return translate(language, "weather.currentRain");
if ((station.windSpeed ?? 0) >= 8) return translate(language, "weather.strongWind");
if ((station.humidity ?? 0) >= 90) return translate(language, "weather.humid");
return translate(language, "weather.calm");