Files
collective-lists/apps/web/messages/en.json
Oier Bravo Urtasun e7a961a66d feat(fase-2b): Realtime sync + offline queue + Modo Compra
Fase 2b closes the critical-path product differentiator. Two sessions on the
same list see each other's changes in real time, mutations survive network
drops and sync when reconnected, and a dedicated full-screen shopping view
optimises the in-store experience.

2b.1 Realtime
- `$lib/stores/realtimeSync.ts` wraps `postgres_changes` with an `applyItemEvent`
  reducer (INSERT/UPDATE/DELETE → next items[]) and a `subscribeToList` helper
  that awaits the SUBSCRIBED handshake before returning
- `/lists/[id]` subscribes in onMount, unsubscribes in onDestroy. Uses a
  `pendingTempIds` set to deduplicate own-mutation echoes against optimistic
  rows (matches by name+created_by+sort_order)
- Client-generated UUIDs for new inserts make the path idempotent: if the
  server response is lost and we retry, the second POST hits PK-conflict
  which the queue treats as success
- CHECKED section div now carries role="listitem" so Playwright locators
  follow the item across sections

2b.2 Offline queue
- `$lib/sync/queue.ts` — SyncQueue class backed by IndexedDB (idb), FIFO flush,
  MAX_ATTEMPTS=5 retry budget, PK-conflict-as-success short-circuit
- `$lib/sync/index.ts` — app-wide singleton, window.online listener flushes
  automatically, hydrateSyncState() at page load restores pendingOpsCount
- `$lib/stores/syncStatus.ts` — derived store (offline | syncing | synced)
  tracking navigator.onLine + queue depth
- SyncBanner component renders the offline/syncing indicator in the detail
  and session views
- handleAdd enqueues on failure instead of reverting, so an offline mutation
  keeps its optimistic row and syncs on reconnect

2b.3 Modo Compra
- `/lists/[id]/session/+page.svelte` — full-screen overlay (fixed inset-0
  z-50) that covers the sidebar while keeping the normal auth routing.
  56×56 toggles, flip animation shuffling items between TO BUY / CHECKED,
  Finish Shopping confirmation modal → completeList → goto('/lists')
- Link from `/lists/[id]` header (data-testid=start-session) with the
  new `list_start_session` message

Testing infra
- apps/web gets its own Vitest config (jsdom + fake-indexeddb/auto) and a
  new `pnpm test:unit` script. `just test-all` now chains pgTAP → integration
  → unit → e2e so a single command is the gate.
- packages/test-utils/tests/sync-queue.test.ts (placeholder scaffold) removed —
  replaced by `apps/web/src/lib/sync/queue.test.ts` co-located with the module

Totals: 103 tests green
  16 pgTAP
  59 Vitest integration (in packages/test-utils)
   6 Vitest unit (in apps/web — the SyncQueue)
  22 Playwright E2E (5 auth + 4 lists + 6 items + 2 realtime + 2 offline + 3 session)
   2 skipped (realtime-presence — upstream bug, unchanged)

Documented in plan/fase-2b and CLAUDE.md.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 03:32:15 +02:00

116 lines
4.5 KiB
JSON

