This commit is contained in:
gpt-engineer-app[bot]
2026-01-10 23:17:48 +00:00
parent 33c5bcb302
commit d4f75700f4
+8 -4
View File
@@ -1,5 +1,5 @@
import { useState, useRef, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import { useNavigate, useLocation } from 'react-router-dom';
import { motion, AnimatePresence } from 'framer-motion';
import { Terminal, X } from 'lucide-react';
import { useSettings } from '@/contexts/SettingsContext';
@@ -70,9 +70,13 @@ const TerminalCommand = () => {
const inputRef = useRef<HTMLInputElement>(null);
const outputRef = useRef<HTMLDivElement>(null);
const navigate = useNavigate();
const location = useLocation();
const { playSound } = useSettings();
const { unlockAchievement } = useAchievements();
// Check if user is on a game page
const isOnGamePage = location.pathname.startsWith('/games/');
useEffect(() => {
if (isOpen && inputRef.current) {
inputRef.current.focus();
@@ -98,8 +102,8 @@ const TerminalCommand = () => {
playSound('beep');
}
// Open terminal when pressing "/" (only if not in input)
if (e.key === '/' && !isOpen && !isInputFocused) {
// Open terminal when pressing "/" (only if not in input and not on a game page)
if (e.key === '/' && !isOpen && !isInputFocused && !isOnGamePage) {
e.preventDefault();
setIsOpen(true);
playSound('beep');
@@ -114,7 +118,7 @@ const TerminalCommand = () => {
window.addEventListener('keydown', handleKeyDown);
return () => window.removeEventListener('keydown', handleKeyDown);
}, [isOpen, playSound]);
}, [isOpen, playSound, isOnGamePage]);
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();