feat: extend offline queueing to all quick-capture forms

Only Durchsicht had an offline fallback (queue to IndexedDB, sync on
reconnect); Behandlung, Fütterung, Varroamessung, Schwarmkontrolle and
Ernte just failed outright with no signal - exactly the situation a
beekeeper is in at the actual hive. Generalizes lib/offline/db.ts and
sync.ts to six queues (version-bumped IndexedDB schema, existing queued
inspections preserved), wires the same "server rejected it vs. no
network" fallback into all five remaining */new pages, and updates the
sync badge to count/drain all six.

Also: doc-hygiene pass (ARCHITECTURE.md/TASKS.md) to replace the stale
pg_dump/CronJob backup plan with the in-app BackupModule that actually
shipped earlier this session.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
Nick SzaunigandClaude Sonnet 5 committed 2026-09-05 17:45:32 +02:00
1 parent ac45514356
commit 1f67cd5548
11 files changed
+297 -46

No files matched your search

@@ -5,17 +5,17 @@ import { CloudOff, RefreshCw } from "lucide-react";
import { toast } from "sonner";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { Badge } from "@/components/ui/badge";
import { countPendingInspections } from "@/lib/offline/db";
import { countAllPending } from "@/lib/offline/db";
import { syncPendingInspections } from "@/lib/offline/sync";
const PENDING_QUERY_KEY = ["offline-pending-inspections"];
const PENDING_QUERY_KEY = ["offline-pending-entries"];
export function OfflineSyncBadge() {
const queryClient = useQueryClient();
const { data: pending = 0 } = useQuery({
queryKey: PENDING_QUERY_KEY,
queryFn: countPendingInspections,
queryFn: countAllPending,
refetchInterval: 15000,
});
@@ -24,7 +24,7 @@ export function OfflineSyncBadge() {
onSuccess: (result) => {
void queryClient.invalidateQueries({ queryKey: PENDING_QUERY_KEY });
if (result.synced > 0) {
toast.success(`${result.synced} Durchsicht(en) synchronisiert`);
toast.success(`${result.synced} Eintrag/Einträge synchronisiert`);
}
},
});
@@ -51,7 +51,7 @@ export function OfflineSyncBadge() {
role="button"
tabIndex={0}
className="cursor-pointer"
title="Ausstehende Durchsichten synchronisieren"
title="Ausstehende Einträge synchronisieren"
onClick={() => syncMutation.mutate()}
onKeyDown={(event) => {
if (event.key === "Enter" || event.key === " ") {