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

@@ -49,13 +49,20 @@ function formatWarningValidity(warning: WeatherWarning, language: Language) {
}
function buildWarningPayload(preference: WarningPushSubscription, warning: WeatherWarning) {
const region = preference.province ? formatProvinceName(preference.province, preference.language) : preference.locationName ?? "wtr.";
const region = preference.province
? formatProvinceName(preference.province, preference.language)
: (preference.locationName ?? "wtr.");
const title = warning.title || (preference.language === "pl" ? "Ostrzeżenie meteorologiczne" : "Weather warning");
const validity = formatWarningValidity(warning, preference.language);
const level = getWarningLevelLabel(warning, preference.language);
const bodyParts = preference.language === "pl"
? [`${region}: ${level}`, validity, warning.probability !== null ? `prawdopodobieństwo ${warning.probability}%` : null]
: [`${region}: ${level}`, validity, warning.probability !== null ? `${warning.probability}% probability` : null];
const bodyParts =
preference.language === "pl"
? [
`${region}: ${level}`,
validity,
warning.probability !== null ? `prawdopodobieństwo ${warning.probability}%` : null,
]
: [`${region}: ${level}`, validity, warning.probability !== null ? `${warning.probability}% probability` : null];
return {
title: `IMGW: ${title}`,
@@ -73,12 +80,15 @@ export async function sendWarningNotification(preference: WarningPushSubscriptio
export async function sendTestNotification(preference: WarningPushSubscription) {
ensureWebPushConfigured();
const location = preference.province ? formatProvinceName(preference.province, preference.language) : preference.locationName ?? "Open-Meteo";
const location = preference.province
? formatProvinceName(preference.province, preference.language)
: (preference.locationName ?? "Open-Meteo");
const payload = JSON.stringify({
title: preference.language === "pl" ? "wtr.: test powiadomień" : "wtr.: notification test",
body: preference.language === "pl"
? `Powiadomienia są aktywne dla: ${location}.`
: `Notifications are active for: ${location}.`,
body:
preference.language === "pl"
? `Powiadomienia są aktywne dla: ${location}.`
: `Notifications are active for: ${location}.`,
url: "/settings",
});
await webPush.sendNotification(preference.subscription as PushSubscription, payload);