Skip to content

feat: bundled catalog, market tooltips, and orders overhaul#87

Merged
cahaseler merged 9 commits intomainfrom
fix-market-tooltips
Mar 24, 2026
Merged

feat: bundled catalog, market tooltips, and orders overhaul#87
cahaseler merged 9 commits intomainfrom
fix-market-tooltips

Conversation

@cahaseler
Copy link
Copy Markdown
Contributor

@cahaseler cahaseler commented Mar 24, 2026

Summary

Bundles the full game catalog (items, recipes, ships) at build time, eliminating ~20+ runtime API calls for catalog data. Fixes broken item tooltips, replaces invisible insight indicators with visible lightbulb icons, adds rich hover tooltips for market insights, and overhauls the Orders panel with proper item selection UI.

User-Facing Changes

  • Play client item tooltips now show crafting recipes, module stats, and item details
  • Market analysis insights shown as yellow lightbulb icons with rich hover tooltips
  • Orders panel: sell orders have a searchable inventory dropdown with smart defaults (max quantity, base price); buy orders have catalog-wide autocomplete

- Add scripts/fetch-catalog.mjs that fetches all items, recipes, and ships
  from the game server at build time (anonymous session, no login needed)
- Bundle as src/data/catalog.json (~850KB), gitignored
- Rewrite ItemCatalogContext to use bundled data — all lookups are now
  instant with no API calls (item tooltips, base prices, etc.)
- Fix item tooltip data transformation: properly map recipes into
  produced_by/consumed_by and extract flat module stats into nested object
- Replace invisible insight dots with yellow Lightbulb icons
- Add rich portal-based insight tooltips (replacing native title attributes)
- Show "N insights found" status bar after market analysis
- Remove unused CATEGORY_COLORS constant
Orders panel:
- Sell: searchable dropdown of tradeable items in cargo/storage
- Buy: autocomplete from full bundled catalog (type 2+ chars to search)
- Defaults: sell qty=max available, price=base_value for both types
- Wider input fields with labeled form layout
- Shows base price hint and available quantity

Consumer migrations:
- CraftingPanel: reads recipes from bundled catalog (removes ~10 API calls)
- PlayClient: populates module catalog from bundled data (removes ~4 API calls)
- Removes "Load Recipes" button since recipes are always available
- Remove wasteful module-level Maps in catalog.ts — use plain objects
- Fix BuyAutocomplete wiping qty/price on every keystroke (only clear
  selection when text diverges from selected item name)
- Replace unsafe `as unknown as Recipe[]` cast with proper field mapping
- Use formatItemId from catalog in CraftingPanel (replaces 4 inline
  replace chains with proper name lookups)
- Remove temporal comments ("now bundled", "kept for API compatibility")
…indings

Architecture cleanup:
- Delete ItemCatalogContext — consumers import directly from @/data/catalog
- Delete ItemSelector (dead code, zero imports)
- ItemDetail gains ItemDetailFromCatalog that does its own recipe/module lookup
- ItemTooltip uses bundled catalog directly (no async, no loading state)
- ShipPanel reads modules from bundled catalog (removes moduleCatalog state)
- PlayClient drops ItemCatalogProvider wrapper and SET_MODULE_CATALOG dispatch
- Remove moduleCatalog + ModuleCatalogEntry from game state/types/reducer

Review findings addressed:
- Create useClickOutside hook (replaces 2 inline copies, 8+ elsewhere)
- Create useHoverTooltip hook (shared by ItemTooltip and InsightBadge)
- Add ARIA attributes to SellDropdown and BuyAutocomplete (listbox, option,
  combobox, aria-expanded, aria-selected, aria-autocomplete)
- Remove dead loadRecipes/totalRecipes/allLoaded from CraftingPanel
- Add missing module stat fields (speed_penalty, shield_recharge_bonus,
  damage_reduction, power_bonus, cpu_bonus, survey_power, reach) to
  CatalogModuleStats, RawCatalogItem, MODULE_STAT_KEYS, and display
- Strengthen isModule with explicit type list instead of field sniffing
- Remove redundant modules fetch from build script (items already includes them)
- Default required_skills to {} in recipe transform to prevent runtime throws
- Fix ShipPanel double catalog lookup per item (flatMap instead of filter+map)
- Avoid double JSON.stringify in build script
- Use catalog name directly in inventoryItems instead of double lookup
- Sort BuyAutocomplete suggestions alphabetically
- Use formatItemId in MiningModal instead of inline regex
- Build script: fail hard if catalog.json missing and fetch fails
- Use shared isModule() in ItemDetail instead of field-sniffing heuristic
- Widen useHoverTooltip ref type to HTMLElement for reusability
- Remove misleading ref from useClickOutside dependency array
- Add Escape key dismiss to SellDropdown and BuyAutocomplete
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 24, 2026

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

Project Deployment Actions Updated (UTC)
www Ready Ready Preview, Comment Mar 24, 2026 6:50pm

Request Review

catalog.json must exist before tsc can type-check catalog.ts imports
@cahaseler cahaseler merged commit 3117430 into main Mar 24, 2026
3 checks passed
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