L7 Offline & PWA: Sync-Seite, Offline-Ansicht, Sync-Badge, Installationshinweis, Logout-Schutz

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-14 17:20:44 +02:00
co-authored by Claude Opus 5
parent 4dd330b9fd
commit f0620f9c3b
15 changed files with 1633 additions and 13 deletions
@@ -0,0 +1,16 @@
import { auth } from "@/server/auth";
import { parseMaxDays } from "@/lib/offline/bundle-core";
import { OfflineRuntimeClient } from "./offline-runtime-client";
/**
* Offline runtime of the mobile shell (lane L7) — mounted once in `(field)/m/layout.tsx`.
* Passes the signed-in tenant/user (local data is separated per context) and OFFLINE_MAX_DAYS
* to the client: service worker registration + update notice, outbox sync loop, sync badge.
*/
export async function OfflineRuntime() {
const session = await auth();
const tenantId = session?.user?.tenantId;
const userId = session?.user?.id;
if (!tenantId || !userId) return null;
return <OfflineRuntimeClient tenantId={tenantId} userId={userId} maxDays={parseMaxDays(process.env.OFFLINE_MAX_DAYS)} />;
}