MCPcopy Create free account
hub / github.com/vercel/examples / PresenceStack

Function PresenceStack

websockets/next-chat/components/PresenceStack.tsx:6–20  ·  view source on GitHub ↗
({ presence }: { presence: Presence | null })

Source from the content-addressed store, hash-verified

4const MAX_AVATARS = 4 // header avatars shown before "+N"
5
6export function PresenceStack({ presence }: { presence: Presence | null }) {
7 const users = presence?.users ?? []
8 const total = presence?.count ?? users.length
9 const shown = users.slice(0, MAX_AVATARS)
10 const extra = total - shown.length
11
12 return (
13 <div className="avatar-stack" aria-hidden="true">
14 {shown.map((u) => (
15 <Avatar key={u.clientId} name={u.username} id={u.clientId} />
16 ))}
17 {extra > 0 && <span className="more">+{extra}</span>}
18 </div>
19 )
20}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected