wacrm/src/hooks
Arnas Donauskas 054c9e4e47
feat(team): member presence (online / away / offline) on the roster
Adds a live presence layer so the Settings → Team members roster and the
inbox Assign dropdown show who is actively using the dashboard, idle, or
gone. Implements #269.

How it works
- New `member_presence` table + `touch_presence` SECURITY DEFINER RPC
  (migration 024). Account-scoped SELECT RLS mirrors the read-only
  roster; the RPC derives account_id server-side, never client-supplied.
- The active client heartbeats 'online'/'away' every ~30s; 'offline' is
  derived by viewers from staleness, so a closed tab resolves to offline
  without an unreliable unload write.
- Pure, unit-tested derivation/formatting in src/lib/presence.ts.
- `usePresence` reads the table, subscribes to Realtime (subscribe-then-
  merge so events landing mid-fetch aren't clobbered), and re-derives
  offline on a 15s tick.
- Roster: avatar badge + tooltip + "N online · N away · N offline"
  summary, with an aria-label so AT/keyboard users get presence too.
  Inbox Assign dropdown: matching dot before each teammate.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 14:37:29 +03:00
..
use-auth.tsx feat(deals): make default deal currency configurable per account (#218) 2026-06-08 13:59:48 +03:00
use-broadcast-sending.ts fix(account-sharing): stamp account_id on account-scoped inserts (#205) 2026-06-05 10:20:54 +03:00
use-can.ts feat(ui): front-end correctness pass from multi-user review (S1,S2,S6-S8,P8,P9) 2026-05-31 19:33:28 +03:00
use-presence.ts feat(team): member presence (online / away / offline) on the roster 2026-06-22 14:37:29 +03:00
use-realtime.ts ci: clear lint error backlog, drop continue-on-error on lint step 2026-04-20 22:28:35 +03:00
use-theme.tsx feat(theme): add light/dark mode toggle (#243) 2026-06-16 17:29:46 +03:00
use-total-unread.ts fix(inbox): reliable unread reset + sidebar green-dot indicator 2026-04-17 21:17:28 +03:00