@devries-cameron20 / composio Mirror · read-only
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 04:45 UTC

next
tsx 39 lines 1.44 KB
Raw
1 import { getReferenceSource } from '@/lib/source';
2 import { DocsLayout } from 'fumadocs-ui/layouts/docs';
3 import type { ReactNode } from 'react';
4 import { prepareTree } from '@/lib/filter-api-version';
5 import { buildSidebarNavIndex } from '@/lib/sidebar-nav-index';
6 import { SidebarAnalytics } from '@/components/sidebar-analytics';
7
8 export default async function Layout({ children }: { children: ReactNode }) {
9 const source = await getReferenceSource();
10 const tree = prepareTree(source.pageTree, '3.1');
11 const changelogPage = { type: 'page' as const, name: 'Changelog', url: '/reference/changelog' };
12 // Pin Changelog directly beneath Overview (the first/top entry) in the sidebar.
13 const overviewIdx = tree.children.findIndex(
14 child => child.type === 'page' && child.name === 'Overview'
15 );
16 const insertIdx = overviewIdx === -1 ? Math.min(1, tree.children.length) : overviewIdx + 1;
17 const pageTree = {
18 ...tree,
19 children: [
20 ...tree.children.slice(0, insertIdx),
21 changelogPage,
22 ...tree.children.slice(insertIdx),
23 ] as typeof tree.children,
24 };
25 const navIndex = buildSidebarNavIndex(pageTree);
26
27 return (
28 <DocsLayout
29 tree={pageTree}
30 nav={{ enabled: true, title: null }}
31 searchToggle={{ enabled: false }}
32 sidebar={{ collapsible: false, footer: null, tabs: false }}
33 themeSwitch={{ enabled: false }}
34 >
35 <SidebarAnalytics index={navIndex} />
36 {children}
37 </DocsLayout>
38 );
39 }