lol
This commit is contained in:
parent
fd393c8d89
commit
eb2308dda4
1 changed files with 19 additions and 3 deletions
22
src/App.tsx
22
src/App.tsx
|
@ -9,9 +9,17 @@ type Tier = {
|
|||
};
|
||||
|
||||
const TIERS: Tier[] = [
|
||||
{ name: 'Start', unlockPrice: 0, buyPrice: 1 },
|
||||
{ name: 'Bronze', unlockPrice: 2, buyPrice: 3 },
|
||||
{ name: 'Silver', unlockPrice: 5, buyPrice: 7 },
|
||||
{ name: 'Gold', unlockPrice: 10, buyPrice: 15 },
|
||||
{ name: 'Platinum', unlockPrice: 20, buyPrice: 30 },
|
||||
{ name: 'Diamond', unlockPrice: 50, buyPrice: 75 },
|
||||
{ name: 'Master', unlockPrice: 100, buyPrice: 150 },
|
||||
{ name: 'Legend', unlockPrice: 200, buyPrice: 300 },
|
||||
{ name: 'Ultimate', unlockPrice: 500, buyPrice: 750 },
|
||||
{ name: 'Champion', unlockPrice: 1000, buyPrice: 1500 },
|
||||
{ name: 'Supreme', unlockPrice: 2000, buyPrice: 3000 },
|
||||
];
|
||||
|
||||
function App() {
|
||||
|
@ -19,8 +27,6 @@ function App() {
|
|||
const [money, setMoney] = useState(20); // User starts with $20
|
||||
const [unlockedTiers, setUnlockedTiers] = useState<string[]>([]); // Unlocked tier names
|
||||
// Remove selectedTier state
|
||||
// const [selectedTier, setSelectedTier] = useState<string | null>(null); // Currently selected tier
|
||||
const [count, setCount] = useState(0)
|
||||
|
||||
// --- Card State ---
|
||||
const [card, setCard] = useState<{
|
||||
|
@ -89,12 +95,22 @@ function App() {
|
|||
}
|
||||
}, [card]);
|
||||
|
||||
// --- Card Disappear After All Scratched ---
|
||||
React.useEffect(() => {
|
||||
if (!card) return;
|
||||
const allScratched = card.fields.every(f => f.scratched);
|
||||
if (allScratched) {
|
||||
const timeout = setTimeout(() => setCard(null), 1500);
|
||||
return () => clearTimeout(timeout);
|
||||
}
|
||||
}, [card]);
|
||||
|
||||
// --- UI ---
|
||||
return (
|
||||
<div className="min-h-screen bg-gray-100 flex flex-col items-center justify-center">
|
||||
<h1 className="text-3xl font-bold text-blue-600 mb-2">Scratch Card Game</h1>
|
||||
<div className="mb-4 text-lg">Money: <span className="font-mono font-bold">${money}</span></div>
|
||||
<div className="flex gap-6 mb-8">
|
||||
<div className="flex flex-wrap gap-6 mb-8 justify-center">
|
||||
{TIERS.map((tier) => {
|
||||
const unlocked = unlockedTiers.includes(tier.name);
|
||||
return (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue