From 68ecd881d9da462010d6a8de02eed7753fb80ff3 Mon Sep 17 00:00:00 2001 From: Ilia Denisov Date: Mon, 6 Jul 2026 09:44:05 +0200 Subject: [PATCH] feat(offline): offline-mode state, Settings toggle + blue chrome (Phase C) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The deliberate offline mode is now visible: an installed web-PWA user with a confirmed email can switch to offline in Settings, and the header turns blue with an "Offline" chip. (Network gating, the dict preload, the offline lobby + local-game creation, and the service-worker precache follow in later Phase C steps.) - offline.ts / offline.svelte.ts: a sticky, device-scoped reactive offline flag (offlineMode), distinct from connection.svelte's transient reachability signal, with the pure persistence + readiness helpers (offlineReady / missingDicts) unit-tested. - Settings.svelte: an Online / Offline toggle, shown only for an installed web PWA with a confirmed email (the SW-launch + durable-account preconditions). - Header.svelte: a blue-tinted nav (color-mix from the accent, so it tracks light/dark and a Telegram theme override) + an "Offline" chip while offline; the deliberate mode suppresses the transient "Connecting…" indicator. Behaviour-preserving online (the toggle is hidden and offlineMode is false there; e2e 196 green). App entry stays within its size budget (111.6 / 112 KB gzip). --- ui/src/components/Header.svelte | 36 ++++++++++++++++++++++++--- ui/src/lib/i18n/en.ts | 3 +++ ui/src/lib/i18n/ru.ts | 3 +++ ui/src/lib/offline.svelte.ts | 23 ++++++++++++++++++ ui/src/lib/offline.test.ts | 38 +++++++++++++++++++++++++++++ ui/src/lib/offline.ts | 43 +++++++++++++++++++++++++++++++++ ui/src/screens/Settings.svelte | 24 ++++++++++++++++++ 7 files changed, 166 insertions(+), 4 deletions(-) create mode 100644 ui/src/lib/offline.svelte.ts create mode 100644 ui/src/lib/offline.test.ts create mode 100644 ui/src/lib/offline.ts diff --git a/ui/src/components/Header.svelte b/ui/src/components/Header.svelte index 222051d..6e14256 100644 --- a/ui/src/components/Header.svelte +++ b/ui/src/components/Header.svelte @@ -1,6 +1,7 @@ -