feat(fase-14): offline chip + queued-op badge in global chrome (14.2.1-2)

Adds an OfflineChip surfaced in the MobileTopBar (compact, icon-only)
and at the bottom of the DesktopSidebar (full pill with label). Hidden
while online. When `navigator.onLine` is false:

  - The chip mounts with the existing amber palette
  - A title tooltip explains the implication ("changes will sync when
    you reconnect")
  - If `pendingOpsCount > 0`, a small numeric badge is appended so the
    user sees the actual backlog size at a glance

`pendingOpsCount` is the existing store (kept in sync by SyncQueue);
nothing new wires up — we only surface what was already tracked.

OF-01 e2e: drives `context.setOffline(true)`, asserts the chip
appears, queues an INSERT, asserts the numeric badge renders, and
verifies the chip disappears when back online. Added alongside the
existing O-01/O-02 (banner-based) so we keep coverage of both surfaces.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-18 07:02:00 +02:00
parent a6e6915b0b
commit c8c7f9f8c9
4 changed files with 79 additions and 0 deletions

View File

@@ -7,6 +7,7 @@
import type { SectionKey } from '@colectivo/types';
import Avatar from '$lib/components/Avatar.svelte';
import CreateCollectiveModal from '$lib/components/CreateCollectiveModal.svelte';
import OfflineChip from '$lib/components/OfflineChip.svelte';
import * as m from '$lib/paraglide/messages';
import { ShoppingCart, CheckSquare, FileText, Search, Settings, Plus, Shield } from 'lucide-svelte';
@@ -101,6 +102,9 @@
</nav>
<div class="p-3 pt-2">
<div class="mb-2 flex justify-end">
<OfflineChip />
</div>
{#if $isServerAdmin}
<!-- Fase 13.4: server-admin entry. Distinct red icon so it doesn't
blend with normal app nav. Hidden for non-admins. -->