Add HUD status-bar tooltips for Coins, Reputation, and Score in Main Street#466
Open
SorraTheOrc wants to merge 2 commits into
Open
Add HUD status-bar tooltips for Coins, Reputation, and Score in Main Street#466SorraTheOrc wants to merge 2 commits into
SorraTheOrc wants to merge 2 commits into
Conversation
added 2 commits
May 18, 2026 00:11
…n, and Score - Add MainStreetHudTooltips.ts module with tooltip content builder functions for Coins (income breakdown), Reputation (multiplier details), and Score (estimate + next tier threshold). - Include i18n key registry (HUD_TOOLTIP_I18N_KEYS, HUD_ARIA_I18N_KEYS) and default localizable strings (HUD_TOOLTIP_STRINGS). - Add ARIA labels for each interactive HUD zone (HUD_ARIA_LABELS). - Modify MainStreetRenderer.refreshHud() to attach interactive tooltip zones to coinText, repText, and scoreText via new attachHudTooltipZone() method. - Desktop: pointerover shows tooltip; pointerout hides it. - Mobile: tap toggles tooltip on/off. - Tooltips respect TooltipManager / SettingsPanel.showTooltips toggle. - Add unit tests (18 tests) for tooltip builders and i18n key consistency. - Add browser integration test verifying tooltip zones are attached and tooltipManager.show() is called with correct content.
…tem instead of hardcoded English defaults - Add src/core-engine/I18n.ts: minimal i18n module providing t(), registerLocale(), setLocale(), getLocale(), and resetI18n() for locale-aware string lookup - Register HUD_TOOLTIP_STRINGS and HUD_ARIA_STRINGS as the 'en' locale bundle at module load time in MainStreetHudTooltips.ts - Refactor all tooltip builder functions (buildCoinsTooltip, buildReputationTooltip, buildScoreTooltip) to use t(HUD_TOOLTIP_I18N_KEYS.xxx) instead of direct HUD_TOOLTIP_STRINGS.xxx lookups - Refactor HUD_ARIA_LABELS to use getter properties that resolve through t(), making ARIA labels locale-aware - Export I18n module from core-engine/index.ts barrel file - Add comprehensive I18n tests (14 unit + integration tests) - Add 4 new tests to hud-tooltips.test.ts verifying i18n resolution for tooltip strings, ARIA labels, and locale overrides This addresses the audit gap: HUD_TOOLTIP_I18N_KEYS were defined but not consumed by any lookup mechanism. The builders now use the i18n t() function which resolves the active locale bundle with en fallback, satisfying the constraint to not ship hardcoded English-only strings.
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.
Summary
Add contextual tooltips to the top status bar (Coins, Reputation, Score) in Main Street to show expected income this turn, reputation influence on income, and next tier threshold.
Work item: CG-0MP2A0X0K007JRU4
Changes
New:
example-games/main-street/scenes/MainStreetHudTooltips.ts— Tooltip content builder module with i18n key registry (HUD_TOOLTIP_I18N_KEYS,HUD_ARIA_I18N_KEYS), default localizable strings (HUD_TOOLTIP_STRINGS), and ARIA labels (HUD_ARIA_LABELS). Builder functions:buildCoinsTooltip()— expected income (pre/post reputation multiplier) + calculation notebuildReputationTooltip()— current rep, active coin multiplier, effect explanationbuildScoreTooltip()— final-score estimate + next tier threshold or "All tiers unlocked"findNextLockedTier()— utility to find next locked tier from campaign progressModified:
example-games/main-street/scenes/MainStreetRenderer.ts— Added interactive tooltip zones to coinText, repText, and scoreText HUD elements via newattachHudTooltipZone()method. Desktop: hover shows/dismisses tooltip. Mobile: tap toggles tooltip. Respects TooltipManager / SettingsPanel.showTooltips toggle.New:
tests/main-street/hud-tooltips.test.ts— 18 unit tests covering tooltip content builders, findNextLockedTier, and i18n key consistencyModified:
tests/main-street/MainStreetScene.browser.test.ts— 1 browser integration test verifying tooltip zones are attached and tooltipManager.show() is called with correct contentHow to test manually
npm run dev)Review focus