diff --git a/guide/age-of-four/src/App.tsx b/guide/age-of-four/src/App.tsx deleted file mode 100644 index c6962eb6..00000000 --- a/guide/age-of-four/src/App.tsx +++ /dev/null @@ -1,280 +0,0 @@ -import { lazy, Suspense, useState, useCallback, useMemo, type ReactElement } from 'react' -import { Routes, Route, Navigate, useSearchParams } from 'react-router-dom' -import styled from 'styled-components' -import { ThemeProvider } from '@lilith/ui-theme' -import { GuideLayout } from '@/components/layout/GuideLayout' -import { WelcomeModal } from '@/components/welcome/WelcomeModal' -import { EncyclopediaModal } from '@/components/EncyclopediaModal' -import { usePlayerPreferences, type PlayerPreferences, type ColorMode, type FontSize, FONT_SIZE_PX } from '@/hooks/usePlayerPreferences' -import { PreferencesProvider, usePreferences, usePreferencesReroll, type ConcreteRace, type ConcreteGender } from '@/contexts/PreferencesContext' -import { getThemeForPreferences } from '@/theme/fantasy-theme' - -// The Map -const TerrainPage = lazy(() => import('@/pages/TerrainPage')) -const ResourcesPage = lazy(() => import('@/pages/ResourcesPage')) -const MapTypesPage = lazy(() => import('@/pages/MapTypesPage')) - -// Climate & Survival -const ClimateOverviewPage = lazy(() => import('@/pages/ClimateOverviewPage')) -const ClimateEventsPage = lazy(() => import('@/pages/ClimateEventsPage')) -const ClimateTerrainPage = lazy(() => import('@/pages/ClimateTerrainPage')) -const ClimateSimulationPage = lazy(() => import('@/pages/ClimateSimulationPage')) -const SurvivalGuidePage = lazy(() => import('@/pages/SurvivalGuidePage')) -const EcosystemPage = lazy(() => import('@/pages/EcosystemPage')) -const BiomeBrowserPage = lazy(() => import('@/pages/BiomeBrowserPage')) -const SpeciesBrowserPage = lazy(() => import('@/pages/SpeciesBrowserPage')) -const FoodWebPage = lazy(() => import('@/pages/FoodWebPage')) -const PopulationDashboardPage = lazy(() => import('@/pages/PopulationDashboardPage')) - -// Races & Empire -const RacesPage = lazy(() => import('@/pages/RacesPage')) -const GovernmentPage = lazy(() => import('@/pages/GovernmentPage')) -const ErasPage = lazy(() => import('@/pages/ErasPage')) -const VictoryPage = lazy(() => import('@/pages/VictoryPage')) - -// Research -const TechTreePage = lazy(() => import('@/pages/TechTreePage')) -const MagicSchoolsPage = lazy(() => import('@/pages/MagicSchoolsPage')) -const DisciplinesPage = lazy(() => import('@/pages/DisciplinesPage')) - -// Military -const UnitsPage = lazy(() => import('@/pages/UnitsPage')) -const CombatPage = lazy(() => import('@/pages/CombatPage')) -const KeywordsPage = lazy(() => import('@/pages/KeywordsPage')) -const PromotionsPage = lazy(() => import('@/pages/PromotionsPage')) -const ItemsPage = lazy(() => import('@/pages/ItemsPage')) - -// Building Your Empire -const BuildingsPage = lazy(() => import('@/pages/BuildingsPage')) -const ImprovementsPage = lazy(() => import('@/pages/ImprovementsPage')) -const WondersPage = lazy(() => import('@/pages/WondersPage')) -const CommunicationsPage = lazy(() => import('@/pages/CommunicationsPage')) - -// Magic -const SpellsPage = lazy(() => import('@/pages/SpellsPage')) -const ArchonsPage = lazy(() => import('@/pages/ArchonsPage')) -const LeyLinesPage = lazy(() => import('@/pages/LeyLinesPage')) - -// Intro -const HomePage = lazy(() => import('@/pages/HomePage')) -const EarlyAccessPage = lazy(() => import('@/pages/EarlyAccessPage')) -const EarlyAccessProgressPage = lazy(() => import('@/pages/EarlyAccessProgressPage')) -const FullGamePage = lazy(() => import('@/pages/FullGamePage')) -const ExpansionsPage = lazy(() => import('@/pages/ExpansionsPage')) -const ToolsPage = lazy(() => import('@/pages/ToolsPage')) - -// About -const CrowdfundPage = lazy(() => import('@/pages/CrowdfundPage')) -const TeamPage = lazy(() => import('@/pages/TeamPage')) -const EncyclopediaPage = lazy(() => import('@/pages/EncyclopediaPage')) - -// Dev tools (no nav entry — URL only) -const DevSpritesPage = lazy(() => import('@/pages/DevSpritesPage')) - -const DEFAULT_PREFS: PlayerPreferences = { race: 'random', gender: 'random', name: '', colorMode: 'dark', dyslexicFont: false, fontSize: 'md' } - -export default function App(): ReactElement { - const { preferences, isFirstVisit, save } = usePlayerPreferences() - const [searchParams] = useSearchParams() - const skipWelcome = searchParams.get('skip') === 'welcome' - const forceWelcome = searchParams.get('showWelcome') === 'true' - const noGui = (searchParams.get('noGui') ?? searchParams.get('nogui')) === 'true' - const [showWelcome, setShowWelcome] = useState((isFirstVisit || forceWelcome) && !skipWelcome) - - const activePrefs = useMemo( - () => preferences ?? DEFAULT_PREFS, - [preferences], - ) - - const routes = ( - - - } /> - - {/* Intro */} - } /> - } /> - } /> - } /> - } /> - - {/* About */} - } /> - } /> - } /> - } /> - - {/* The Map */} - } /> - } /> - } /> - - {/* Climate & Survival */} - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - {/* Redirects for old climate routes */} - } /> - } /> - } /> - } /> - - {/* Races & Empire */} - } /> - } /> - } /> - } /> - - {/* Research */} - } /> - } /> - } /> - - {/* Military */} - } /> - } /> - } /> - } /> - } /> - - {/* Building Your Empire */} - } /> - } /> - } /> - } /> - - {/* Magic */} - } /> - } /> - } /> - - {/* Dev tools — no nav, URL only */} - } /> - - } /> - - - ) - - if (noGui) { - return ( - - - {routes} - - - - ) - } - - return ( - - - {routes} - - - ) -} - -// ─── RaceThemeProvider ────────────────────────────────────────────────────── -// Accepts optional preview overrides so the settings modal can live-preview -// theme changes before confirming. - -interface ThemePreview { - race: ConcreteRace - gender: ConcreteGender - colorMode: ColorMode - dyslexicFont: boolean - fontSize: FontSize -} - -function RaceThemeProvider({ children, colorMode, dyslexicFont, preview }: { - children: React.ReactNode - colorMode: ColorMode - dyslexicFont: boolean - preview?: ThemePreview | null -}): ReactElement { - const { raceId, gender } = usePreferences() - const themeOverrides = getThemeForPreferences( - preview?.race ?? raceId, - preview?.gender ?? gender, - preview?.colorMode ?? colorMode, - preview?.dyslexicFont ?? dyslexicFont, - ) - - return ( - - {children} - - ) -} - -// ─── AppShell ─────────────────────────────────────────────────────────────── - -interface AppShellProps { - save: (prefs: PlayerPreferences) => void - showWelcome: boolean - setShowWelcome: (v: boolean) => void - preferences: PlayerPreferences - children: React.ReactNode -} - -function AppShell({ save, showWelcome, setShowWelcome, preferences, children }: AppShellProps): ReactElement { - const reroll = usePreferencesReroll() - const [themePreview, setThemePreview] = useState(null) - - const handleConfirm = useCallback((prefs: PlayerPreferences) => { - save(prefs) - setThemePreview(null) - setShowWelcome(false) - }, [save, setShowWelcome]) - - const handleClose = useCallback(() => { - setThemePreview(null) - setShowWelcome(false) - }, [setShowWelcome]) - - const handleOpenSettings = useCallback(() => { - reroll() - setShowWelcome(true) - }, [reroll, setShowWelcome]) - - const handlePreview = useCallback((race: ConcreteRace, gender: ConcreteGender, colorMode: ColorMode, dyslexicFont: boolean, fontSize: FontSize) => { - setThemePreview({ race, gender, colorMode, dyslexicFont, fontSize }) - }, []) - - return ( - - {showWelcome && ( - - )} - - {children} - - - - ) -} - -const NoGuiShell = styled.div` - width: 100vw; - height: 100vh; - overflow: auto; - background: #0D0B14; - color: #e0dcd0; -` diff --git a/guide/age-of-four/src/main.tsx b/guide/age-of-four/src/main.tsx deleted file mode 100644 index 5c39b11e..00000000 --- a/guide/age-of-four/src/main.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { StrictMode } from 'react' -import { createRoot } from 'react-dom/client' -import { BrowserRouter } from 'react-router-dom' -import App from './App' - -createRoot(document.getElementById('root')!).render( - - - - - , -) diff --git a/guide/age-of-four/src/vite-env.d.ts b/guide/age-of-four/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2..00000000 --- a/guide/age-of-four/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -///