PURPOSE

Post-mission reward sequence. Plays a staged reveal animation after Game Over: title and stats fade in, a credits card grows from zero while four progress bars (TIERS, KILLS, EVENTS, LEVEL) fill in sequence, each contributing its credit chunk to a count-up tween. Lands on a CONTINUE button that routes to the ship-pull screen, then on to Hub. Tap-anywhere fast-forwards to the end state.

OWNS

  • The RevealScreen exported function component (mounted at the reveal route).
  • Three local presentational components: BonusBar (generic stat bar with PB arrow), TierBar (tier progress bar with tick marks and clamping), CreditsCard (rarity-styled card showing the animated credit total).
  • Stage schedule constant STAGE — millisecond offsets from mount for each animation step.
  • Display constant TIER_BAR_MAX (hard cap for the tier bar fill).
  • One-shot PB capture-then-save logic gated by didSetupRef.
  • Stage-gating state (showTitle, showStats, showCredits, four barNFill values, displayedCredits, showContinue) and the timers + RAF loop that drive it.
  • The piecewise credits count-up tween, easing each bar’s contribution between its Start/End offsets with quadratic ease-out.
  • The skipToEnd handler that collapses every stage to its final value on a root-click.

READS FROM

  • useSessionStore selector for missionResult (the run summary blob produced by the engine on game-over).
  • computeArcadeCreditsBreakdown from @starship-survivors/data/economy — returns tierBase, killBonusCredits, eventBonusCredits, levelBonusCredits, total, parKills, parEvents, parLevel.
  • Mission-result fields: progression.tierReached, combat.totalKills, progression.eventsCompleted, progression.levelReached, identity.nodeId, performance.timeElapsedSeconds, performance.score.
  • Per-planet PB getters from @starship-survivors/data/run-history: getTierPB, getKillsPB, getEventsPB, getLevelPB — keyed by nodeId.
  • Card-theme constants from @starship-survivors/engine/rendering/card-theme: RARITY_ACCENT, RARITY_BADGE_LETTER, RARITY_BADGE_FILL, CARD_SHADOW_CSS, CARD_BADGE, rarityGradientCss.

PUSHES TO

  • Per-planet PB writers from run-history: saveTierPB, saveKillsPB, saveEventsPB, saveLevelPB — invoked once per mount under didSetupRef after a local snapshot of the previous values is taken so the arrow markers still render against the pre-save baseline.
  • React Router navigation: redirects to / (replace) when missionResult is missing, and to /games/starship-survivors/ship-pull from the CONTINUE button click handler.
  • DOM via inline-styled React elements — no Canvas, no engine state writes.

DOES NOT

  • Does not award or persist credits — the credits card animation is purely visual; the actual credit grant lives elsewhere (engine / economy reward path).
  • Does not drop mods or ship upgrades — the ship-upgrades feature was removed and the file header explicitly notes mod drops are disabled.
  • Does not mutate the session store or clear missionResult — that’s the responsibility of downstream screens.
  • Does not handle audio, haptics, or analytics events.
  • Does not implement responsive layout breakpoints beyond clamp() font sizes and maxWidth constraints on inner columns.
  • Does not enforce that PBs only update on improvement — save*PB is called unconditionally with this run’s values; the per-stat improvement logic is the responsibility of the run-history writers.

Signals

  • The component renders null until both missionResult and the computed breakdown are present; the redirect-to-home effect handles the missing-result case in parallel.
  • didSetupRef is a mount-scoped one-shot guard ensuring PB snapshot + save runs exactly once even if effect deps change.
  • The credits tween segments are walked in order: each fully-elapsed segment’s add is summed in full; the segment that contains elapsed is eased and added partial; later segments contribute zero. Once elapsed >= STAGE.bar4End, the tween snaps to breakdown.total and the RAF loop stops.
  • Stage gating uses separate booleans/floats per bar rather than a single ordinal — skipToEnd flips them all at once.
  • The tier bar clamps both reached and pb to TIER_BAR_MAX for display only; the raw tier value still renders in the header with a + suffix when over cap.
  • The PB arrow is hidden when the snapshot value is zero (no prior run on that planet).

Entry points

  • Rendered by the React Router route for the post-mission reveal step (the engine’s game-over flow navigates here once missionResult is set on the session store).
  • Mount-time effects schedule all stage setTimeouts and start the RAF credit-tween.
  • Root container onClick triggers skipToEnd.
  • CONTINUE button onClick either calls skipToEnd (if the stage hasn’t reached continueAt yet) or navigates onward to /games/starship-survivors/ship-pull; the button stops click propagation so it doesn’t double-fire skipToEnd.

Pattern notes

  • All styling is inline — no CSS modules, no Tailwind. Fonts: Cal Sans for display headings, Space Grotesk for numeric labels, Bungee for the big credits number.
  • Animation strategy is hybrid: CSS transitions for opacity / transform / width on bar fills, RAF-driven JS interpolation for the credits count-up. Quadratic ease-out (1 - (1 - t) * (1 - t)) is applied per segment.
  • The bar fill API is (target, fillProgress) where fillProgress is 0..1 — switching from 0 to 1 lets CSS transitions handle the actual fill animation; the component does not animate fillProgress itself.
  • Local sub-components are not exported and are not memoized — they are cheap and re-render with the parent each tween frame.
  • Z-index for the root container is 300 — sits above the in-game canvas and most HUD overlays.
  • The mod-drop comment in the file header is a forward-looking marker that the screen could host card drops if the feature returns; nothing in the current render tree depends on it.