feat: bundled catalog, market tooltips, and orders overhaul#87
Merged
feat: bundled catalog, market tooltips, and orders overhaul#87
Conversation
- 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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
catalog.json must exist before tsc can type-check catalog.ts imports
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
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