'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 { NodeGraph, type NodeGraphEdge, type NodeGraphNode } from '@/components/ui/node-graph' 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' // 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), with // placeholder SpaceWanderer content — no game logic yet. 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' }, ] // WORLD MAP — every node is a solar system, edges are jump routes. const worldMapNodes: NodeGraphNode[] = [ { id: 'kepler', label: 'Kepler Drift', x: 50, y: 48, status: 'ACTIVE', sublabel: 'CURRENT' }, { id: 'vesper', label: 'Vesper Reach', x: 22, y: 26, status: 'NEUTRAL', sublabel: '3 WORLDS' }, { id: 'hollow', label: 'Hollow Gate', x: 74, y: 20, status: 'NEUTRAL', sublabel: '5 WORLDS' }, { id: 'cinder', label: 'Cinder Field', x: 86, y: 56, status: 'WARNING', sublabel: 'RADIATION' }, { id: 'lantern', label: 'Lantern Void', x: 30, y: 74, status: 'NEUTRAL', sublabel: '2 WORLDS' }, { id: 'sable', label: 'Sable Reach', x: 8, y: 46, status: 'OFFLINE', sublabel: 'UNKNOWN' }, { id: 'orpheus', label: 'Orpheus Deep', x: 52, y: 10, status: 'NEUTRAL', sublabel: '7 WORLDS' }, { id: 'mire', label: 'Mire Station', x: 68, y: 84, status: 'ACTIVE', sublabel: 'OUTPOST' }, { id: 'thalassa', label: 'Thalassa Bend', x: 12, y: 86, status: 'NEUTRAL', sublabel: '4 WORLDS' }, { id: 'kuiper', label: 'Kuiper Shard', x: 90, y: 30, status: 'CRITICAL', sublabel: 'WARZONE' }, ] const worldMapEdges: NodeGraphEdge[] = [ { from: 'kepler', to: 'vesper', animated: true }, { from: 'kepler', to: 'hollow', label: 'JUMP-2' }, { from: 'kepler', to: 'lantern', animated: true }, { from: 'kepler', to: 'mire' }, { from: 'vesper', to: 'orpheus' }, { from: 'hollow', to: 'kuiper', label: 'JUMP-1' }, { from: 'cinder', to: 'kuiper' }, { from: 'lantern', to: 'thalassa' }, { from: 'sable', to: 'vesper' }, { from: 'mire', to: 'cinder' }, ] // LOCAL SYSTEM — the current system (regenerated per save after each jump, later). const localSystemNodes: NodeGraphNode[] = [ { id: 'star', label: 'Kepler-442', x: 50, y: 50, status: 'ACTIVE', sublabel: 'G2 STAR' }, { id: 'aurelle', label: 'Aurelle', x: 18, y: 30, status: 'ACTIVE', sublabel: 'TERRESTRIAL' }, { id: 'brimstone', label: 'Brimstone', x: 76, y: 24, status: 'NEUTRAL', sublabel: 'GAS GIANT' }, { id: 'ashfall', label: 'Ashfall', x: 90, y: 52, status: 'WARNING', sublabel: 'MOON' }, { id: 'cinderrock', label: 'Cinderrock', x: 74, y: 80, status: 'NEUTRAL', sublabel: 'ROCKY' }, { id: 'driftband', label: 'Driftband', x: 30, y: 78, status: 'WARNING', sublabel: 'ASTEROID RING' }, { id: 'palemoon', label: 'Palemoon', x: 8, y: 54, status: 'NEUTRAL', sublabel: 'MOON' }, ] const localSystemEdges: NodeGraphEdge[] = [ { from: 'star', to: 'aurelle' }, { from: 'star', to: 'brimstone' }, { from: 'brimstone', to: 'ashfall', label: 'MOON' }, { from: 'star', to: 'cinderrock' }, { from: 'star', to: 'driftband' }, { from: 'aurelle', to: 'palemoon', label: 'MOON' }, ] const explorablePlanets = [ { name: 'AURELLE', type: 'TERRESTRIAL // OCEAN CONTINENTS', state: 'UNEXPLORED' as const }, { name: 'BRIMSTONE', type: 'GAS GIANT // CLOUD DECKS', state: 'SCANNED' as const }, { name: 'ASHFALL (MOON)', type: 'VOLCANIC MOON // SULFUR VEINS', state: 'UNEXPLORED' as const }, { name: 'CINDERROCK', type: 'ROCKY // IRON RICH', state: 'UNEXPLORED' as const }, { name: 'DRIFTBAND', type: 'ASTEROID FIELD // HAZARD', state: 'HAZARD' as const }, ] 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 (
{/* ── HEADER ── */}
◄ SHIP │

SPACEWANDERER

{!narrow && ( // SHIP STATUS // CREW MANIFEST )}
{!narrow && ( SHIP NOMINAL )} SECTOR SCAN {timeStr}
{/* ── BODY ── */}
{/* STAT CARDS — placeholder ship readouts */}
{/* 3-COLUMN GRID */}
{/* ── LEFT: SHIP SYSTEMS + VESSEL METRICS (mirrors the SHIP SYSTEMS tab) ── */}
SHIP SYSTEMS
4 ONLINE
VESSEL METRICS
{/* ── CENTER: GAME TEMPLATE TABS (visual only — no handlers, placeholder data) ── */}
OPERATIONS // SHIP COMMAND
SYS NOMINAL
WORLD MAP LOCAL SYSTEM CREW SHIP SYSTEMS SKILL TREE MISSIONS EVENT LOG {/* WORLD MAP TAB */} {/* LOCAL SYSTEM TAB */}
EXPLORABLE WORLDS // FIND THINGS HERE (PLACEHOLDER)
{explorablePlanets.map((planet, i) => (
{planet.name}
{planet.type}
{planet.state}
))}
{/* CREW TAB */}
{crew.map((member) => (
{member.name} ACTIVE

{member.role}

+ {member.good}
- {member.bad}
))}
{/* SHIP SYSTEMS TAB */}
{shipSystemCards.map((system) => (
{system.name} {system.level}

MODULE BAY // PLACEHOLDER READOUT

{system.actions.map((action) => ( ))}
))}
{/* SKILL TREE TAB */}
{skillCards.map((skill) => (
{skill.name} {skill.state}

UNLOCKS: {skill.unlocks}

))}
{/* MISSIONS TAB */}
ENCOUNTER #E-102 — DERELICT FREIGHTER Placeholder briefing. Real encounter resolution lands with the turn engine.
{[ { label: 'DESTINATION', value: 'SECTOR 7G // DRIFT LANE' }, { label: 'ETA', value: 'T-07:14 (PLACEHOLDER)' }, { label: 'THREAT LEVEL', value: 'LOW — UNMANNED' }, { label: 'CARGO MANIFEST', value: 'UNKNOWN' }, ].map((item) => (
{item.label}
{item.value}
))}
{/* EVENT LOG TAB */}
{/* ── RIGHT: UPCOMING ENCOUNTERS + SHIP DATA ── */}
UPCOMING ENCOUNTERS
{encounters.length} QUEUED
{encounters.map((enc, i) => { const isNext = i === 0 const isLast = i === encounters.length - 1 return (
{enc.name}
{enc.when} // {enc.id}
{isNext ? 'NEXT' : 'SCHED'}
) })}
SHIP DATA
{shipData.map((item, i) => (
{item.label} {item.value}
))}
{/* ── FOOTER ── */}
) }