Files
ai-code-app/src/app/main/AppShell.tsx
2026-05-28 08:09:49 +09:00

35 lines
1.6 KiB
TypeScript

import { Navigate, Route, Routes } from 'react-router-dom';
import { MainLayout } from './layout/MainLayout';
import { ApisPage } from './pages/ApisPage';
import { ChatPage } from './pages/ChatPage';
import { ChatSharePage } from './pages/ChatSharePage';
import { DocsPage } from './pages/DocsPage';
import { PlansPage } from './pages/PlansPage';
import { PlayPage } from './pages/PlayPage';
import { buildChatPath, buildDocsPath } from './routes';
import { isPreviewRuntime } from './previewRuntime';
export function AppShell() {
return (
<Routes>
<Route path="/shares/:token" element={<ChatSharePage />} />
<Route path="/chat-share/:token" element={<ChatSharePage />} />
<Route path="/chat/share/:token" element={<ChatSharePage />} />
<Route path="/" element={<MainLayout />}>
<Route index element={<Navigate to={isPreviewRuntime() ? buildDocsPath() : buildChatPath('live')} replace />} />
<Route path="docs/:folder" element={<DocsPage />} />
<Route path="apis/:section" element={<ApisPage />} />
<Route path="plans/:section" element={<PlansPage />} />
<Route path="chat/:section" element={<ChatPage />} />
<Route path="play/layout" element={<PlayPage />} />
<Route path="play/draw" element={<PlayPage />} />
<Route path="play/apps" element={<PlayPage />} />
<Route path="play/test" element={<PlayPage />} />
<Route path="play/cbt" element={<PlayPage />} />
<Route path="play/layout-record/:layoutId" element={<PlayPage />} />
<Route path="*" element={<Navigate to={buildDocsPath()} replace />} />
</Route>
</Routes>
);
}