'use client' import { useEffect, useState } from 'react' import { Badge } from '@/components/ui/badge' import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert' import { Button } from '@/components/ui/button' import { Card, CardContent, CardFooter, CardHeader, CardTitle } from '@/components/ui/card' import { Panel, PanelContent, PanelHeader, PanelTitle } from '@/components/ui/panel' import { Progress } from '@/components/ui/progress' import { StatCard } from '@/components/ui/stat-card' import { StatusGrid, type SystemEntry } from '@/components/ui/status-grid' import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs' import { Terminal, type TerminalLine } from '@/components/ui/terminal' import { WorldMapPanel } from '@/components/world-map' // Interface base: layout + visual treatment rebuilt from the scificn-ui Mission Control // showcase (src/app/_pages/showcase/mission-control-content.tsx in baxy5/scificn-ui). The // WORLD MAP tab renders live data from /api/world; the other tabs keep placeholder content // until their own issues land. Single player, no auth, by design. function useNarrow(threshold = 900): boolean { const [narrow, setNarrow] = useState( () => typeof window !== 'undefined' && window.innerWidth < threshold ) useEffect(() => { const handle = () => setNarrow(window.innerWidth < threshold) window.addEventListener('resize', handle, { passive: true }) return () => window.removeEventListener('resize', handle) }, [threshold]) return narrow } function now(): string { return new Date().toLocaleTimeString('en-GB', { hour12: false }) } // ── Placeholder content (no game logic — real values land with the turn engine) ── const shipSystems: SystemEntry[] = [ { name: 'REACTOR', status: 'ACTIVE', detail: '94.2%' }, { name: 'LIFE SUPPORT', status: 'ACTIVE' }, { name: 'NAV COMPUTER', status: 'SCANNING' }, { name: 'WEAPONS', status: 'OFFLINE' }, { name: 'COMMS', status: 'ACTIVE' }, ] // LOCAL SYSTEM — explorable worlds of the current system (regenerated per save after each jump, later). const explorablePlanets = [ { name: 'AURELLE', type: 'TERRESTRIAL // OCEAN CONTINENTS', state: 'UNEXPLORED' as const, moons: [{ name: 'PALEMOON', type: 'ICE MOON // FROST PLAINS', state: 'UNEXPLORED' as const }], }, { name: 'BRIMSTONE', type: 'GAS GIANT // CLOUD DECKS', state: 'SCANNED' as const, moons: [{ name: 'ASHFALL', type: 'VOLCANIC MOON // SULFUR VEINS', state: 'UNEXPLORED' as const }], }, { name: 'CINDERROCK', type: 'ROCKY // IRON RICH', state: 'UNEXPLORED' as const, moons: [] }, { name: 'DRIFTBAND', type: 'ASTEROID FIELD // HAZARD', state: 'HAZARD' as const, moons: [] }, ] const crew = [ { name: 'CMDR. E. VANCE', role: 'COMMANDER', good: 'STEADY UNDER PRESSURE', bad: 'RIGID — SLOW TO ADAPT' }, { name: 'LT. M. OKONKWO', role: 'PILOT', good: 'RECKLESS COURAGE', bad: 'SHORT FUSE' }, { name: 'DR. I. SORENSEN', role: 'MEDIC', good: 'CALM IN A CRISIS', bad: 'OVERCAUTIOUS' }, { name: 'R. "SPARK" DELACRUZ', role: 'ENGINEER', good: 'FIXES ANYTHING', bad: 'CARELESS WITH FUSES' }, ] const shipSystemCards = [ { name: 'REACTOR', level: 'LV 2', status: 'ACTIVE' as const, actions: ['EXPAND', 'UPGRADE'] }, { name: 'LIFE SUPPORT', level: 'LV 1', status: 'ACTIVE' as const, actions: ['EXPAND', 'UPGRADE'] }, { name: 'NAV COMPUTER', level: 'LV 3', status: 'SCANNING' as const, actions: ['EXPAND', 'UPGRADE'] }, { name: 'WEAPONS', level: 'OFFLINE', status: 'OFFLINE' as const, actions: ['BUILD NEW'] }, { name: 'COMMS ARRAY', level: 'LV 1', status: 'ACTIVE' as const, actions: ['EXPAND', 'UPGRADE'] }, ] const skillCards = [ { name: 'ADVANCED FUSION CORE', unlocks: 'REACTOR LV 4 + OVERCLOCK', state: 'AVAILABLE' as const }, { name: 'HULL PLATING SCHEMATICS', unlocks: 'BUILD ARMOR BAY MODULES', state: 'AVAILABLE' as const }, { name: 'CREW TRAINING PROTOCOLS', unlocks: 'RETRAIN CREW TRAITS', state: 'LOCKED' as const }, { name: 'JUMP DRIVE TUNING', unlocks: 'SHORTER JUMP COOLDOWN', state: 'LOCKED' as const }, ] const encounters = [ { name: 'DERELICT FREIGHTER', when: 'T-07:14', id: '#E-102' }, { name: 'PIRATE SKIRMISH', when: 'T-22:40', id: '#E-103' }, { name: 'ANOMALY FIELD', when: 'T-48:12', id: '#E-104' }, ] const shipData = [ { label: 'TOTAL MODULES', value: '34' }, { label: 'HULL INTEGRITY', value: '87%' }, { label: 'REACTOR OUTPUT', value: '94.2%' }, { label: 'CREW ACTIVE', value: '3 / 6' }, { label: 'SECTOR', value: '7G // DRIFT LANE' }, { label: 'DRIFT VELOCITY', value: '0.4 KM/S' }, { label: 'TURN', value: '12' }, ] const logLines: TerminalLine[] = [ { type: 'system', text: 'SPACEWANDERER // INITIALIZING SHIP SYSTEMS...', timestamp: now() }, { type: 'output', text: 'HULL SCAN COMPLETE — INTEGRITY 87%', timestamp: now() }, { type: 'output', text: 'REACTOR OUTPUT STABLE AT 94.2%', timestamp: now() }, { type: 'output', text: 'CREW MANIFEST LOADED — 3 ACTIVE PERSONNEL', timestamp: now() }, { type: 'warn', text: 'WEAPONS OFFLINE — MODULE NOT INSTALLED', timestamp: now() }, { type: 'system', text: 'ALL SYSTEMS NOMINAL. AWAITING FIRST TURN.', timestamp: now() }, ] export function MissionControl() { const narrow = useNarrow() const [tick, setTick] = useState(0) useEffect(() => { const id = setInterval(() => setTick((t) => t + 1), 1000) return () => clearInterval(id) }, []) const timeStr = new Date().toLocaleTimeString('en-GB', { hour12: false }) return (
{member.role}
MODULE BAY // PLACEHOLDER READOUT
UNLOCKS: {skill.unlocks}