import { useState, useEffect } from 'react'; import { useGridStore } from './store/gridStore'; import { Grid } from './components/Grid/Grid'; import { GridGenerator } from './components/Controls/GridGenerator'; import { AlgorithmSelector } from './components/Controls/AlgorithmSelector'; import { PlaybackControls } from './components/Controls/PlaybackControls'; import { MetricsPanel } from './components/Stats/MetricsPanel'; import { ComparisonDashboard } from './components/Stats/ComparisonDashboard'; import { GroupInfo } from './components/Info/GroupInfo'; import { PlanResultsModal } from './components/Stats/PlanResultsModal'; import { Button } from './components/ui/button'; import { ChevronLeft, ChevronRight, Play, FileText, Eye, BarChart3, Truck, AlertCircle, Users, Circle, Square, X, } from 'lucide-react'; type Tab = 'visualize' | 'compare' | 'info'; function App() { const [activeTab, setActiveTab] = useState('visualize'); const [sidebarCollapsed, setSidebarCollapsed] = useState(false); const [showPlanModal, setShowPlanModal] = useState(false); const { grid, planResult, runPlan, runSearch, isLoading, error, } = useGridStore(); // Open modal when planResult is updated useEffect(() => { if (planResult) { setShowPlanModal(true); } }, [planResult]); const handleRunSearch = () => { if (!grid || grid.stores.length === 0 || grid.destinations.length === 0) return; const start = grid.stores[0].position; const goal = grid.destinations[0].position; runSearch(start, goal); }; const handleRunPlan = async () => { await runPlan(); }; return (
{/* Header */}

Pathfinding Visualizer

Search Algorithm Analysis

{/* Tab navigation */}
{grid && ( <> )}
{/* Main content */}
{/* Sidebar */} {/* Main area */}
{/* Error display */} {error && (
{error}
)} {/* Content */}
{activeTab === 'visualize' ? ( <> {/* Legend overlay */}

Legend

Current
Path
Frontier
Explored
Store
Destination
Tunnel
Blocked

Edge Costs

1 2 3 4
) : activeTab === 'compare' ? (
) : ( )}
{/* Status bar */}
{grid && ( <> Grid {grid.width}x{grid.height} | S:{grid.stores.length} D:{grid.destinations.length} T:{grid.tunnels.length} )}
Connected
{/* Plan Results Modal */} setShowPlanModal(false)} />
); } export default App;