From 8c76523f1239aa4a079295a6db97d1403a5dd5f5 Mon Sep 17 00:00:00 2001 From: billy Date: Sun, 30 Mar 2025 05:50:24 -0400 Subject: [PATCH] Enhance App layout with logo and updated click handling. Introduced logo image and improved text prompts for user interaction. Refactored BuildingButton to streamline disabled state styling and added tooltip for ResetButton with icon representation. --- src/App.tsx | 41 +++++++++++++++++++------------ src/components/BuildingButton.tsx | 17 +++++++------ src/components/ResetButton.tsx | 23 ++++++++++------- 3 files changed, 48 insertions(+), 33 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index f9733a5..6553b51 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -13,10 +13,13 @@ import { VStack, SimpleGrid, Button, - Flex + Flex, + Image, + Center } from '@chakra-ui/react' import theme from './theme' import { useEffect } from 'react' +import logoImg from './assets/logo.png' type BuildingId = 'mouseFarms' | 'keyboardFactories' | 'monitorDisplays' | 'officeSpace' | 'serverRooms' | 'dataCenters' | 'dataCities' | 'dataCountries' | 'dataContinents' | 'dataWorlds' | 'dataMoons' | @@ -117,13 +120,7 @@ function App() { // 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 - } + // All clicks count now! click() } @@ -140,18 +137,29 @@ function App() { - - - Clicker Clicker 2 - + + + + Clicker Clicker 2 + + + Click anywhere to start (and then scroll down) + - Level {playerLevel} + + {/* Reset button positioned in the top right */} + + + {/* Shop Section */} - Shop + + Shop + Level {playerLevel} + {availableBuildings.map((building) => ( diff --git a/src/components/BuildingButton.tsx b/src/components/BuildingButton.tsx index 7f72b00..045b7ab 100644 --- a/src/components/BuildingButton.tsx +++ b/src/components/BuildingButton.tsx @@ -74,7 +74,7 @@ export function BuildingButton({ const { points, playerLevel, upgradeBuilding } = useGameStore() const canAfford = points >= cost const meetsLevelRequirement = playerLevel >= levelRequirement - const isDisabled = !canAfford || !meetsLevelRequirement + const isDisabledStyle = !canAfford || !meetsLevelRequirement // Calculate upgrade cost const calculateUpgradeCost = (currentLevel: number): number => { @@ -124,7 +124,7 @@ export function BuildingButton({ {title} - {/* Overlay for owned and level */} + {/* Overlay for owned count */} - - Owned: {owned} - Level: {level} - + Owned: {owned} @@ -150,7 +147,9 @@ export function BuildingButton({ + + 🔄} + onClick={onOpen} + colorScheme="red" + size="md" + variant="ghost" + borderRadius="full" + /> +