From bd917c96cb5b847bf81d1b3b608d9a46aadac321 Mon Sep 17 00:00:00 2001 From: MantashaNoyela Date: Tue, 11 Feb 2025 13:47:22 -0800 Subject: [PATCH] Implemented Chip Distribution and Test code for this. --- app/index.tsx | 19 +++-- components/ChipDistributionSummary.tsx | 85 +++++++++++++++++++ .../ChipDistributionSummary.test.tsx | 65 ++++++++++++++ tsconfig.json | 1 + 4 files changed, 162 insertions(+), 8 deletions(-) create mode 100644 components/ChipDistributionSummary.tsx create mode 100644 components/__tests__/ChipDistributionSummary.test.tsx diff --git a/app/index.tsx b/app/index.tsx index 2f107b4..eb5f1b3 100644 --- a/app/index.tsx +++ b/app/index.tsx @@ -3,39 +3,43 @@ import { ScrollView, Text, Alert, Button } from "react-native"; import PlayerSelector from "@/components/PlayerSelector"; import BuyInSelector from "@/components/BuyInSelector"; import ChipsSelector from "@/components/ChipsSelector"; - +import ChipDistributionSummary from "@/components/ChipDistributionSummary"; const IndexScreen = () => { const [playerCount, setPlayerCount] = useState(2); const [buyInAmount, setBuyInAmount] = useState(null); const [numberOfChips, setNumberOfChips] = useState(5); const [totalChipsCount, setTotalChipsCount] = useState([]); - const handleSave = () => { if (buyInAmount === null) { Alert.alert("Error", "Please select a valid buy-in amount"); + } else { + Alert.alert( + "Success", + `Buy-in amount set to ${buyInAmount} for ${playerCount} players` + ); } }; - return ( Poker Chip Helper - - - - +