Skip to content

feat: votação com pergunta e múltipla escolha - #1

Closed
cassio2703 wants to merge 1 commit into
codeinloop:mainfrom
cassio2703:feat/votacao-multipla
Closed

cassio2703 wants to merge 1 commit into
codeinloop:mainfrom
cassio2703:feat/votacao-multipla

Conversation

@cassio2703

Copy link
Copy Markdown

Requested by Cássio · project thread

What changed

A slide can now define its own poll: poll: { question, options } (2 to 6 options). When the presenter opens the poll (P or the remote) on that slide:

  • Audience page: shows the question and one button per option (vote can be changed, one vote per phone as before). Text goes in with textContent.
  • Stage: a panel with the question and one bar + count per option, same bottom-centre spot and max width as the 👍/👎 bar so it stays clear of the QR.
  • Remote: a compact per-option score.
  • Metrics: each poll records question, options and counts; the report shows the question and the result (winner in bold). Old metrics.json with up/down still renders.

Slides without poll keep the current 👍/👎 behaviour unchanged.

Protocol: Poll is now { id, open, question, options, counts }; vote.choice is the option index ("up"/"down" are still accepted as 0/1, for an audience page opened before an update); the deck's slide message carries the optional poll. The server validates the spec (trims, drops empty, caps at 6 options / 80 chars per option / 200 chars per question) and falls back to 👍/👎 when it is invalid.

Docs updated: AGENTS.md, deck/README.md, backstage/README.md. The starter talk's "A plateia participa" slide now has a sample question.

How it was tested

  • npm run typecheck and npm run build in deck/
  • npm run typecheck and npm test in backstage/ (16/16; new test covers custom options, out-of-range/non-integer votes, vote change, legacy "down", invalid spec falling back to 👍/👎, and the metrics report)
  • Visual change: images from npm run png attached (checked by hand with Playwright instead: stage, audience page and remote with three simulated phones, plus the 👍/👎 path on another slide)
  • New live message: type in protocol.ts, server-side validation and a test
  • New interface text: added in Portuguese and English

🤖 Generated with Claude Code

https://claude.ai/code/session_01RTybDNU1NDt27r8RzXc996

Um slide pode definir `poll: { question, options }` (2 a 6 opções). Com ela,
P abre a votação com a pergunta escrita: a plateia vê a lista de opções, o
telão e o passador mostram uma barra por opção, e as métricas guardam a
pergunta e os votos de cada opção. Sem `poll`, continua o 👍/👎 de sempre.

O voto passa a ser o índice da opção; "up"/"down" ainda são aceitos como 0/1.
Métricas antigas (up/down) continuam aparecendo no relatório.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RTybDNU1NDt27r8RzXc996
@cassio2703 cassio2703 closed this Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant