From a3288e2a31ec8e8cdaa9d1f81298b9b942d47c93 Mon Sep 17 00:00:00 2001
From: Mantasha Altab Noyela <30403205+MantashaNoyela@users.noreply.github.com>
Date: Tue, 25 Feb 2025 22:20:02 -0800
Subject: [PATCH 1/3] Update index.tsx
---
app/index.tsx | 36 +++++++++++++++++-------------------
1 file changed, 17 insertions(+), 19 deletions(-)
diff --git a/app/index.tsx b/app/index.tsx
index 1620b18..c187422 100644
--- a/app/index.tsx
+++ b/app/index.tsx
@@ -38,25 +38,23 @@ const IndexScreen = () => {
return (
- Poker Chip Helper
-
-
-
-
-
+
+
+
+
+
+ handleSave("SLOT1")} disabled={buyInAmount === null} />
+ handleSave("SLOT2")} disabled={buyInAmount === null} />
+
);
};
From cb44965e3063dd67b4ad7340b72b946bcd4e00a1 Mon Sep 17 00:00:00 2001
From: Mantasha Altab Noyela <30403205+MantashaNoyela@users.noreply.github.com>
Date: Tue, 25 Feb 2025 23:13:57 -0800
Subject: [PATCH 2/3] Update index.tsx
I have updated the index file
---
app/index.tsx | 55 ++++++++++++++++++++++++++++++++-------------------
1 file changed, 35 insertions(+), 20 deletions(-)
diff --git a/app/index.tsx b/app/index.tsx
index c187422..2da8b34 100644
--- a/app/index.tsx
+++ b/app/index.tsx
@@ -1,17 +1,39 @@
-import React, { useState } from "react";
-import { ScrollView, Text, Alert, Button, View, StyleSheet } from "react-native";
+import React, { useState, useEffect } from "react";
+import { ScrollView, 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";
-import { saveState, loadState } from "../components/CalculatorState";
+import ChipDetection from "@/components/ChipDetection";
+import { saveState, loadState } from "@/components/CalculatorState";
-const IndexScreen = () => {
+export enum COLORS {
+ "white",
+ "red",
+ "green",
+ "blue",
+ "black",
+}
+
+const IndexScreen: React.FC = () => {
const [playerCount, setPlayerCount] = useState(2);
- const [buyInAmount, setBuyInAmount] = useState(null);
+ const [buyInAmount, setBuyInAmount] = useState(20);
const [numberOfChips, setNumberOfChips] = useState(5);
const [totalChipsCount, setTotalChipsCount] = useState([]);
+ useEffect(() => {
+ const loadSavedState = async () => {
+ const savedState = await loadState("SLOT1"); // Default loading from SLOT1
+ if (savedState) {
+ setPlayerCount(savedState.playerCount);
+ setBuyInAmount(savedState.buyInAmount);
+ setNumberOfChips(savedState.numberOfChips);
+ setTotalChipsCount(savedState.totalChipsCount);
+ }
+ };
+ loadSavedState();
+ }, []);
+
const handleSave = async (slot: "SLOT1" | "SLOT2") => {
if (buyInAmount === null) {
Alert.alert("Error", "Please select a valid buy-in amount");
@@ -35,9 +57,13 @@ const IndexScreen = () => {
}
};
+ const updateChipCount = (chipData: { [color: string]: number }) => {
+ const chipCountArray = Object.values(chipData);
+ setTotalChipsCount(chipCountArray);
+ };
+
return (
-
-
+
@@ -54,21 +80,10 @@ const IndexScreen = () => {
/>
handleSave("SLOT1")} disabled={buyInAmount === null} />
handleSave("SLOT2")} disabled={buyInAmount === null} />
+ handleLoad("SLOT1")} />
+ handleLoad("SLOT2")} />
-
);
};
-const styles = StyleSheet.create({
- container: {
- flex: 1,
- },
- title: {
- fontSize: 24,
- marginBottom: 30,
- marginTop: 50,
- textAlign: "center",
- },
-});
-
export default IndexScreen;
From 9512d9244884762cde8b6431ac57a8eb77d5cf91 Mon Sep 17 00:00:00 2001
From: Mantasha Altab Noyela <30403205+MantashaNoyela@users.noreply.github.com>
Date: Tue, 25 Feb 2025 23:21:05 -0800
Subject: [PATCH 3/3] Update package.json
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index d4a3a3c..e45e9a8 100644
--- a/package.json
+++ b/package.json
@@ -22,7 +22,7 @@
"@react-native-async-storage/async-storage": "^2.1.1",
"@react-navigation/bottom-tabs": "7.2.0",
"@react-navigation/native": "7.0.14",
- "expo": "^52.0.37",
+ "expo": "52.0.37",
"expo-blur": "14.0.3",
"expo-constants": "17.0.7",
"expo-file-system": "18.0.11",