import { ResourceDisplay } from './components/ResourceDisplay' import { BuildingButton } from './components/BuildingButton' import { MultiplierShop } from './components/MultiplierShop' import { NextBuildingPreview } from './components/NextBuildingPreview' import { ResetButton } from './components/ResetButton' import { useGameStore } from './store/gameStore' import { ChakraProvider, Box, Container, Heading, Text, VStack, SimpleGrid, Button, Flex } from '@chakra-ui/react' import theme from './theme' import { useEffect } from 'react' type BuildingId = 'mouseFarms' | 'keyboardFactories' | 'monitorDisplays' | 'officeSpace' | 'serverRooms' | 'dataCenters' | 'dataCities' | 'dataCountries' | 'dataContinents' | 'dataWorlds' | 'dataMoons' | 'dataSolarSystems' | 'dataGalaxies' | 'dataUniverses' | 'dataGods' type BuildingLevelKey = `${BuildingId}Level` const BUILDING_INFO = { mouseFarms: { title: 'Mouse Farm', description: 'A basic facility that produces computer mice. Each mouse farm generates points automatically.', production: { points: 0.1 } }, keyboardFactories: { title: 'Keyboard Factory', description: 'Manufactures mechanical keyboards and generates tech parts. Essential for advanced upgrades.', production: { techParts: 0.05 } }, monitorDisplays: { title: 'Monitor Display', description: 'High-resolution displays that generate both points and tech parts. A balanced production facility.', production: { points: 0.2, techParts: 0.1 } }, serverRooms: { title: 'Server Room', description: 'A powerful facility that generates significant amounts of both resources. Requires proper cooling.', production: { points: 1, techParts: 0.5 } }, dataCenters: { title: 'Data Center', description: 'The ultimate production facility. Generates massive amounts of resources but requires significant investment.', production: { points: 5, techParts: 2 } }, dataCities: { title: 'Data City', description: 'A massive network of data centers spanning an entire city. Requires level 5 to unlock.', production: { points: 25, techParts: 10 } }, dataCountries: { title: 'Data Country', description: 'A country-wide network of data cities. Requires level 10 to unlock.', production: { points: 100, techParts: 40 } }, dataContinents: { title: 'Data Continent', description: 'A continent-spanning network of data countries. Requires level 20 to unlock.', production: { points: 500, techParts: 200 } }, dataWorlds: { title: 'Data World', description: 'A world-wide network of data continents. Requires level 30 to unlock.', production: { points: 2500, techParts: 1000 } }, dataMoons: { title: 'Data Moon', description: 'A moon-sized data processing facility. Requires level 40 to unlock.', production: { points: 10000, techParts: 4000 } }, dataSolarSystems: { title: 'Data Solar System', description: 'A solar system-wide network of data moons. Requires level 50 to unlock.', production: { points: 50000, techParts: 20000 } }, dataGalaxies: { title: 'Data Galaxy', description: 'A galaxy-spanning network of data solar systems. Requires level 60 to unlock.', production: { points: 250000, techParts: 100000 } }, dataUniverses: { title: 'Data Universe', description: 'A universe-wide network of data galaxies. Requires level 70 to unlock.', production: { points: 1000000, techParts: 400000 } }, dataGods: { title: 'Data God', description: 'The ultimate data processing entity. Requires level 80 to unlock.', production: { points: 5000000, techParts: 2000000 } } } function App() { const { points, playerLevel, getAvailableBuildings, tick, clickPower, click } = useGameStore() const availableBuildings = getAvailableBuildings() // Set up game tick interval useEffect(() => { const interval = setInterval(tick, 100) // 100ms = 10 ticks per second return () => clearInterval(interval) }, [tick]) // Handle clicks anywhere in the game const handleClick = (e: React.MouseEvent) => { // Don't count clicks on buttons or interactive elements if (e.target instanceof HTMLElement && (e.target.tagName === 'BUTTON' || e.target.closest('button') || e.target.closest('[role="button"]'))) { return } click() } return ( Clicker Clicker 2 Level {playerLevel} {/* Shop Section */} Shop {availableBuildings.map((building) => ( useGameStore.getState().buyBuilding(building.id as BuildingId)} description={building.description} production={building.production} buildingType={building.id} levelRequirement={building.levelRequirement} /> ))} {/* Upgrades Section */} Upgrades Click Power Level {clickPower} Each click generates {clickPower} points ) } export default App