From 60bbda3d853f8cff39db6a338c115f1d211697a5 Mon Sep 17 00:00:00 2001 From: billy Date: Sun, 30 Mar 2025 03:26:57 -0400 Subject: [PATCH] Enhance ResourceDisplay to include player level and progress to next level. Updated UI to show level indicators and a progress bar, improving user feedback on advancement. --- src/components/ResourceDisplay.tsx | 54 ++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/src/components/ResourceDisplay.tsx b/src/components/ResourceDisplay.tsx index c7c75a9..f4ffb42 100644 --- a/src/components/ResourceDisplay.tsx +++ b/src/components/ResourceDisplay.tsx @@ -1,12 +1,17 @@ -import { Box, HStack, Text } from '@chakra-ui/react' +import { Box, HStack, Text, Progress, VStack } from '@chakra-ui/react' import { useGameStore } from '../store/gameStore' export function ResourceDisplay() { - const { points, techParts, pointsPerSecond, techPartsPerSecond, clickPower, getTotalMultiplier, activeMultipliers } = useGameStore() + const { points, techParts, pointsPerSecond, techPartsPerSecond, clickPower, getTotalMultiplier, activeMultipliers, playerLevel } = useGameStore() const totalMultiplier = getTotalMultiplier() const actualClickPower = clickPower * totalMultiplier + // Calculate progress to next level + const currentLevelPPS = Math.pow(10, playerLevel - 1) + const nextLevelPPS = Math.pow(10, playerLevel) + const progress = ((pointsPerSecond - currentLevelPPS) / (nextLevelPPS - currentLevelPPS)) * 100 + return ( - - - Points - {Math.floor(points)} - +{pointsPerSecond}/s - Click Power: {actualClickPower} - {activeMultipliers.length > 0 && ( - {totalMultiplier}x Active - )} + + + + Points + {Math.floor(points)} + +{pointsPerSecond}/s + Click Power: {actualClickPower} + {activeMultipliers.length > 0 && ( + {totalMultiplier}x Active + )} + + + Tech Parts + {Math.floor(techParts)} + +{techPartsPerSecond}/s + + + + + Level {playerLevel} + Level {playerLevel + 1} + + - - Tech Parts - {Math.floor(techParts)} - +{techPartsPerSecond}/s - - + ) } \ No newline at end of file