Instruction file imported from ttrebicki/theceo (
.cursor/rules/react-ui.mdc). Copyright stays with the author.
React UI
Components (reuse, don't duplicate)
| Component | Import | Use |
|---|---|---|
Panel |
components/ui/Panel |
Titled card with close button |
ModalOverlay |
components/ui/ModalOverlay |
Overlay wrapper |
Button |
components/ui/Button |
variant: primary / secondary / danger |
StatRow, DataTable, Tooltip, formatMoney |
components/ui/Stats |
HUD + reports |
ScreenTransition |
components/ui/ScreenTransition |
Phase screen enter |
ModalOverlay
<ModalOverlay onClose={onClose} variant="scene" align="side">
<Panel title="..." onClose={onClose}>...</Panel>
</ModalOverlay>
variant="scene"— lighter backdrop, Pixi visible behindalign="side"— right panel (~360px), used byAdvisorPanel
Styling Rules
- No inline
style={}— add classes tosrc/styles/global.css - Use CSS vars:
--color-bg,--vga-cyan,--font-comic,--shadow-lagoon - Comic Sans, font-weight ≥ 500 (700 for titles)
- BEM classes:
ui-panel__body,game-hud__stat,sales-warnings__list
Game State in UI
const { state, player, updatePlayer, closeAdvisor } = useGame();
updatePlayer((p) => { p.adBudget = value; });
Read-only: state.phase, state.quarter, state.lastReport.
Performance
useCallbackfor handlers passed to children or memoized Pixi factoriesuseMemofor derived row data (seeSalesReportScreen)- Avoid inline object/array props — const outside component or memo
Screen Layout
Full-screen Pixi + panel:
<div className="screen screen--with-scene screen--auction">
<PixiStage className="screen__pixi" createScene={createScene} />
<div className="screen__panel"><Panel>...</Panel></div>
</div>