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
RevealScreenexported 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, fourbarNFillvalues,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
skipToEndhandler that collapses every stage to its final value on a root-click.
READS FROM
useSessionStoreselector formissionResult(the run summary blob produced by the engine on game-over).computeArcadeCreditsBreakdownfrom@starship-survivors/data/economy— returnstierBase,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 bynodeId. - 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 underdidSetupRefafter 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) whenmissionResultis missing, and to/games/starship-survivors/ship-pullfrom 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 andmaxWidthconstraints on inner columns. - Does not enforce that PBs only update on improvement —
save*PBis called unconditionally with this run’s values; the per-stat improvement logic is the responsibility of therun-historywriters.
Signals
- The component renders
nulluntil bothmissionResultand the computedbreakdownare present; the redirect-to-home effect handles the missing-result case in parallel. didSetupRefis 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
addis summed in full; the segment that containselapsedis eased and added partial; later segments contribute zero. Onceelapsed >= STAGE.bar4End, the tween snaps tobreakdown.totaland the RAF loop stops. - Stage gating uses separate booleans/floats per bar rather than a single ordinal —
skipToEndflips them all at once. - The tier bar clamps both
reachedandpbtoTIER_BAR_MAXfor 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
missionResultis set on the session store). - Mount-time effects schedule all stage
setTimeouts and start the RAF credit-tween. - Root container
onClicktriggersskipToEnd. - CONTINUE
buttononClickeither callsskipToEnd(if the stage hasn’t reachedcontinueAtyet) or navigates onward to/games/starship-survivors/ship-pull; the button stops click propagation so it doesn’t double-fireskipToEnd.
Pattern notes
- All styling is inline — no CSS modules, no Tailwind. Fonts:
Cal Sansfor display headings,Space Groteskfor numeric labels,Bungeefor 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)wherefillProgressis 0..1 — switching from 0 to 1 lets CSS transitions handle the actual fill animation; the component does not animatefillProgressitself. - 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.