Commit graph

16 commits

Author SHA1 Message Date
danny
e4239ce0f2 changed branding in README.md 2026-06-14 14:43:52 +02:00
danny
7b638d4afb README: update project structure and self-hosting steps for setup.php 2026-06-14 14:43:30 +02:00
danny
09d601e303 Recreate setup.php with auto-delete after successful admin creation 2026-06-14 14:41:36 +02:00
danny
e1968d3e04 first stable 2026-06-14 14:39:09 +02:00
danny
967e1c6e0d Add .gitignore, untrack config.php, add config.example.php 2026-06-14 14:37:56 +02:00
danny
1ae870a011 README: translate to English, remove live URL and credentials 2026-06-14 14:36:58 +02:00
danny
933583e5bb Add README.md 2026-06-14 14:19:37 +02:00
danny
5a5136dd05 first stable 2026-06-14 14:14:53 +02:00
danny
841109d995 Add live voting pie chart (Chart.js doughnut) for player and host views
- Loads Chart.js 4.4.4 from jsDelivr CDN
- Canvas elements in #pVoteCard (player) and #hVoteCard (host sidebar)
- computeTally() counts only locked votes — no ghost nobody entries
- updateVotingChart() creates on first call with 600ms entry animation,
  then patches data in-place (update 'none') on each poll tick
- destroyChart() tears down the Chart.js instance and hides the canvas
- Player chart appears once the player has locked their vote (or after
  resolution); host chart appears whenever the vote tally sidebar is shown
- Both charts destroyed and hidden on newRound()
- Theme-matched colors (navy, accent, green, red, gold) on dark bg

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 14:09:32 +02:00
danny
f8f6f5afeb Gameplay fixes: answer lock, imposter guard, field clear, dynamic winner names
1. Answer lock: player answer area is hidden with a waiting message
   until the host has assigned a question for the round.

2. Imposter guard: renderImposterList now accepts a `locked` flag
   (set when normalQuestion is active) — all votebtn, random, and
   clear buttons are disabled so the host cannot change imposters
   mid-round.

3. Clear answer field: newRound() now resets pAnswer.value so the
   previous round's text no longer lingers in the input.

4. Dynamic winner names: outcomeHTML() builds the title from
   survivingLiarKeys — "Imposter Max gewinnt!" for one winner,
   "Die Imposter Max und Lisa gewinnen!" for multiple.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 14:07:24 +02:00
danny
48562cf487 Fix redeclaration of const revealedKeys in renderHost()
The variable was declared twice in the same function scope (line 1058
and 1095), causing a SyntaxError that broke the entire App object.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 13:36:15 +02:00
danny
11b2b4bf4d Fix targeted reveal, live vote tally, and ghost nobody-vote display
1. Targeted reveal (Bug 1): renderPlayer now uses revealedKeys array
   instead of the old sequential revealIndex slice — so only the
   specifically clicked player's answer becomes visible to others.
   renderHost anyRevealed/round-state also switched to revealedKeys.

2. Live vote tally for players (Bug 2): after locking their own vote
   players see a live per-player tally (locked votes only) so they
   can follow the voting while waiting for others to submit.

3. Ghost nobody-vote (Bug 3): host and player tallies now filter to
   p.voteLocked before counting, so unlocked/pre-vote players no
   longer generate a phantom "Niemand" vote in the display.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 13:33:42 +02:00
danny
e3ef770c81 Compact layout, multi-vote, step reveal, imposter weights + resolve bug fix
BUG FIX: resolve_round now reads liar_keys directly from DB via
performResolveRound() helper, bypassing loadRoom()'s redaction
(liarKeys=[] when roundOutcome is null) — fixes 0 points + no_liar bug.

resolve logic extracted into performResolveRound() used by both
manual resolve_round and auto-resolve in lock_vote.

Migration V7:
- gtl_rooms: reveal_index INT DEFAULT -1, imposter_weights VARCHAR(500)
- gtl_players: vote_locked TINYINT, vote_request TINYINT

API:
- lock_vote: stores JSON votes array, locks player, auto-resolves when all locked
- request_voting: democratic vote-start; opens voting when all players request
- reveal_next: increments reveal_index one answer at a time
- reveal/reveal_all: sets reveal_index=9999 (show all)
- update_weights: saves imposter_weights JSON per room
- resolveVotes(): handles votes[] array instead of single voteFor string
- new_round: resets vote_locked, vote_request, reveal_index, active_emojis
- assign_questions: resets vote state + reveal_index on each new question set

Layout:
- wrap max-width 640→960px for grid layout
- Player view: 3-col grid (sidebar scores | gameplay | emoji reactions)
- Host view: 2-col grid (sidebar players+tally+scores | main content)
- Compact sb-row sidebar rows with avatar + name + score

Voting:
- Multi-select checkboxes (client-side) + "Stimme abschicken" lock button
- Niemand exclusive: checking it clears other selections and vice versa
- Once locked: checkboxes hidden, confirmation shown
- Auto-resolve triggers when last player locks vote

Reveal:
- "Nächste aufdecken" reveals one answer at a time via reveal_index
- "Alle aufdecken" reveals everything at once
- Host sees which answers are still hidden vs revealed
- Players only see answers up to current reveal_index

Imposter weights:
- JSON field in host UI e.g. {"3-5":1,"6-9":2,"10+":3}
- randomImposters() reads weights to pick appropriate count
- Saved per-room via update_weights API

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 13:01:41 +02:00
danny
758001597c Auto-fill username + live emoji reactions
- initAuth() now sets joinName.value to logged-in username (no more hardcoded "Danny")
- Migration V6: active_emojis TEXT column on gtl_rooms
- api.php send_emoji action: appends emoji+timestamp to room, prunes entries >4s old, max 20
- loadRoom() returns activeEmojis filtered to last 4 seconds
- render() skips emoji list when diffing state (prevents poll thrash)
- Floating emoji stage: new emojis animate upward from bottom, deduplicated by ID
- Emoji bar (4 buttons: sheep/fire/laugh/thumbs) shown in player waiting card

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 12:35:13 +02:00
danny
01cd98aaf4 Rebrand to Black Sheep Bluff + bug fixes + F5 reconnect
- Rename identity/ folder (was idetity typo), update all references
- Page title: "Black Sheep Bluff – Wer ist das schwarze Schaf?"
- Fix gtl_rooms.updated_at not updated on submit_answer and vote actions
- Implement F5 reconnect: save role/room/pkey to sessionStorage on join,
  restore on page reload via tryRestoreSession()
- Clear sessionStorage on leave()

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 12:31:51 +02:00
danny
44e5b48c3c chore: snapshot before branding & feature pass 2026-06-14 12:25:44 +02:00