Skip to content

Elemental Showdown: the locked Stats screen and sharing (#165) - #176

Merged
jacobcheatley merged 1 commit into
feat/164-rate-limitingfrom
feat/165-locked-stats-sharing
Sep 22, 2026
Merged

jacobcheatley merged 1 commit into
feat/164-rate-limitingfrom
feat/165-locked-stats-sharing

Conversation

@jacobcheatley

@jacobcheatley jacobcheatley commented Sep 22, 2026 •

Copy link
Copy Markdown
Owner

Closes #165. Part of #158.

/elemental-showdown/stats and its gate. showdownStats answers a discriminated union: until there are 250 Votes overall (from the cached aggregate) and 20 from this Voter (a fresh query), both inclusive and counting every Vote, it returns only the two counts and the number of Active Elements, so no Effectiveness leaves the server. isStatsUnlocked is the pure predicate over the two counts. Nothing is stored about unlocking: Votes are never deleted, so the Stats never re-lock.

The locked screen: "the stats are locked", a mosaic of blank tiles, two meters that turn green when met, one line on what is missing, "keep voting" and a share button. ShareButton uses Web Share when present and otherwise copies the link; a cancelled share sheet is not an error. It also sits on the exhausted screen beside a Stats button, and the voting screen gains its small link to the Stats.

/elemental-showdown becomes a head-only layout route carrying the fonts and meta for both pages.

Verification

Real-Postgres tests (inclusive at both numbers, the whole locked payload pinned, a deactivated Element's Votes still counted), component tests (meters, the missing line, both share paths), an e2e smoke test for a fresh browser, and a browser pass beside prototype variant D.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AVEtgjCoEbaNHrYfzyCRNH

@jacobcheatley
jacobcheatley added this pull request to stack #182 September 22, 2026 00:37
@jacobcheatley jacobcheatley changed the title Elemental Showdown: the locked Stats screen and sharing Elemental Showdown: the locked Stats screen and sharing (#165) Sep 22, 2026
@jacobcheatley
jacobcheatley marked this pull request as ready for review September 22, 2026 00:38
The Stats have a screen of their own at `/elemental-showdown/stats`, and
until the crowd has cast 250 Votes and the Voter 20 of their own it says
so rather than showing anything. The gate is the server's: a locked
answer carries the two counts and how many tiles the mosaic has, and no
Element, colour or Effectiveness leaves the machine. The crowd's number
comes from the cached aggregate and counts every Vote ever cast, on an
Active Matchup or not, so switching an Element off never walks the meter
backwards; the Voter's own is a fresh query, so the Vote they just cast
is in it. Both numbers are inclusive, and nothing is stored about having
passed them: Votes are never deleted, so the Stats open once and never
re-lock.

The gate itself is a pure predicate over the two counts, beside the two
named constants, so the unlock can be read before and after a Vote as
easily as on a page load. What the server function answers is a
discriminated union, locked or unlocked; the unlocked side is a
placeholder until the Element pages fill it.

The locked screen is the prototype's: the display heading, a blank tile
per Active Element, a meter each for the two numbers that turns green
when it is met, one line on what is still missing, "keep voting" and the
share button.

Sharing is one button used twice, on the locked screen and at the foot
of the exhausted screen: the platform's share sheet where there is one,
the clipboard everywhere else, over the absolute address of the voting
screen. A Voter who closes the sheet has changed their mind, so an
AbortError is not logged as a failure.

`/elemental-showdown` is now a layout with no page of its own, holding
the head that the voting screen and the Stats share, so the Project's
two webfonts are linked once and still by no other page. The voting
screen gains its corner link to the Stats in the top Element's own ink,
and the exhausted screen gains the Stats button its copy always
promised.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AVEtgjCoEbaNHrYfzyCRNH
@jacobcheatley
jacobcheatley force-pushed the feat/165-locked-stats-sharing branch from 761fcc8 to fa45022 Compare September 22, 2026 01:08
@jacobcheatley
jacobcheatley merged commit 5d755e7 into main Sep 22, 2026
14 checks passed
@jacobcheatley
jacobcheatley deleted the feat/165-locked-stats-sharing branch September 22, 2026 06:13
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.

Elemental Showdown: the locked Stats screen and sharing

1 participant