Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
feat(home): take the event countdown strip off the home page
oversteppinga024ff4c2ab9
diff --git a/STRUCTURE.md b/STRUCTURE.mdindex 0d273a137..0f72b8e20 100644--- a/STRUCTURE.md+++ b/STRUCTURE.md@@ -137,7 +137,6 @@ bottom.| `/play` Coin Wars portal (in-world war door, league board, spectator screen) | Client: [src/game/war-portal.js](src/game/war-portal.js) + [src/game/war-portal.css](src/game/war-portal.css) (plaza landmark, canvas league board, queue panel, results echo), wired in [src/game/coincommunities.js](src/game/coincommunities.js); arena page [pages/play/war.html](pages/play/war.html) `→ /play/war` → [src/play/war.js](src/play/war.js) + [src/play/war-world.js](src/play/war-world.js) + [src/play/war.css](src/play/war.css). API: [api/wars.js](api/wars.js) `→ /api/wars` over [api/_lib/wars-store.js](api/_lib/wars-store.js) (ledger + queue + live registry) and [api/_lib/war-ticket.js](api/_lib/war-ticket.js) (signs a pairing). Server: [multiplayer/src/rooms/ClashRoom.js](multiplayer/src/rooms/ClashRoom.js) `clash_arena`, pairing math [multiplayer/src/war-matchmaking.js](multiplayer/src/war-matchmaking.js), ticket verify [multiplayer/src/war-ticket.js](multiplayer/src/war-ticket.js), spectator snapshots [multiplayer/src/war-live.js](multiplayer/src/war-live.js), league math [multiplayer/src/war-standings.js](multiplayer/src/war-standings.js), portal location [multiplayer/src/world-features.js](multiplayer/src/world-features.js) `WAR_PORTAL` | In-repo | F18. Coin Wars ran full community-vs-community battles with an Elo league behind it and no door into it from any world. The portal is that door: a plaza landmark whose board shows this coin's real league standing, its last battles, and any war running right now (read from `/api/wars`, folded through the arena's own standings module, never a second implementation). Press `E` to run the coin's holder gate and queue the community; the matchmaker pairs it with another waiting community, seals both sides into an HMAC war ticket, and hands the player to `/play/war` with a return link carrying the full coin identity, so walking back lands in the same world with the result already echoing on the board. While a war is live the board becomes a spectator screen (score, round clock, kill feed) off a cheap poll, and a win takes the board over for a few seconds. Costs nothing when nobody is near it: no poll fires outside `WAR_PORTAL_BOARD_REACH`. Docs: [docs/coin-wars.md](docs/coin-wars.md). Tests: [tests/war-matchmaking.test.js](tests/war-matchmaking.test.js), [tests/clash-match.test.js](tests/clash-match.test.js) || `/play` event countdown (lobby banner + in-world pill) | Self-attaching module [src/game/event-countdown.js](src/game/event-countdown.js) loaded by [pages/play.html](pages/play.html); config `public/event.json` (single source of the event window; the file is the edit surface for scheduling an event), read through the shared parser + state machine in [src/shared/event-config.js](src/shared/event-config.js). Verified end to end in a real browser by `npm run verify:event` ([scripts/verify-event-countdown.mjs](scripts/verify-event-countdown.mjs)). Campaign orders: the `event-` files in [prompts/finish/](prompts/finish/) | In-repo | While `public/event.json` describes an upcoming or live event, the lobby shows a banner (name, tagline, local-time start, ticking countdown, CTA into the event world) and the in-world view gets a dismissible top-center pill (dismissal persisted per event in localStorage). Three explicit states: upcoming, live (pulsing marker, CTA suppressed when already standing in the event world), and over (everything unmounts, the interval stops). Zero edits to `coincommunities*.js` by design (the ambient-crowd pattern): it waits for the lobby DOM and mounts nothing when the config is missing, malformed, or expired. || The event landing page (`/event`) | [pages/event.html](pages/event.html) `→ /event`, page module [src/event-page.js](src/event-page.js); config `public/event.json` (the SAME file the `/play` countdown reads, never a second copy of the times); live population [api/play/population.js](api/play/population.js) `→ /api/play/population`, backed by the multiplayer server's public `/population` aggregate in [multiplayer/src/index.js](multiplayer/src/index.js) | Live | The one link the community shares before and during an event, written for someone with zero context. Hero countdown ticking off `public/event.json`, a single large CTA into the event world, a plain-language "what to expect" built only from what `/play` actually does, and the run of show rendered in the visitor's own timezone with an "Add to calendar" button that builds a real RFC 5545 `.ics` in the browser (no third-party calendar service, so the guest list never leaves the device). Four designed states: upcoming (days/hours/minutes/seconds), live (LIVE marker plus the real number of people standing in the world), ended (says it happened, relabels the agenda to "What happened", and still routes people into `/play`), and no-config (an honest "no event scheduled" with the same door). The live number is real or absent: when the multiplayer server is unreachable the panel keeps the live state and drops the count instead of inventing one. Doc: [docs/api-reference.md](docs/api-reference.md#play-population-api). |-| Home page event strip (`/`) | Self-attaching module [src/home-event-banner.js](src/home-event-banner.js) loaded by [pages/home.html](pages/home.html); same config `public/event.json` through [src/shared/event-config.js](src/shared/event-config.js) | Live | Puts the live event in front of everyone who lands on three.ws, not just the people who already opened `/play`. A slim announcement bar between the nav and the hero: event name, start time in the visitor's own timezone, a countdown ticking to the second, and one CTA into the $THREE world (suppressed when the visitor is already there). Same three states as the `/play` surfaces and the same auto-unmount at `endsAt`, flipping upcoming to live without a reload. Dismissal shares the `/play` pill's `cc-event-dismissed:<startsAt>` key, so waving the reminder away on the home page also clears it in-world; the `/play` lobby banner stays, because it is lobby content rather than an overlay. Styled from the home page's own tokens (mono kicker, hairline pill CTA) and light-theme aware. Verified with `npm run verify:event`. || `/play` friends, presence & verified profiles (drawer, cross-world DMs, in-world profile cards) | Client: [src/game/friends-panel.js](src/game/friends-panel.js) (shared with `/walk`), mounted in [src/game/coincommunities.js](src/game/coincommunities.js) `_openFriends()`/`_closeFriends()`, HUD button + unread badge in [src/game/coincommunities-ui.js](src/game/coincommunities-ui.js), account-level state/polling in [src/friends.js](src/friends.js), profile card in the shared inspector [src/shared/avatar-inspector.js](src/shared/avatar-inspector.js) (`renderProfile`). Server: signed ticket verify + `socialHub` registration + verified `username` on the Player schema in [multiplayer/src/rooms/WalkRoom.js](multiplayer/src/rooms/WalkRoom.js) + [multiplayer/src/schemas.js](multiplayer/src/schemas.js), ticket signer [api/_lib/presence-store.js](api/_lib/presence-store.js) / verifier [multiplayer/src/presence-token.js](multiplayer/src/presence-token.js), hub in [multiplayer/src/social-hub.js](multiplayer/src/social-hub.js) | In-repo | W09+W10 of the World Online program (program brief retired to git history). Press `J` or the HUD `Friends` button to open a right-docked drawer showing your account's friend graph; live online/offline presence per coin world, requests, and DM threads; the same graph and threads `/walk` and the standalone `/friends` page already share. `community-net.js` carries a signed presence ticket into every `walk_world` join and forwards the server's `social` push onto its own event bus, which is what makes a `/play` player visible to friends and able to receive a live DM. W10 makes the platform identity first-class in-world: the ticket also carries the account's username + display name (signed, so nobody can wear a handle they don't own), WalkRoom publishes the verified `username` on the Player schema, nameplates show the @handle, the signed-in lobby defaults to the account's display name with an @handle chip, and clicking any verified player (or `I`) opens their real three.ws profile card in the shared avatar inspector: bio, follower counts, follow/unfollow (`/api/users/:username/follow`), the right friends verb (Message → the in-world DM drawer when already friends, Add friend / Accept otherwise), their latest creations, and a link to `/u/<username>`. Works identically in `/walk` (same room, same inspector). Tests: [tests/play-friends-presence.test.js](tests/play-friends-presence.test.js), [tests/play-profile-identity.test.js](tests/play-profile-identity.test.js). || Crew HQ (crews, tags, 3D presence room) | Page [pages/crews.html](pages/crews.html) + [src/crews-page.js](src/crews-page.js) + [src/crews.css](src/crews.css) `→ /crews` and `/crews/<TAG>`, data layer [api/_lib/crews-store.js](api/_lib/crews-store.js), endpoints [api/crews/](api/crews) (`index.js`, `[tag].js`, `search.js`, `directory.js`), presence [api/_lib/presence-store.js](api/_lib/presence-store.js), schema `api/_lib/migrations/2026-06-05-crews.sql` | Live | The group half of the social system: a crew is a set of accounts flying one 2-6 character tag, with one owner, one crew per account, and a public headquarters. The HQ renders the roster as a room rather than a list, each member standing as their own agent's 3D avatar (resolved by `standeesFor()`, private models never emitted) and lit by the same Redis presence the friends drawer reads. Crew colour is an FNV-1a hash of the tag, so a crew looks like itself everywhere without stored art. Live `<agent-3d>` figures are capped and lazily mounted so a large crew cannot exhaust the browser's WebGL contexts. The backend shipped with W09 and had no UI at all until this page; the in-world friends drawer now links to it. Docs: [docs/crews.md](docs/crews.md). Tests: [tests/crews-shared.test.js](tests/crews-shared.test.js), [tests/crews-wiring.test.js](tests/crews-wiring.test.js) || Agent Spotlight (community showcase) | Index [pages/spotlight.html](pages/spotlight.html) + [src/spotlight.js](src/spotlight.js) `→ /spotlight`, entry page [pages/spotlight-entry.html](pages/spotlight-entry.html) + [src/spotlight-entry.js](src/spotlight-entry.js) `→ /spotlight/:id`, shared render + form modules [src/spotlight-shared.js](src/spotlight-shared.js) / [src/spotlight-form.js](src/spotlight-form.js), styles [src/spotlight.css](src/spotlight.css), crawler share cards [api/spotlight-og.js](api/spotlight-og.js), HTTP boundary [api/spotlight/[action].js](api/spotlight), queries + ranking [api/_lib/spotlight-store.js](api/_lib/spotlight-store.js), schema `api/_lib/migrations/20260901160000_agent_showcase.sql`, curated seed [scripts/seed-spotlight.mjs](scripts/seed-spotlight.mjs) | Live | The curated half of `/agents`: the index lists every agent ever registered, this lists the ones a person wrote up and the community voted on. An entry stores the pitch only (headline, one-liner, write-up, category, tags, demo link); the agent's name, avatar, skills, on-chain identity, conversation count and builder are read live off `agent_identities` on every request, so a card can never drift from the agent it points at. Ranked by `(votes + 1) / (age_days + 1) ^ 1.2`, computed identically in JS and in the SQL `ORDER BY`; the `+ 1` keeps a brand-new entry on the first page, and the day scale (rather than the hour scale every feed copies from Hacker News) is what stops a low-volume board's `trending` from collapsing into `newest`. One entry per agent (re-submitting edits it), one vote per account, votes counted on read rather than denormalised. Entries badged `Curated` were written by three.ws about someone else's public agent, say so in words on the entry page, and are replaced the moment that builder submits their own. The API lives at `/api/spotlight/*` because `/api/showcase` is the unrelated ERC-8004 directory ([api/showcase.js](api/showcase.js)); the tables keep the `agent_showcase` name they were applied under. Docs: [docs/spotlight.md](docs/spotlight.md). Tests: [tests/spotlight-ranking.test.js](tests/spotlight-ranking.test.js) |diff --git a/docs/event-readiness/11-event-live-ops.md b/docs/event-readiness/11-event-live-ops.mdindex 8e011de5a..feeae80c1 100644--- a/docs/event-readiness/11-event-live-ops.md+++ b/docs/event-readiness/11-event-live-ops.md@@ -4,7 +4,7 @@ Tomorrow the $THREE world hosts a live event. The countdown already exists (`src## Where the code lives-- Event config + countdown: `public/event.json`, `src/game/event-countdown.js` (self-attaching, zero edits to the core modules; keep that pattern). The same file is read by the home strip (`src/home-event-banner.js`), the API (`api/_lib/event-config.js`, from disk, cached a minute) and the game server (`multiplayer/src/event-window.js`, polled over HTTP every minute). Between events it holds an explicit no-event state (`id: null`) so `/event.json` still answers 200; edit it only through `npm run event:schedule -- --start <ISO> --duration <minutes> --apply` (`--rehearse 10` for a local dry run, `--clear` to reset) and gate the deploy on `npm run check:event`+- Event config + countdown: `public/event.json`, `src/game/event-countdown.js` (self-attaching, zero edits to the core modules; keep that pattern). The same file is read by the API (`api/_lib/event-config.js`, from disk, cached a minute) and the game server (`multiplayer/src/event-window.js`, polled over HTTP every minute). Between events it holds an explicit no-event state (`id: null`) so `/event.json` still answers 200; edit it only through `npm run event:schedule -- --start <ISO> --duration <minutes> --apply` (`--rehearse 10` for a local dry run, `--clear` to reset) and gate the deploy on `npm run check:event`- Multiplayer server (in-repo): `multiplayer/src/rooms/WalkRoom.js`, `multiplayer/src/social-hub.js`, the announce webhook in `multiplayer/src/index.js`; client socket + event bus: `src/game/community-net.js`- In-world screens for takeover moments: `src/game/x402-jumbotron.js`, `src/game/chart-screen.js`- Celebration FX precedent: the reaction-bar confetti in `src/game/coincommunities-ui.js`diff --git a/pages/home.html b/pages/home.htmlindex ad19fd9c4..e832dd744 100644--- a/pages/home.html+++ b/pages/home.html@@ -83,12 +83,6 @@<!-- Seasonal decorations (date-gated no-op outside its window) --><script src="/seasonal.js" defer></script>-<!-- Live-event strip, inserted between the nav and the hero at runtime. Reads- the ONE event window in the repo (public/event.json) through- src/shared/event-config.js, the same reader the /play countdown uses, and- mounts nothing when there is no event or the event has ended. -->-<script type="module" src="/src/home-event-banner.js"></script>-<!-- ── HERO ─────────────────────────────────────────────────────── --><main id="main-content" tabindex="-1"><section class="hero">diff --git a/scripts/check-event-window.mjs b/scripts/check-event-window.mjsindex 7c39246fc..2928a0a18 100644--- a/scripts/check-event-window.mjs+++ b/scripts/check-event-window.mjs@@ -2,8 +2,8 @@// Assert public/event.json describes an event that will actually happen.//// One file drives every live-event surface on the platform: the /play lobby-// banner and in-world countdown pill (src/game/event-countdown.js), the home-// page strip (src/home-event-banner.js), the in-world meetup layer with its+// banner and in-world countdown pill (src/game/event-countdown.js), the+// in-world meetup layer with its// agenda, go-live moments and fireworks (src/game/meetup-event.js), the game// server's quest gate (multiplayer/src/event-window.js), the leaderboard// endpoints (api/_lib/event-config.js), and the souvenir grantdiff --git a/scripts/verify-event-countdown.mjs b/scripts/verify-event-countdown.mjsindex e7bede6e9..149dbec24 100644--- a/scripts/verify-event-countdown.mjs+++ b/scripts/verify-event-countdown.mjs@@ -1,10 +1,8 @@#!/usr/bin/env node-// Drives a real Chromium through every state of the live-event countdown, on-// both surfaces that carry it: the /play lobby banner + in-world pill-// (src/game/event-countdown.js) and the home-page strip-// (src/home-event-banner.js). Run it before an event goes live; it is the-// go/no-go evidence that the countdown a holder sees is the countdown that-// actually ticks.+// Drives a real Chromium through every state of the live-event countdown on+// /play: the lobby banner + in-world pill (src/game/event-countdown.js). Run it+// before an event goes live; it is the go/no-go evidence that the countdown a+// holder sees is the countdown that actually ticks.//// npm run verify:event # against a local `npm run dev`// BASE=https://three.ws npm run verify:event # against production@@ -315,102 +313,6 @@ console.log('\n/play at 375px');await ctx.close();}-// ── home page strip: upcoming ──────────────────────────────────────────────-console.log('\nhome page strip, upcoming');-{- const { ctx, page, errors } = await newPage({ body: cfg({ startsIn: 3 * 86400e3, endsIn: 4 * 86400e3 }) });- await go(page, '/');- await waitFor(page, '.tws-eventbar', { timeout: PAGE_TIMEOUT });- const bar = page.locator('.tws-eventbar');- check('state is upcoming', (await bar.getAttribute('data-state')) === 'upcoming');- check('event name rendered', (await bar.locator('.tws-eventbar-name').textContent()) === NAME);- const place = await page.evaluate(() => {- const b = document.querySelector('.tws-eventbar').getBoundingClientRect();- const hero = document.querySelector('.hero').getBoundingClientRect();- const nav = document.querySelector('#nav-container').getBoundingClientRect();- return { aboveHero: b.bottom <= hero.top + 1, belowNav: b.top >= nav.bottom - 1 };- });- check('sits between the nav and the hero', place.aboveHero && place.belowNav, JSON.stringify(place));- await ticks(page, '.tws-eventbar-clock', 'clock ticks');-- const cta = bar.locator('.tws-eventbar-cta');- check('CTA points into the $THREE world', (await cta.getAttribute('href')).includes(COIN));- const rest = await cta.evaluate((n) => getComputedStyle(n).backgroundColor);- await cta.hover();- await page.waitForTimeout(250);- check('CTA hover state', (await cta.evaluate((n) => getComputedStyle(n).backgroundColor)) !== rest);- check('CTA focus-visible ring',- (await cta.evaluate((n) => { n.focus(); return getComputedStyle(n).outlineWidth; })) !== '0px');- check('no console errors', ownErrors(errors).length === 0, ownErrors(errors).join(' | '));- await ctx.close();-}--// ── home page strip: live, then over ───────────────────────────────────────-console.log('\nhome page strip, upcoming to live to over');-{- const { ctx, page, errors } = await newPage({ body: cfg({ startsIn: 8000, endsIn: 20000 }) });- await go(page, '/');- await waitFor(page, '.tws-eventbar[data-state="upcoming"]', { timeout: PAGE_TIMEOUT });- check('mounts as upcoming', true);- await waitFor(page, '.tws-eventbar[data-state="live"]', { timeout: 30000 });- check('flips to live with no reload', true);- check('kicker reads live', (await page.locator('.tws-eventbar-kicker').textContent()).trim() === 'Live now');- check('clock reads LIVE', (await page.locator('.tws-eventbar-clock').textContent()) === 'LIVE');- check('live dot pulses', (await cssAnim(page.locator('.tws-eventbar-dot'))) === 'tws-eventbar-pulse');- await waitFor(page, '.tws-eventbar', { gone: true, timeout: 30000 });- check('unmounts at endsAt', true);- check('no console errors', ownErrors(errors).length === 0, ownErrors(errors).join(' | '));- await ctx.close();-}--// ── home page strip: reduced motion, already over, dismissal, 375px ────────-console.log('\nhome page strip, reduced motion / already over / dismissal / 375px');-{- const rm = await newPage({ body: cfg({ startsIn: -60e3, endsIn: 3600e3 }), reducedMotion: 'reduce' });- await go(rm.page, '/');- await waitFor(rm.page, '.tws-eventbar[data-state="live"]', { timeout: PAGE_TIMEOUT });- check('no pulse animation under reduced motion', (await cssAnim(rm.page.locator('.tws-eventbar-dot'))) === 'none');- await rm.ctx.close();-- const over = await newPage({ body: cfg({ startsIn: -7200e3, endsIn: -3600e3 }) });- await go(over.page, '/');- await waitFor(over.page, '.hero', { timeout: PAGE_TIMEOUT });- await over.page.waitForTimeout(4000);- check('an already-ended event mounts nothing', (await over.page.locator('.tws-eventbar').count()) === 0);- await over.ctx.close();-- const body = cfg({ startsIn: 3 * 86400e3, endsIn: 4 * 86400e3 });- const d = await newPage({ body });- await go(d.page, '/');- await waitFor(d.page, '.tws-eventbar', { timeout: PAGE_TIMEOUT });- await d.page.locator('.tws-eventbar-x').click();- await d.page.waitForTimeout(300);- check('dismiss removes the strip', (await d.page.locator('.tws-eventbar').count()) === 0);- const storage = await d.ctx.storageState();- await d.ctx.close();-- const again = await newPage({ body, storage });- await go(again.page, '/');- await waitFor(again.page, '.hero', { timeout: PAGE_TIMEOUT });- await again.page.waitForTimeout(4000);- check('dismissal survives a reload', (await again.page.locator('.tws-eventbar').count()) === 0);- await again.ctx.close();-- const m = await newPage({ body, viewport: { width: 375, height: 812 } });- await go(m.page, '/');- await waitFor(m.page, '.tws-eventbar', { timeout: PAGE_TIMEOUT });- const geo = await m.page.evaluate(() => ({- scrollW: document.documentElement.scrollWidth,- clientW: document.documentElement.clientWidth,- nameTop: document.querySelector('.tws-eventbar-name').getBoundingClientRect().top,- ctaTop: document.querySelector('.tws-eventbar-cta').getBoundingClientRect().top,- right: document.querySelector('.tws-eventbar-in').getBoundingClientRect().right,- }));- check('page does not scroll sideways at 375px', geo.scrollW <= geo.clientW + 1, JSON.stringify(geo));- check('strip wraps instead of clipping', geo.ctaTop > geo.nameTop && geo.right <= 376, JSON.stringify(geo));- await m.ctx.close();-}-await browser.close();console.log(`\n${failures === 0 ? 'PASS' : 'FAIL'}: ${checks - failures}/${checks} checks passed against ${BASE}`);process.exit(failures === 0 ? 0 : 1);diff --git a/src/home-event-banner.js b/src/home-event-banner.jsdeleted file mode 100644index ed327d37a..000000000--- a/src/home-event-banner.js+++ /dev/null@@ -1,185 +0,0 @@-// Home-page event strip.-//-// The countdown used to live only on /play, which meant the event was invisible-// to anyone who never opened the world. This mounts a compact announcement bar-// between the nav and the hero on `/`, reading the SAME window as the /play-// surfaces through src/shared/event-config.js. There is exactly one copy of the-// event times in this repo (public/event.json); this file adds a view, never a-// second source.-//-// Self-attaching and self-removing: it fetches once at boot, mounts nothing when-// there is no event (or the event has ended), ticks once a second while an event-// is upcoming, flips to LIVE without a reload the moment the start time passes,-// and unmounts itself when the end time passes.-//-// Dismissal is shared with the /play in-world pill (the same-// `cc-event-dismissed:<startsAt>` key), so a visitor who waves the reminder away-// on the home page does not meet it again in the world. The /play lobby banner-// is deliberately NOT dismissible: it is lobby content, not an overlay.--import {- loadEventConfig, eventState, clockString, formatStart, alreadyAtEvent,-} from './shared/event-config.js';--const STYLE = `-.tws-eventbar {- border-bottom: 1px solid var(--hairline, rgba(255,255,255,0.08));- background: var(--surface-0, #0e0e0f);- color: var(--text, #f6f6f6);- font-family: var(--font-body, 'Inter', system-ui, sans-serif);-}-.tws-eventbar-in {- max-width: 1400px; margin: 0 auto; padding: 10px 24px;- display: flex; align-items: center; gap: 14px; flex-wrap: wrap;-}-.tws-eventbar-dot {- flex: none; width: 6px; height: 6px; border-radius: 50%;- background: var(--text-3, #8a8a8a);-}-.tws-eventbar[data-state="live"] .tws-eventbar-dot {- background: var(--accent, #fff); box-shadow: 0 0 6px var(--accent, #fff);- animation: tws-eventbar-pulse 2.4s ease-in-out infinite;-}-@keyframes tws-eventbar-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }-@media (prefers-reduced-motion: reduce) {- .tws-eventbar[data-state="live"] .tws-eventbar-dot { animation: none; }- .tws-eventbar-cta, .tws-eventbar-x { transition: none; }-}-.tws-eventbar-kicker {- font-family: var(--font-mono, ui-monospace, monospace); font-size: 11px;- letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-3, #8a8a8a);- white-space: nowrap;-}-.tws-eventbar-name { font-weight: 600; font-size: 14px; }-.tws-eventbar-when { font-size: 13px; color: var(--text-2, #a8a8a8); }-.tws-eventbar-clock {- font-family: var(--font-mono, ui-monospace, monospace); font-size: 13px;- font-variant-numeric: tabular-nums; color: var(--text, #f6f6f6);- padding: 3px 9px; border: 1px solid var(--hairline, rgba(255,255,255,0.08));- border-radius: 999px; white-space: nowrap;-}-.tws-eventbar-cta {- margin-left: auto;- display: inline-flex; align-items: center; gap: 7px;- padding: 7px 14px; border-radius: 999px;- border: 1px solid var(--hairline-strong, rgba(255,255,255,0.14));- color: var(--text, #f6f6f6); text-decoration: none;- font-size: 13px; font-weight: 500; white-space: nowrap;- transition: color 0.15s, border-color 0.15s, background 0.15s;-}-.tws-eventbar-cta .tws-eventbar-arrow { display: inline-block; transition: transform 0.15s; }-.tws-eventbar-cta:hover, .tws-eventbar-cta:focus-visible {- background: rgba(255, 255, 255, 0.05);- border-color: var(--accent, #fff);-}-.tws-eventbar-cta:hover .tws-eventbar-arrow,-.tws-eventbar-cta:focus-visible .tws-eventbar-arrow { transform: translateX(3px); }-.tws-eventbar-cta:active { transform: translateY(1px); }-.tws-eventbar-cta:focus-visible { outline: 2px solid var(--accent, #fff); outline-offset: 2px; }-.tws-eventbar-x {- flex: none; display: grid; place-items: center; width: 26px; height: 26px;- border: 0; border-radius: 50%; background: transparent;- color: var(--text-3, #8a8a8a); font: inherit; font-size: 15px; line-height: 1;- transition: background 0.15s, color 0.15s;-}-/* With no CTA the close button takes the right edge itself. */-.tws-eventbar-x { margin-left: auto; }-.tws-eventbar-cta ~ .tws-eventbar-x { margin-left: 0; }-.tws-eventbar-x:hover { background: rgba(255, 255, 255, 0.08); color: var(--text, #f6f6f6); }-.tws-eventbar-x:active { transform: scale(0.94); }-.tws-eventbar-x:focus-visible { outline: 2px solid var(--accent, #fff); outline-offset: 1px; }-[data-theme='light'] .tws-eventbar-cta:hover,-[data-theme='light'] .tws-eventbar-cta:focus-visible { background: rgba(0, 0, 0, 0.05); }-[data-theme='light'] .tws-eventbar-x:hover { background: rgba(0, 0, 0, 0.06); }-@media (max-width: 720px) {- .tws-eventbar-in { padding: 9px 16px; gap: 8px 10px; }- .tws-eventbar-when { flex-basis: 100%; order: 4; font-size: 12px; }- .tws-eventbar-cta { margin-left: 0; order: 5; }- .tws-eventbar-x { order: 6; margin-left: auto; }-}-`;--function el(tag, attrs = {}, children = []) {- const n = document.createElement(tag);- for (const [k, v] of Object.entries(attrs)) {- if (v == null) continue;- if (k === 'text') n.textContent = v;- else if (k.startsWith('on') && typeof v === 'function') n.addEventListener(k.slice(2), v);- else n.setAttribute(k, v);- }- for (const c of children) if (c) n.appendChild(c);- return n;-}--class HomeEventBar {- constructor(cfg, main) {- this.cfg = cfg;- this.timer = 0;- document.head.appendChild(el('style', { text: STYLE }));-- this.kicker = el('span', { class: 'tws-eventbar-kicker', text: 'Upcoming' });- this.clock = el('span', { class: 'tws-eventbar-clock', role: 'timer' });- const cta = cfg.link && !alreadyAtEvent(cfg)- ? el('a', { class: 'tws-eventbar-cta', href: cfg.link, 'data-cta': 'event_join', 'data-cta-loc': 'home_eventbar' }, [- el('span', { text: cfg.linkLabel }),- el('span', { class: 'tws-eventbar-arrow', 'aria-hidden': 'true', text: '→' }),- ])- : null;-- this.bar = el('aside', { class: 'tws-eventbar', 'aria-label': `Event: ${cfg.name}` }, [- el('div', { class: 'tws-eventbar-in' }, [- el('span', { class: 'tws-eventbar-dot', 'aria-hidden': 'true' }),- this.kicker,- el('span', { class: 'tws-eventbar-name', text: cfg.name }),- el('span', { class: 'tws-eventbar-when', text: formatStart(cfg.startsAt) }),- this.clock,- cta,- el('button', {- type: 'button', class: 'tws-eventbar-x', title: 'Dismiss',- 'aria-label': 'Dismiss the event announcement',- onclick: () => {- try { localStorage.setItem('cc-event-dismissed:' + cfg.startsAt, '1'); } catch { /* private mode: dismiss for this page view only */ }- this.destroy();- },- }, [el('span', { 'aria-hidden': 'true', text: '×' })]),- ]),- ]);-- main.parentNode.insertBefore(this.bar, main);- this._tick();- this.timer = setInterval(() => this._tick(), 1000);- }-- _tick() {- const now = Date.now();- const state = eventState(this.cfg, now);- if (state === 'over') return this.destroy();- this.bar.setAttribute('data-state', state);- if (state === 'live') {- this.kicker.textContent = 'Live now';- this.clock.textContent = 'LIVE';- } else {- this.kicker.textContent = 'Upcoming';- this.clock.textContent = clockString(this.cfg.startsAt - now);- }- }-- destroy() {- clearInterval(this.timer);- this.bar?.remove();- this.bar = null;- }-}--async function boot() {- const cfg = await loadEventConfig();- if (!cfg) return;- let dismissed = false;- try { dismissed = !!localStorage.getItem('cc-event-dismissed:' + cfg.startsAt); } catch { dismissed = false; }- if (dismissed) return;- const main = document.getElementById('main-content');- if (!main || !main.parentNode) return;- new HomeEventBar(cfg, main);-}--boot();diff --git a/src/shared/event-config.js b/src/shared/event-config.jsindex eeaa174f9..3292ae831 100644--- a/src/shared/event-config.js+++ b/src/shared/event-config.js@@ -2,8 +2,7 @@//// The event window lives in exactly one file (`public/event.json`, served at// `/event.json`) and every countdown surface reads it through here: the `/play`-// lobby banner and in-world pill (src/game/event-countdown.js) and the home page-// strip (src/home-event-banner.js). Two surfaces reading two copies of a start+// lobby banner and in-world pill (src/game/event-countdown.js). Two surfaces reading two copies of a start// time is how a countdown ends up disagreeing with itself on the day, so the// parsing, the state machine, and the clock formatting are all shared.//