Skip to content

Introduce UI interaction state, primitives, and layout/theme catalog updates#40

Open
hybernia1 wants to merge 1 commit intomainfrom
codex/refactor-ui-for-consistency
Open

Introduce UI interaction state, primitives, and layout/theme catalog updates#40
hybernia1 wants to merge 1 commit intomainfrom
codex/refactor-ui-for-consistency

Conversation

@hybernia1
Copy link
Owner

Motivation

  • Centralize UI open/interaction flags and unify cursor/pointer-lock behavior to avoid scattered state and duplicated logic.
  • Provide consistent layout and theme primitives so UI components share sizes, spacing, colors and z-index values.
  • Replace ad-hoc UI styling with reusable primitives for panels, overlays and buttons to simplify future UI work.

Description

  • Added createUiInteractionState in src/core/ui/uiInteractionState.js to track inventoryOpen, consoleOpen, lootOpen, and deathOpen and expose isGameplayInputBlocked, isCursorVisible, getState and onChange APIs.
  • Introduced uiPrimitives in src/core/ui/uiPrimitives.js with createUiPanel, createUiOverlay, and createUiButton that consume uiThemeCatalog and uiLayoutCatalog values.
  • Extended uiLayoutCatalog and uiThemeCatalog (src/content/*) with new spacing, border, radius, zIndex, typography and component size entries, and new color tokens for buttons, slots, overlays and feedback.
  • Reworked createScene in src/core/scene/sceneFactory.js to use the new uiInteractionState, pass open-state callbacks into HUDs, and centralize cursor and pointer-lock handling in the scene's onBeforeRenderObservable.
  • Updated multiple UI components to use the new theme/layout primitives and tokens, including consoleChat, inventoryHud, playerDeathHud, playerVitalsHud, itemHoverTooltip, and timeHud, replacing hardcoded sizes/colors/padding and plumbing visibility callbacks to uiInteractionState.

Testing

  • Ran the existing automated test suite with npm test and the tests completed successfully.
  • Ran linting with npm run lint which returned no new errors.
  • Performed a local dev build (npm run dev) to ensure no runtime module resolution errors occurred during integration of the new UI modules.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant