import React, { useState, useEffect } from 'react'; import { Home, ClipboardList, Users, Wallet } from 'lucide-react'; const FARMING_DURATION = 20; // 20 seconds const FARMING_REWARD = 10000; const MobileCryptoGameInterface = () => { const [balance, setBalance] = useState(150508); const [farmingState, setFarmingState] = useState('idle'); // 'idle', 'farming', 'ready' const [remainingTime, setRemainingTime] = useState(FARMING_DURATION); useEffect(() => { let timer; if (farmingState === 'farming' && remainingTime > 0) { timer = setInterval(() => { setRemainingTime(prev => prev - 1); }, 1000); } else if (remainingTime === 0 && farmingState === 'farming') { setFarmingState('ready'); } return () => clearInterval(timer); }, [farmingState, remainingTime]); useEffect(() => { if (farmingState === 'ready') { const autoCollectTimer = setTimeout(() => { collectReward(); }, 5000); // Auto collect after 5 seconds if user doesn't click return () => clearTimeout(autoCollectTimer); } }, [farmingState]); const startFarming = () => { setFarmingState('farming'); setRemainingTime(FARMING_DURATION); }; const collectReward = () => { setBalance(prev => prev + FARMING_REWARD); setFarmingState('idle'); // Automatically start farming again after a short delay setTimeout(startFarming, 1000); }; return (
Cat with coin logo
کاربر
₿ {balance.toLocaleString()}
Drop game 🍃
{farmingState === 'idle' && ( )} {farmingState === 'farming' && (
Mining in progress
{remainingTime} seconds
)} {farmingState === 'ready' && ( )}
); }; const NavButton = ({ icon, label }) => ( ); export default MobileCryptoGameInterface;