- Honey batch create omits an empty batch number (was 400); product form
labels the legacy total weight, detail shows jar weight and shelf life;
bottling hints next to their fields, values cleared on product change,
post-save water-content wording; withdraw reason placeholder not
selectable; honey batch actions offline-disabled with reason, 44 px.
- Offline signal: one slow request no longer flips the app offline; two
consecutive timeouts do, any HTTP answer clears it, aborts never count.
- Phenology sheet as a side card on desktop with focus return; confirm
dialogs as alertdialog; step-up texts in du-form ("Das Passwort stimmt
nicht."); backup import gives its disabled reason; missing event labels
plus a guard test; profile buttons 44 px.
- GET /phenology/state returns intervalDays via the shared
inspectionIntervalOf (autopilot, digest, season state use one source).
- T6 plan aligned with the code after T4, plus owner decisions of
2026-10-15 (Berlin day for restrictions, COMPLIANCE category, override
without step-up).
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
89 lines
3.1 KiB
TypeScript
89 lines
3.1 KiB
TypeScript
import type { WebhookDeliveryStatus } from "@/lib/webhooks/types";
|
|
import type { JobName, JobRunStatus } from "./types";
|
|
|
|
/** Same wording as JOB_LABELS_DE in the backend. */
|
|
export const JOB_LABELS: Record<JobName, string> = {
|
|
"daily-evaluation": "Tägliche Auswertung",
|
|
"task-templates": "Aufgaben aus Vorlagen",
|
|
cleanup: "Aufräumen",
|
|
"app-backup": "App-Backup",
|
|
rekey: "Schlüssel umstellen",
|
|
};
|
|
|
|
export const JOB_RUN_STATUS_LABELS: Record<JobRunStatus, string> = {
|
|
RUNNING: "Läuft",
|
|
SUCCEEDED: "Erfolgreich",
|
|
FAILED: "Fehlgeschlagen",
|
|
} as const;
|
|
|
|
export const WEBHOOK_DELIVERY_STATUS_LABELS: Record<WebhookDeliveryStatus, string> = {
|
|
PENDING: "Offen",
|
|
PROCESSING: "Wird zugestellt",
|
|
DELIVERED: "Zugestellt",
|
|
FAILED: "Fehlgeschlagen",
|
|
};
|
|
|
|
export const DOMAIN_EVENT_LABELS: Record<string, string> = {
|
|
InspectionRecorded: "Durchsicht erfasst",
|
|
InspectionCorrected: "Durchsicht korrigiert",
|
|
VarroaMeasured: "Varroamessung erfasst",
|
|
VarroaCorrected: "Varroamessung korrigiert",
|
|
TreatmentRecorded: "Behandlung erfasst",
|
|
TreatmentCorrected: "Behandlung korrigiert",
|
|
FeedingRecorded: "Fütterung erfasst",
|
|
FeedingCorrected: "Fütterung korrigiert",
|
|
HarvestRecorded: "Ernte erfasst",
|
|
HarvestCorrected: "Ernte korrigiert",
|
|
ColonyStatusChanged: "Volksstatus geändert",
|
|
ColonyEnded: "Volk beendet",
|
|
BatchBottled: "Charge abgefüllt",
|
|
BottlingCorrected: "Abfüllung korrigiert",
|
|
StockChanged: "Bestand geändert",
|
|
TaskCreated: "Aufgabe angelegt",
|
|
TaskUpdated: "Aufgabe geändert",
|
|
TaskCompleted: "Aufgabe erledigt",
|
|
WithdrawalEnded: "Wartezeit beendet",
|
|
TaskDue: "Aufgabe fällig",
|
|
QueenAged: "Königin gealtert",
|
|
VarroaMeasurementDue: "Varroamessung fällig",
|
|
InspectionOverdue: "Durchsicht überfällig",
|
|
ColonySplit: "Ableger angelegt",
|
|
QueenAssigned: "Königin zugewiesen",
|
|
ExtractionRecorded: "Schleuderung erfasst",
|
|
ExtractionCorrected: "Schleuderung korrigiert",
|
|
HoneyBatchRecorded: "Honigcharge angelegt",
|
|
HoneyBatchCorrected: "Honigcharge korrigiert",
|
|
PhenologyReported: "Pflanzenmeldung erfasst",
|
|
PhenologyCorrected: "Pflanzenmeldung korrigiert",
|
|
PhenologyRecomputeRequested: "Saison neu berechnen angefordert",
|
|
WinterCheckRecorded: "Winterkontrolle erfasst",
|
|
SeasonPhaseChanged: "Saisonabschnitt gewechselt",
|
|
};
|
|
|
|
/** The oldest open event is this old (seconds) before the worker counts as stuck. */
|
|
export const QUEUE_STALE_WARNING_SECONDS = 600;
|
|
|
|
const SECONDS_PER_MINUTE = 60;
|
|
const SECONDS_PER_HOUR = 3600;
|
|
const SECONDS_PER_DAY = 86400;
|
|
|
|
/** "vor 3 Min." / "vor 2 Std." / "vor 2 Tagen". */
|
|
export function formatAge(seconds: number): string {
|
|
if (seconds < SECONDS_PER_MINUTE) {
|
|
return "vor wenigen Sekunden";
|
|
}
|
|
if (seconds < SECONDS_PER_HOUR) {
|
|
return `vor ${Math.floor(seconds / SECONDS_PER_MINUTE)} Min.`;
|
|
}
|
|
if (seconds < SECONDS_PER_DAY) {
|
|
return `vor ${Math.floor(seconds / SECONDS_PER_HOUR)} Std.`;
|
|
}
|
|
const days = Math.floor(seconds / SECONDS_PER_DAY);
|
|
return days === 1 ? "vor 1 Tag" : `vor ${days} Tagen`;
|
|
}
|
|
|
|
/** "1 Versuch" / "8 Versuche". */
|
|
export function attemptsLabel(attempts: number): string {
|
|
return attempts === 1 ? "1 Versuch" : `${attempts} Versuche`;
|
|
}
|