ui(climate-sim): 💄 Improve ClimateSimDisplay component with dynamic data visualization and interactive tooltips
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
4c19ebd3bf
commit
c4aae19e06
1 changed files with 5 additions and 4 deletions
|
|
@ -10,7 +10,7 @@ import {
|
|||
CANVAS_W, CANVAS_H,
|
||||
DEFAULT_SCENARIO_TURNS, EXTEND_TURNS, FRAME_MS, DEFAULT_BUFFER_SECONDS,
|
||||
} from '@magic-civ/engine-ts'
|
||||
import { useSimulationWorker } from '@/hooks/useSimulationWorker'
|
||||
import type { UseSimulationWorkerResult } from '../../types/simulation'
|
||||
import { HexGLRenderer } from './HexGLRenderer'
|
||||
import { LayerPanel, ENVIRONMENT_DEFAULT_MASK, LIFE_DEFAULT_MASK } from './LayerPanel'
|
||||
import type { SimCategory } from './LayerPanel'
|
||||
|
|
@ -93,9 +93,10 @@ function frameAsSnapshot(frame: FramePayload, stats?: { avg_moisture: number; to
|
|||
|
||||
interface ClimateSimDisplayProps {
|
||||
easterEggs?: Record<string, EasterEggSeed>
|
||||
simulation: UseSimulationWorkerResult
|
||||
}
|
||||
|
||||
export function ClimateSimDisplay({ easterEggs }: ClimateSimDisplayProps): ReactElement {
|
||||
export function ClimateSimDisplay({ easterEggs, simulation }: ClimateSimDisplayProps): ReactElement {
|
||||
const [searchParams, setSearchParams] = useSearchParams()
|
||||
|
||||
// ── URL state ──────────────────────────────────────────────────────────
|
||||
|
|
@ -183,7 +184,7 @@ export function ClimateSimDisplay({ easterEggs }: ClimateSimDisplayProps): React
|
|||
return () => document.removeEventListener('mousedown', onDown)
|
||||
}, [planetOpen])
|
||||
|
||||
// ── worker hook ────────────────────────────────────────────────────────
|
||||
// ── simulation (provided by consumer) ──────────────────────────────────
|
||||
const {
|
||||
scenarios: workerScenarios,
|
||||
currentFrame,
|
||||
|
|
@ -195,7 +196,7 @@ export function ClimateSimDisplay({ easterEggs }: ClimateSimDisplayProps): React
|
|||
requestFrame,
|
||||
cancelScenario,
|
||||
triggerEvent,
|
||||
} = useSimulationWorker()
|
||||
} = simulation
|
||||
|
||||
// ── kick off simulation when worker is ready or scenario changes ──────
|
||||
// NOTE: workerScenarios is intentionally NOT in this dep array — it updates on every
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue