nomadro/apps/com/admin/src/lib/SocialPresenceContext.tsx
Eric 499f2d3e26 Ship coffeechat scheduling, notify PB access, and social/admin UI polish for .com.
Document the 2026-11-05 UI/UX upgrade and keep roster/live gates aligned with face-check and presence.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-05 18:19:37 +08:00

32 lines
764 B
TypeScript

/**
* One presence poll for the whole admin shell — top pulse + join/roster rows share state.
*/
import { createContext, useContext, type ReactNode } from 'react'
import {
useSocialPresenceLive,
type PresenceSnap,
type PresencePeer,
} from './useSocialPresenceLive'
export type { PresencePeer, PresenceSnap }
const EMPTY: PresenceSnap = {
online: 0,
peers: [],
cityOnline: 0,
ok: false,
fromOffline: true,
bumped: null,
}
const Ctx = createContext<PresenceSnap>(EMPTY)
export function SocialPresenceProvider({ children }: { children: ReactNode }) {
const snap = useSocialPresenceLive()
return <Ctx.Provider value={snap}>{children}</Ctx.Provider>
}
export function useSharedSocialPresence(): PresenceSnap {
return useContext(Ctx)
}