import { useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { Menu, Play, Shield, Github, Monitor, Columns, Eye } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { useAgentReview } from '@/hooks/useAgentReview'; import RepoImporter from '@/components/github/RepoImporter'; import { useEnvStore } from '@/stores/envStore'; interface TopBarProps { layout: 'editor' | 'split' | 'preview'; onLayoutChange: (layout: 'editor' | 'split' | 'preview') => void; } export default function TopBar({ layout, onLayoutChange }: TopBarProps) { const navigate = useNavigate(); const { reviewWorkspace, isReviewing } = useAgentReview(); const [showImporter, setShowImporter] = useState(false); const environment = useEnvStore((s) => s.environment); // Define global window method or a custom hook to trigger execution that terminal listens to? // We'll dispatch a custom event for now that terminal/execution handler can listen to. const executeCode = () => { window.dispatchEvent(new CustomEvent('glmpilot:execute')); }; return ( <>
GLMPilot
{/* Layout toggles */}
{([ { id: 'editor' as const, icon: Monitor, label: 'Editor' }, { id: 'split' as const, icon: Columns, label: 'Split' }, { id: 'preview' as const, icon: Eye, label: 'Preview' }, ]).map((item) => ( ))}
{(environment === 'java' || environment === 'python') && ( )}
setShowImporter(false)} /> ); }