Skip to content

Milestone toasts at distance thresholds (closes #11)#20

Merged
JarlLyng merged 1 commit into
mainfrom
feat/milestone-toasts
May 6, 2026
Merged

Milestone toasts at distance thresholds (closes #11)#20
JarlLyng merged 1 commit into
mainfrom
feat/milestone-toasts

Conversation

@JarlLyng
Copy link
Copy Markdown
Owner

@JarlLyng JarlLyng commented May 6, 2026

Summary

When the rocket crosses one of four curated AU thresholds, a primary-coloured toast appears above the ship for ~3s. Each milestone fires once per session.

Thresholds

AU Label
100 Past Pluto
1,000 Through the heliosphere
10,000 Into the Oort cloud
100,000 One light-year out

Visual

  • Centered above the rocket, primary-colour border + 32px glow
  • Distance in primary, label in uppercase secondary text
  • aria-live="polite" so screen readers announce without interrupting
  • pointer-events: none — never blocks input

Analytics

Each milestone reached fires a milestone-reached Umami event with { au }.

Test plan

  • Quality + CodeQL pass
  • Manual: fly to 100 AU, verify toast appears with "Past Pluto", fades after ~3s
  • Manual: keep flying — second milestone fires only at 1000 AU
  • Manual: reload, fly past 100 AU again — toast fires (per-session reset)

@vercel
Copy link
Copy Markdown

vercel Bot commented May 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
little-rocket Ready Ready Preview, Comment May 6, 2026 11:29am

Closes #11.

When the rocket crosses one of the curated AU thresholds, a celebratory
toast slides into view above the rocket for ~3 seconds:

  100 AU      → Past Pluto
  1,000 AU    → Through the heliosphere
  10,000 AU   → Into the Oort cloud
  100,000 AU  → One light-year out

- src/milestones.js: thresholds + edge detection. fired Set guarantees one
  toast per threshold per session — reload to see them again.
- index.html: new #milestone-toast element with two spans (distance + label).
  aria-live="polite" so a screen reader announces it without interrupting.
- styles/main.css: prominent treatment — primary-color border + 32px glow,
  larger type than the regular HUD chrome, but still pointer-events: none
  and centered above the rocket so it never blocks gameplay. 480px media
  query trims sizes for phones.
- main.js: flashMilestone() helper following the same pattern as
  flashNearMiss (force-reflow + class toggle for transition, hide-then-
  remove timers). Wired into the frame loop after distanceAU is updated.
  Each milestone fires a `milestone-reached` Umami event with {au} so we
  can see how far players actually get.
- README: milestones.js added to the module table; milestone-reached
  added to the analytics table.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@JarlLyng JarlLyng force-pushed the feat/milestone-toasts branch from ff78322 to 83c5e7c Compare May 6, 2026 11:29
@JarlLyng JarlLyng merged commit 8e232c7 into main May 6, 2026
5 checks passed
@JarlLyng JarlLyng deleted the feat/milestone-toasts branch May 6, 2026 11:31
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