diff --git a/src/App.tsx b/src/App.tsx index f0d1435..1ace027 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,7 +1,4 @@ import { useState } from 'react' -import reactLogo from './assets/react.svg' -import viteLogo from '/vite.svg' -// import './App.css' // Removed, now using TailwindCSS import React from 'react'; // Added for useEffect // --- Scratch Card Game Types and State --- @@ -21,7 +18,8 @@ function App() { // --- Game State --- const [money, setMoney] = useState(20); // User starts with $20 const [unlockedTiers, setUnlockedTiers] = useState([]); // Unlocked tier names - const [selectedTier, setSelectedTier] = useState(null); // Currently selected tier + // Remove selectedTier state + // const [selectedTier, setSelectedTier] = useState(null); // Currently selected tier const [count, setCount] = useState(0) // --- Card State --- @@ -48,17 +46,16 @@ function App() { }; // --- Tier Select Logic --- - const handleSelectTier = (tier: Tier) => { - if (unlockedTiers.includes(tier.name)) { - setSelectedTier(tier.name); - } - }; + // Remove handleSelectTier + // const handleSelectTier = (tier: Tier) => { + // if (unlockedTiers.includes(tier.name)) { + // setSelectedTier(tier.name); + // } + // }; - // --- Buy Card Logic --- - const handleBuyCard = () => { - if (!selectedTier) return; - const tier = TIERS.find((t) => t.name === selectedTier); - if (!tier || money < tier.buyPrice) return; + // Update handleBuyCard to accept tier as argument + const handleBuyCard = (tier: Tier) => { + if (!unlockedTiers.includes(tier.name) || money < tier.buyPrice) return; // Generate 3 unique winning numbers (1-9) const winningNumbers: number[] = []; while (winningNumbers.length < 3) { @@ -115,10 +112,11 @@ function App() { ) : ( )} @@ -126,55 +124,13 @@ function App() { })} {/* Tier Info and Card Summary */} - {selectedTier && ( -
- Selected Tier: {selectedTier} | - Unlock: ${TIERS.find(t => t.name === selectedTier)?.unlockPrice} | - Buy: ${TIERS.find(t => t.name === selectedTier)?.buyPrice} -
- )} + {/* Remove all selectedTier-dependent UI (selected tier info, buy button outside tier cards, etc.) */} {card && (
Winnings this card: ${card.fields.reduce((sum, f) => sum + (f.won || 0), 0)}
)} - {/* Play History */} - {history.length > 0 && ( -
-
Play History
-
    - {history.map((h, i) => ( -
  • -
    - {h.tier} - Win: ${h.winnings} -
    -
    - {h.winningNumbers.map((n, j) => ( - {n} - ))} -
    -
    - {h.fields.map((n, j) => ( - {n} - ))} -
    -
  • - ))} -
-
- )} - {/* Card Buy Button */} - {selectedTier && ( - - )} {/* Card UI */} {card && (
@@ -221,6 +177,32 @@ function App() {
Scratch each field one at a time. Winnings: 1-2 = 50%, 3-4 = 80%, 5-6 = 120% of card price.
)} + {/* Play History */} + {history.length > 0 && ( +
+
Play History
+
    + {history.map((h, i) => ( +
  • +
    + {h.tier} + Win: ${h.winnings} +
    +
    + {h.winningNumbers.map((n, j) => ( + {n} + ))} +
    +
    + {h.fields.map((n, j) => ( + {n} + ))} +
    +
  • + ))} +
+
+ )} ) }