Skip to content

feat(Rounds): count down 5 seconds on the phones before closing - #12

Merged
xinshoutw merged 4 commits into
mainfrom
feat/close-countdown
Oct 2, 2026
Merged

xinshoutw merged 4 commits into
mainfrom
feat/close-countdown

Conversation

@xinshoutw

Copy link
Copy Markdown
Collaborator

Summary

  • 收卷並計分 on the dashboard or /host now starts a 5-second countdown; a Durable Object alarm closes, grades and scores the round when it ends, even if the admin page is closed meanwhile
  • The round stays open during the countdown, so answers sent meanwhile still count; pressing again does not restart it, and the next round cannot open until it closes
  • Phones show a red 收卷倒數 pill under the top bar, counting down from closeIn (the time left, so the phone's clock does not matter); the answer form stays usable, the history sheet closes, and TIME'S UP plays as before
  • The dashboard shows a red 收卷中 status, and 收卷並計分 stays disabled on both views until the round closes
  • Both READMEs mention the countdown

Test plan

  • npm test, with tests that fire the alarm and cover answering and reopening during the countdown; making 收卷 close at once again fails them
  • Headless Chrome against an isolated wrangler dev, from the dashboard: the countdown starts at 5, the round closes about 5.3 s after the click, and a title sent mid-countdown scored
  • Same run, from /host: the round closes about 5.2 s after the click, the open history sheet closes, and the buttons stay locked; no page errors or alerts
  • Screenshots at 390x844 (phone) and 1280x860 (dashboard and host)

- 收卷 now stores closeAt and sets a Durable Object alarm; the alarm closes, grades and scores the round
- The round stays open meanwhile, so answers sent during the countdown still count; pressing again does not restart it
- Player state carries closeIn, the milliseconds left, so phones count down without trusting their own clocks
- Tests fire the alarm themselves and cover answering and reopening during the countdown
- A red 收卷倒數 pill under the top bar counts down, popping a new number each second, and leaves the answer form usable
- The countdown closes the history sheet, and the close push hides it as TIME'S UP plays
- No alert for an answer rejected once 收卷 has started, so it cannot block the reveal
- The dashboard's status pill turns red with 收卷中 until the round closes
- 收卷並計分 stays disabled on the dashboard and /host while counting down, and the toast reads 開始收卷倒數
- The pages refresh from the close push instead of right after the click
- Note the closing countdown under the animations feature and in step 3 of the game flow, in both languages
@coderabbitai

coderabbitai Bot commented Oct 2, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 8ed808f5-5b4e-481b-9486-b5161f13abdb

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@xinshoutw
xinshoutw merged commit 4618c93 into main Oct 2, 2026
2 checks passed
@xinshoutw
xinshoutw deleted the feat/close-countdown branch October 2, 2026 15:39
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