diff --git a/src/App.tsx b/src/App.tsx index 7510d1f..76b690d 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,4 +1,4 @@ -import React from 'react' +import React, { useState, useEffect } from 'react' import { Tabs, TabsContent, @@ -13,6 +13,7 @@ import Temple from './components/Temple' import { ActionCooldown } from './components/ActionCooldown' import { useSaveSystem } from './store/useSaveSystem' import { Console } from './components/Console' +import { GodModal } from './components/GodModal' const appContainerStyle: React.CSSProperties = { maxWidth: '1200px', @@ -29,6 +30,18 @@ const tabsListStyles: React.CSSProperties = { function App() { useGameTick() useSaveSystem() + const [isGodModalOpen, setIsGodModalOpen] = useState(false) + + useEffect(() => { + const handleKeyPress = (event: KeyboardEvent) => { + if (event.key.toLowerCase() === 'g') { + setIsGodModalOpen(prev => !prev) + } + } + + window.addEventListener('keydown', handleKeyPress) + return () => window.removeEventListener('keydown', handleKeyPress) + }, []) return (
@@ -56,6 +69,7 @@ function App() {
+ {isGodModalOpen && setIsGodModalOpen(false)} />} ) } diff --git a/src/components/Field.tsx b/src/components/Field.tsx index 0622748..0a5eb8e 100644 --- a/src/components/Field.tsx +++ b/src/components/Field.tsx @@ -59,35 +59,6 @@ const getCropButtonStyle = (active: boolean): React.CSSProperties => ({ cursor: 'pointer', }) -const speedSelectorContainerStyle: React.CSSProperties = { - display: 'flex', - flexDirection: 'column', - alignItems: 'center', - marginBottom: '1rem', - padding: '0.5rem', - backgroundColor: '#f9fafb', - borderRadius: '0.5rem', - border: '1px solid #e5e7eb', -} - -const speedSelectorLabelStyle: React.CSSProperties = { - fontWeight: 500, - marginBottom: '0.5rem', -} - -const speedButtonsContainerStyle: React.CSSProperties = { - display: 'flex', - gap: '0.5rem', -} - -const getSpeedButtonStyle = (active: boolean): React.CSSProperties => ({ - padding: '0.5rem 1rem', - borderRadius: '0.25rem', - border: '1px solid #ccc', - backgroundColor: active ? '#4ade80' : '#f3f4f6', - cursor: 'pointer', -}) - const getFieldGridStyle = (size: number): React.CSSProperties => ({ display: 'grid', gridTemplateColumns: `repeat(${size}, 1fr)`, @@ -220,8 +191,6 @@ const FieldComponent: React.FC = () => { harvest, remove, assignCrop, - gameSpeed, - setGameSpeed, actionCooldown, } = useGameStore() @@ -276,8 +245,6 @@ const FieldComponent: React.FC = () => { return `rgb(${r}, ${g}, ${b})` } - const availableSpeeds = [1, 2, 4, 8, 16, 32, 64] - const tools: { id: FieldTool; label: string; icon: string }[] = [ { id: 'mark', label: 'Mark', icon: '🎯' }, { id: 'plant', label: 'Plant', icon: '🌱' }, @@ -291,21 +258,6 @@ const FieldComponent: React.FC = () => {

Fields

-
-

Game Speed:

-
- {availableSpeeds.map((speed) => ( - - ))} -
-
-
{tools.map((tool) => (