chore: add prettier formatting
All checks were successful
CI / Lint, typecheck and build (push) Successful in 9m56s

This commit is contained in:
zv
2026-06-14 20:26:56 +02:00
parent 8bbd9397a1
commit ee55521803
79 changed files with 2451 additions and 969 deletions

View File

@@ -26,10 +26,21 @@ interface RawOpenMeteoCurrentResponse {
};
}
function getOpenMeteoCondition(weatherCode: number | null, rain: number | null, showers: number | null, snowfall: number | null): CurrentWeatherCondition {
function getOpenMeteoCondition(
weatherCode: number | null,
rain: number | null,
showers: number | null,
snowfall: number | null,
): CurrentWeatherCondition {
if (weatherCode !== null && weatherCode >= 95) return "thunderstorm";
if ((snowfall ?? 0) > 0 || (weatherCode !== null && weatherCode >= 71 && weatherCode <= 77)) return "snow";
if ((rain ?? 0) > 0 || (showers ?? 0) > 0 || (weatherCode !== null && weatherCode >= 51 && weatherCode <= 67) || (weatherCode !== null && weatherCode >= 80 && weatherCode <= 82)) return "rain";
if (
(rain ?? 0) > 0 ||
(showers ?? 0) > 0 ||
(weatherCode !== null && weatherCode >= 51 && weatherCode <= 67) ||
(weatherCode !== null && weatherCode >= 80 && weatherCode <= 82)
)
return "rain";
return null;
}
@@ -76,7 +87,7 @@ export async function fetchImgwHybridCurrentWeather(latitude: number, longitude:
});
const response = await fetch(`${IMGW_HYBRID_URL}?${params}`, { next: { revalidate: 120 } });
if (!response.ok) throw new Error("IMGW Hybrid service is unavailable.");
return await response.json() as RawImgwHybridWeatherResponse;
return (await response.json()) as RawImgwHybridWeatherResponse;
}
export async function fetchServerCurrentWeather(latitude: number, longitude: number, region: WeatherRegion) {
@@ -109,5 +120,5 @@ export async function fetchServerCurrentWeather(latitude: number, longitude: num
});
const response = await fetch(`${OPEN_METEO_FORECAST_URL}?${params}`, { next: { revalidate: 120 } });
if (!response.ok) throw new Error("Open-Meteo current conditions are unavailable.");
return normalizeOpenMeteoCurrent(await response.json() as RawOpenMeteoCurrentResponse);
return normalizeOpenMeteoCurrent((await response.json()) as RawOpenMeteoCurrentResponse);
}