Step 13 - facilitation

2 min czytania

Add the facilitation layer. Every feature is a small object on the board document carrying an `at` timestamp; clients react when `at` changes. On join, PRIME all last-seen timestamps from the current board doc so a newcomer never replays an old focus/confetti/timer event.

Teacher controls (a facilitation menu, visible to teachers only):

  1. Focus/spotlight: teacher clicks "bring everyone here" - writes focus {x, y, scale, at, byName}. Every client animates its viewport there (ease over ~600 ms; honor prefers-reduced-motion by jumping instantly).
  2. Shared timer: presets 1/3/5/10 min - timer {durationSec, endsAt, running, at}. Render a countdown chip on all clients from a 250 ms local clock signal that runs ONLY while the timer is running; urgent styling under 30 s.
  3. Dot voting: voting {active, dotsPerPerson (1/3/5), hideTallies, at}. While active, clicking any element casts a dot (shift-click removes) by writing Firestore increment() on votes/{myUid}.counts[elementId] - increments mean voters never clobber each other. Draw dot-count badges on elements (hidden from non-teachers when hideTallies). "End voting" keeps tallies; "clear votes" batch-deletes the votes subcollection. Enforce the per-person budget client-side from my own vote doc.
  4. Celebrate: one-shot confetti burst on all clients (canvas particles, ~2 s, skipped under prefers-reduced-motion).
  5. Raise hand (everyone): toggles handRaised in presence, shown on the participant chip; teacher's "lower all hands" writes lowerHandsAt and each client clears its own flag.
  6. Emoji reactions (everyone): a small picker ['thumbs up','heart','party','laugh','wow','clap'] publishing reaction {emoji, at} via presence; render as a float-up animation near that user's cursor.
  7. Follow me: clicking a participant chip mirrors their viewport (viewCx/viewCy/viewScale from presence) until any local pan/zoom stops following.
  8. Private mode: privateMode {active, startedAt, at}. While active, each client renders ONLY elements authored by themselves plus elements created before startedAt - implement as a visibleEls computed signal filtering the store, and route EVERYTHING (render, hit-testing, marquee, exports) through visibleEls instead of the raw list. Also suppress remote drafts while active. Show an "N hidden" badge. Ending private mode reveals everything - the classic silent-brainstorm-then-reveal workshop pattern.

Acceptance: with three windows open (teacher + user + guest), each feature behaves; joining mid-session triggers no stale focus jump or confetti; private mode hides peers' new notes until revealed.

Dyskusja

Komentarze: 0

Brak komentarzy. Rozpocznij dyskusję.