{
"$schema": "https://inlang.com/schema/inlang-message-format",
"nav_lists": "Lists",
"nav_tasks": "Tasks",
"nav_notes": "Notes",
"nav_search": "Search",
"nav_settings": "Settings",
"nav_collective": "Collective",
"app_name": "Colectivo",
"loading": "Loading…",
"error_generic": "Something went wrong. Please try again.",
"login_title": "Sign in to Colectivo",
"login_button": "Sign in",
"logout_button": "Sign out",
"auth_back_to_home": "Back to home",
"onboarding_title": "Welcome to Colectivo",
"onboarding_subtitle": "Get started by creating a new collective or joining an existing one.",
"onboarding_create_tab": "Create",
"onboarding_join_tab": "Join",
"onboarding_create_collective": "Create a collective",
"onboarding_join_collective": "Join with an invitation link",
"onboarding_collective_name": "Collective name",
"onboarding_collective_name_placeholder": "e.g. Our Home",
"onboarding_collective_emoji": "Icon",
"onboarding_invite_link_label": "Invitation link",
"onboarding_invite_link_placeholder": "Paste the invite link here…",
"onboarding_create_btn": "Create collective",
"onboarding_join_btn": "Join collective",
"collective_name_label": "Collective name",
"collective_name_placeholder": "e.g. Our Home",
"invitation_title": "You're invited",
"invitation_subtitle": "You've been invited to join a collective.",
"invitation_accept_btn": "Accept invitation",
"invitation_success": "You've joined the collective!",
"invitation_invalid_link": "That doesn't look like a valid invitation link.",
"invitation_error_not_found": "This invitation link is not valid.",
"invitation_error_already_used": "This invitation has already been used.",
"invitation_error_expired": "This invitation has expired.",
"invitation_error_already_member": "You are already a member of this collective.",
"invitation_error_unauthenticated": "You must be signed in to accept an invitation.",
"invitation_error_unknown": "Something went wrong. Please try again.",
"manage_title": "Manage collective",
"manage_members": "Members",
"manage_you": "you",
"manage_remove": "Remove member",
"manage_invite_title": "Invite someone",
"manage_invite_role": "Role",
"manage_generate_link": "Generate invite link",
"manage_copy": "Copy",
"manage_copied": "Copied!",
"manage_link_expires": "Link expires in 7 days.",
"role_admin": "Admin",
"role_member": "Member",
"role_guest": "Guest",
"settings_title": "Settings",
"settings_display_name": "Display name",
"settings_saving": "Saving…",
"settings_language": "Language",
"settings_avatar": "Avatar",
"settings_avatar_initials": "Initials",
"settings_avatar_emoji": "Emoji",
"settings_avatar_upload": "Photo",
"settings_avatar_upload_btn": "Upload photo…",
"settings_account": "Account",
"settings_keycloak_link": "Change email or password",
"settings_logout": "Sign out",
"settings_save": "Save changes",
"settings_saved": "Changes saved",
"invite_member": "Invite member",
"invite_email_label": "Email address",
"invite_send": "Send invitation",
"lists_title": "Shopping Lists",
"lists_new_list": "Create",
"lists_no_lists": "No lists yet",
"lists_create_first": "Create your first shopping list",
"lists_trash": "Trash",
"list_status_active": "Active List",
"list_status_completed": "Completed",
"list_status_archived": "Archived",
"list_name_placeholder": "e.g. Weekly shop",
"list_items_empty": "List is empty",
"list_items_empty_hint": "Add your first item below",
"list_reset": "Reset list",
"list_archive": "Archive",
"list_delete": "Move to trash",
"list_actions": "List actions",
"list_item_placeholder": "Add item (e.g. Yogurt 500g)",
"list_qty_label": "Qty",
"list_unit_label": "Unit",
"list_add_item": "Add item…",
"list_to_buy": "To buy",
"list_checked": "Checked",
"list_start_session": "Shop",
"list_finish_shopping": "Finish shopping",
"list_finish_confirm": "Mark this list as completed?",
"list_finish_confirm_yes": "Yes, finish",
"list_finish_confirm_no": "Keep shopping",
"tasks_title": "Tasks",
"notes_title": "Notes",
"search_title": "Search",
"search_placeholder": "Search lists, tasks, notes…",
"trash_restore": "Restore",
"trash_delete_permanent": "Delete permanently",
"trash_empty": "Trash is empty",
"trash_expires_in": "Expires in {days} days",
"confirm_delete": "Delete?",
"cancel": "Cancel",
"save": "Save",
"action_delete": "Delete",
"edit": "Edit",
"add": "Add",
"done": "Done",
"sync_offline": "You're offline — changes will sync when you reconnect",
"sync_syncing": "Syncing…"
}