feat(web): show pending items on the installed app icon
Keep the Badging API count equal to the primary list's pending items, update it from optimistic changes and the list's SSE stream (shared across pages), and re-sync when the app returns to the foreground. On iOS the badge needs notification permission, so Settings offers to enable it; Android does not support numeric web app badges.
This commit is contained in:
@@ -281,6 +281,14 @@ apps/web/src/
|
||||
hook (`use-list-events.ts`) reuses it, so the browser calls `/api/*` on the current origin: Vite proxies it
|
||||
to `:4100` in dev and nginx does in production. `VITE_API_URL` is an optional override for a separate API
|
||||
origin, and `auth-client.ts` defaults `baseURL` to `window.location.origin` (BetterAuth appends `/api/auth`).
|
||||
- **Icon badge**: the installed PWA shows the pending items of the primary list on its icon through the Badging
|
||||
API (`lib/app-badge.ts`). `hooks/use-app-badge.ts`, mounted by the authenticated layout, follows that list's
|
||||
SSE stream even from other pages (the shared `lib/list-events-stream.ts` avoids opening a second stream) and
|
||||
re-syncs on foreground. It only runs in standalone mode; iOS additionally needs notification permission,
|
||||
requested from the settings card (`components/settings/app-badge-card.tsx`) because WebKit only grants
|
||||
badging alongside notifications. Chrome on Android does not support numeric badges (notifications show a
|
||||
dot), so this is a progressive enhancement. Updating the badge while the app is closed would need Web Push,
|
||||
which is not implemented.
|
||||
- **Forms: React Hook Form + Zod** (`zodResolver`). Render errors with the shadcn `Field`/`FieldError`
|
||||
components — this registry version ships `field` instead of the older `form` component.
|
||||
- **shadcn/ui**: components live in `src/components/ui` and are source, not generated output — edit them
|
||||
|
||||
Reference in New Issue
Block a user