import { useState, useEffect } from 'react'; import './index.css'; import { Sidebar } from './components/Sidebar'; import { ChatArea } from './components/ChatArea'; import { RightPanel } from './components/RightPanel'; import { SettingsLayout } from './components/Settings/SettingsLayout'; import { useGatewayStore } from './store/gatewayStore'; type View = 'main' | 'settings'; function App() { const [view, setView] = useState('main'); const { connect, connectionState } = useGatewayStore(); // Auto-connect to Gateway on startup useEffect(() => { if (connectionState === 'disconnected') { connect().catch(() => { // Silent fail — user can manually connect via Settings }); } }, []); if (view === 'settings') { return setView('main')} />; } return (
{/* 左侧边栏 */} setView('settings')} /> {/* 中间对话区域 */}
{/* 右侧边栏 */}
); } export default App;