📦 EqualifyEverything / equalify-reflow-docs

📄 App.tsx · 34 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34import { Routes, Route, Navigate } from 'react-router-dom';
import { Layout } from './components/Layout';
import { DocsLayout } from './components/DocsLayout';
import { Home } from './pages/Home';
import { MarkdownPage } from './components/MarkdownPage';
import { docsNav } from './docs-nav';

function App() {
  // Flatten all doc entries for route generation
  const allDocs = docsNav.flatMap(section =>
    section.items.map(item => item)
  );

  return (
    <Layout>
      <Routes>
        <Route path="/" element={<Home />} />
        <Route path="/docs" element={<DocsLayout />}>
          <Route index element={<Navigate to={allDocs[0]?.path ?? '/docs/architecture'} replace />} />
          {allDocs.map(doc => (
            <Route
              key={doc.path}
              path={doc.path.replace('/docs/', '')}
              element={<MarkdownPage filePath={doc.file} />}
            />
          ))}
        </Route>
      </Routes>
    </Layout>
  );
}

export default App;