Live stats widget - #2579
Merged
Merged
Live stats widget#2579
Conversation
Showcase the queues page on the marketing site with live server, player and game counts. The counts are served by a new `/stats.json` endpoint that reads only from Redis, never the database. A task loop in the bot process recomputes them every minute and writes them to Redis with a TTL well beyond the refresh interval, so a transient failure shows slightly stale numbers rather than an empty widget. Homepage traffic is the highest-volume traffic we have, so it must not translate into database load. Counts are derived from the same service calls that back the queues page, so the numbers on spellbot.io always agree with what a visitor sees after clicking through. `STARTED_GAMES_WINDOW` moves into the service layer so the page, `/queues.json` and the cache share one definition. CORS is added for an explicit allowlist of public, unauthenticated, read-only JSON endpoints, matched as exact paths so an authenticated route can never pick it up by accident. This also makes `/status.json` readable cross-origin; CORS only ever grants access, so nothing that worked before is affected. The widget itself is progressive enhancement: it stays hidden unless the fetch succeeds, leaving the page unchanged when the API is unreachable. Its API base is a Jekyll config value so it can point at a local API during development (`make dev` in docs/). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Reuse the amber -> purple gradient from `.screenshot` as the widget's border so it reads as part of this page rather than a bolted-on component. The purple stop is lifted from the brand #5a3efd to #7c5cff: at 2px on #1a202c the brand value is only 2.75:1, under the 3:1 floor for non-text UI, which is what made the border hard to pick out. The whole card is now one click target, using the stretched-link pattern rather than a click handler on the container. A single anchor's ::after is stretched over the positioned card, which keeps middle-click, right-click -> open in new tab, keyboard focus and screen-reader link semantics working -- none of which survives an onclick on a <div>. Add a live indicator and count up the numbers on load. Both are there to earn the click, but the indicator also states something true: the counts really are refreshed every minute. Every colour was measured against its real backdrop rather than eyeballed; text lands between 5.3:1 and 14.9:1 across both surface states. Keyboard focus draws a ring on the card, and prefers-reduced-motion drops the lift, the arrow, the pulse and the count-up. There is deliberately no prefers-color-scheme branch: this site commits to one dark palette and does not follow the OS setting. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Restore the typography the page was already paying for: a `*` rule forced Verdana over everything with !important, so both Google fonts loaded and were then discarded. Reassign the theme's own --body-font/--header-font instead of overriding per element, so every rule in beautifuljekyll.css follows along. Headings are Outfit, running text Open Sans. Repeat the amber -> purple gradient from `.screenshot` as a rule under each section heading so the site's existing motif becomes the connective tissue between sections rather than a one-off on images. Rebuild the server directory as an auto-fill grid. The track floor is measured rather than guessed: the longest name renders 211px at `.small` and these names are joined with by scripts/update_servers.py, so they cannot wrap and the tile has to be wide enough to hold them. Each tile is a two-row grid so every name starts at the same y and the labels line up across the grid. Turn the Help list into real numbered steps -- these are a sequence the reader works through in order, not decoration -- and make the Discord embed responsive. Add sections for the Playgroup Live and Castlog integrations, with copy taken from what the integrations actually do rather than from their marketing pages. Use "live queues" for the queues site throughout. Every colour was measured against the surface it actually sits on rather than eyeballed, and prefers-reduced-motion drops every transform and animation, including the avatar spin. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2579 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 291 295 +4
Lines 23572 23792 +220
Branches 957 964 +7
==========================================
+ Hits 23572 23792 +220 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.