Add multiplayer awareness: participant list, name editing, cursor styling, join/leave toasts
Implement the planner-multiplayer-awareness OpenSpec change: - Add setUserName to use-yjs.ts that persists to localStorage and syncs via awareness - Create ParticipantList component showing all session participants with color dots, host badge, and inline name editing for the local user - Replace plain text cursor labels with SVG pointer arrows and styled name tags (colored background, drop shadow, rounded corners, z-index below map controls) - Track awareness add/remove events and display auto-dismissing toasts (3s) when participants join or leave the session - Add i18n keys for participant UI in English and German Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
068b474f94
commit
9b4f4c6759
7 changed files with 292 additions and 24 deletions
|
|
@ -102,9 +102,22 @@ function CursorTracker({ awareness }: { awareness: YjsState["awareness"] }) {
|
|||
<Marker
|
||||
key={clientId}
|
||||
position={[cursor.lat, cursor.lng]}
|
||||
zIndexOffset={-1000}
|
||||
icon={L.divIcon({
|
||||
className: "",
|
||||
html: `<div style="background:${cursor.color};color:white;padding:2px 6px;border-radius:4px;font-size:11px;white-space:nowrap;transform:translate(10px,-50%)">${cursor.name}</div>`,
|
||||
html: `<div style="position:relative;z-index:400;pointer-events:none">
|
||||
<svg width="16" height="20" viewBox="0 0 16 20" style="filter:drop-shadow(0 1px 2px rgba(0,0,0,0.3))">
|
||||
<path d="M0 0L16 12L8 12L4 20Z" fill="${cursor.color}" />
|
||||
</svg>
|
||||
<span style="
|
||||
position:absolute;left:16px;top:2px;
|
||||
background:${cursor.color};color:white;
|
||||
padding:1px 6px;border-radius:6px;
|
||||
font-size:11px;font-weight:500;white-space:nowrap;
|
||||
box-shadow:0 1px 3px rgba(0,0,0,0.2);
|
||||
line-height:1.4;
|
||||
">${cursor.name}</span>
|
||||
</div>`,
|
||||
iconSize: [0, 0],
|
||||
})}
|
||||
/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue