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
| 1 | import { examplesSource } from '@/lib/source'; |
| 2 | import { createDocsPage, createGenerateStaticParams, createGenerateMetadata } from '@/lib/create-docs-page'; |
| 3 | import { ExamplesGallery, type GalleryItem } from '@/components/examples-gallery'; |
| 4 | |
| 5 | const DocsPage = createDocsPage(examplesSource); |
| 6 | |
| 7 | function getGalleryItems(): GalleryItem[] { |
| 8 | return examplesSource |
| 9 | .getPages() |
| 10 | .flatMap((page): GalleryItem[] => { |
| 11 | const gallery = page.data.gallery; |
| 12 | if (!gallery) return []; // skip the index and any page without gallery meta |
| 13 | return [ |
| 14 | { |
| 15 | title: page.data.title, |
| 16 | description: page.data.description ?? '', |
| 17 | href: page.url, |
| 18 | categories: gallery.categories, |
| 19 | logos: gallery.logos, |
| 20 | featured: gallery.featured, |
| 21 | order: gallery.order, |
| 22 | }, |
| 23 | ]; |
| 24 | }); |
| 25 | } |
| 26 | |
| 27 | export default async function Page({ params }: { params: Promise<{ slug?: string[] }> }) { |
| 28 | const { slug } = await params; |
| 29 | // The examples index renders a custom featured gallery; nested slugs use the |
| 30 | // standard docs page renderer. |
| 31 | if (!slug || slug.length === 0) { |
| 32 | return <ExamplesGallery items={getGalleryItems()} />; |
| 33 | } |
| 34 | return DocsPage({ params: Promise.resolve({ slug }) }); |
| 35 | } |
| 36 | |
| 37 | export const generateStaticParams = createGenerateStaticParams(examplesSource); |
| 38 | export const generateMetadata = createGenerateMetadata(examplesSource, 'examples'); |