Changes
This commit is contained in:
@@ -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) => {
|
||||
<span className="font-pixel text-sm text-foreground/90">CRT Effects</span>
|
||||
</div>
|
||||
<button
|
||||
onClick={() => handleToggle(setCrtEnabled, crtEnabled)}
|
||||
onClick={() => handleToggle(setCrtEnabled, crtEnabled, 'crt_toggler')}
|
||||
className={`w-12 h-6 rounded-full border border-primary transition-all duration-300 ${
|
||||
crtEnabled ? 'bg-primary' : 'bg-transparent'
|
||||
}`}
|
||||
@@ -93,7 +96,7 @@ const SettingsPanel = ({ onToggleTheme, isRedTheme }: SettingsPanelProps) => {
|
||||
<span className="font-pixel text-sm text-foreground/90">Sound Effects</span>
|
||||
</div>
|
||||
<button
|
||||
onClick={() => handleToggle(setSoundEnabled, soundEnabled)}
|
||||
onClick={() => handleToggle(setSoundEnabled, soundEnabled, 'sound_toggler')}
|
||||
className={`w-12 h-6 rounded-full border border-primary transition-all duration-300 ${
|
||||
soundEnabled ? 'bg-primary' : 'bg-transparent'
|
||||
}`}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { useNavigate } from 'react-router-dom';
|
||||
import { motion, AnimatePresence } from 'framer-motion';
|
||||
import { Terminal, X } from 'lucide-react';
|
||||
import { useSettings } from '@/contexts/SettingsContext';
|
||||
import { useAchievements } from '@/contexts/AchievementsContext';
|
||||
|
||||
const commands: Record<string, string> = {
|
||||
'/home': '/',
|
||||
@@ -24,6 +25,8 @@ const commands: Record<string, string> = {
|
||||
'/m': '/music',
|
||||
'/ai': '/ai',
|
||||
'/chat': '/ai',
|
||||
'/achievements': '/achievements',
|
||||
'/ach': '/achievements',
|
||||
};
|
||||
|
||||
const helpText = `Available commands:
|
||||
@@ -41,7 +44,9 @@ const helpText = `Available commands:
|
||||
/music, /m - Navigate to Music Player
|
||||
/ai, /chat - Navigate to AI Chat
|
||||
/help, /h - Show this help message
|
||||
/clear, /c - Clear terminal output`;
|
||||
/clear, /c - Clear terminal output
|
||||
|
||||
...there may be other commands.`;
|
||||
|
||||
const TerminalCommand = () => {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
@@ -51,6 +56,7 @@ const TerminalCommand = () => {
|
||||
const outputRef = useRef<HTMLDivElement>(null);
|
||||
const navigate = useNavigate();
|
||||
const { playSound } = useSettings();
|
||||
const { unlockAchievement } = useAchievements();
|
||||
|
||||
useEffect(() => {
|
||||
if (isOpen && inputRef.current) {
|
||||
@@ -103,10 +109,14 @@ const TerminalCommand = () => {
|
||||
|
||||
playSound('click');
|
||||
setOutput(prev => [...prev, `> ${input}`]);
|
||||
|
||||
// Unlock terminal user achievement
|
||||
unlockAchievement('terminal_user');
|
||||
|
||||
if (trimmedInput === '/help' || trimmedInput === '/h') {
|
||||
setOutput(prev => [...prev, helpText]);
|
||||
} else if (trimmedInput === '/hint') {
|
||||
unlockAchievement('hint_seeker');
|
||||
setOutput(prev => [...prev,
|
||||
'Hidden feature detected in system...',
|
||||
'Hint: Old-school gamers know a certain cheat code.',
|
||||
|
||||
Reference in New Issue
Block a user