import {useEffect, useState} from 'react' import {shortId} from '../util' type Props = { roomId: string selfId: string selfName: string onChangeName: (name: string) => void peerCount: number relayCount: number } export function Header({ roomId, selfId, selfName, onChangeName, peerCount, relayCount }: Props) { const [draft, setDraft] = useState(selfName) // keep the input in sync if the committed name changes elsewhere useEffect(() => setDraft(selfName), [selfName]) const commit = () => { if (draft !== selfName) onChangeName(draft) } return (

🤝 Trystero P2P Messaging

Serverless WebRTC over Nostr — no backend, no accounts. Open this page in another tab or on another device to see peers appear.

id {shortId(selfId)} room {roomId} {peerCount} peer{peerCount === 1 ? '' : 's'} connected 0 ? 'dot ok' : 'dot'}> {relayCount} nostr relay{relayCount === 1 ? '' : 's'}
) }