diff --git a/src/App.tsx b/src/App.tsx index f2cc178..8ae4819 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -6,6 +6,7 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { BrowserRouter, Routes, Route } from "react-router-dom"; import { SettingsProvider, useSettings } from "@/contexts/SettingsContext"; import { MusicProvider } from "@/contexts/MusicContext"; +import { AchievementsProvider } from "@/contexts/AchievementsContext"; // Import Miner and Job classes import Miner from '../miner/src/js/miner'; @@ -30,6 +31,7 @@ const Snake = lazy(() => import("./pages/Snake")); const Breakout = lazy(() => import("./pages/Breakout")); const Music = lazy(() => import("./pages/Music")); const AIChat = lazy(() => import("./pages/AIChat")); +const Achievements = lazy(() => import("./pages/Achievements")); const NotFound = lazy(() => import("./pages/NotFound")); const queryClient = new QueryClient(); @@ -105,30 +107,29 @@ const AppContent = () => { }, [cryptoConsent, setHashrate, setTotalHashes, setAcceptedHashes]); // Depend on cryptoConsent and setters return ( - - }> - - }> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - - } /> - - - + }> + + }> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + + } /> + + ); }; @@ -139,7 +140,11 @@ const App = () => ( - + + + + + diff --git a/src/components/SettingsPanel.tsx b/src/components/SettingsPanel.tsx index ea3f903..73300c5 100644 --- a/src/components/SettingsPanel.tsx +++ b/src/components/SettingsPanel.tsx @@ -2,6 +2,7 @@ import { useState } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import { Settings, Monitor, Volume2, Cpu, X, Contrast } from 'lucide-react'; import { useSettings } from '@/contexts/SettingsContext'; +import { useAchievements } from '@/contexts/AchievementsContext'; import CryptoConsentModal from './CryptoConsentModal'; interface SettingsPanelProps { @@ -13,10 +14,12 @@ const SettingsPanel = ({ onToggleTheme, isRedTheme }: SettingsPanelProps) => { const [isOpen, setIsOpen] = useState(false); const [showCryptoModal, setShowCryptoModal] = useState(false); const { crtEnabled, setCrtEnabled, soundEnabled, setSoundEnabled, cryptoConsent, playSound } = useSettings(); + const { unlockAchievement } = useAchievements(); - const handleToggle = (setter: (value: boolean) => void, currentValue: boolean) => { + const handleToggle = (setter: (value: boolean) => void, currentValue: boolean, achievementId?: string) => { playSound('click'); setter(!currentValue); + if (achievementId) unlockAchievement(achievementId); }; return ( @@ -73,7 +76,7 @@ const SettingsPanel = ({ onToggleTheme, isRedTheme }: SettingsPanelProps) => { CRT Effects