Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Test quality, measure performance, & ship with confidence.

<img src="./assets/Readme%20logo.gif" alt="EfficientAI Demo" width="800">

[📅 Book a Demo](https://cal.com/aadhar-singh-bhadauria/30min) • [💻 GitHub](https://github.com/EfficientAI-tech/efficientAI)
[📅 Book a Demo](https://cal.com/aadhar-singh-bhadauria/30min) • [💻 GitHub](https://github.com/EfficientAI-tech/efficientAI) • [💬 Discord](https://discord.gg/Saz9b2NA7)

⭐ If this saves you time, please consider starring the repo — it helps us a lot.

Expand Down Expand Up @@ -977,6 +977,7 @@ See `CONTRIBUTING.md` for PR format, review expectations, and release label conv
- 💬 **LinkedIn**: [Connect with us](https://www.linkedin.com/company/efficientaicloud)
- 🐦 **X (Twitter)**: [Follow us](https://x.com/AiEfficient)
- 💻 **GitHub**: [View on GitHub](https://github.com/EfficientAI-tech/efficientAI)
- 💬 **Discord**: [Join our community](https://discord.gg/Saz9b2NA7)

---

Expand Down
2 changes: 1 addition & 1 deletion docs-fumadocs/app/(home)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { redirect } from 'next/navigation';

export default function HomePage() {
redirect('/docs/intro/');
redirect('/docs/quickstart/');
}
73 changes: 56 additions & 17 deletions docs-fumadocs/app/docs/[[...slug]]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import { source } from '@/lib/source';
import { DocsBody, DocsPage } from 'fumadocs-ui/layouts/docs/page';
import { DocsBody, DocsPage } from 'fumadocs-ui/layouts/notebook/page';
import { notFound } from 'next/navigation';
import { getMDXComponents } from '@/components/mdx';
import type { Metadata } from 'next';
import { createRelativeLink } from 'fumadocs-ui/mdx';
import { ContributorsTocFooter } from '@/components/contributors';
import { TocHeaderControls } from '@/components/toc-header-controls';
import type { ComponentPropsWithoutRef } from 'react';
import { OpenAPIPage } from '@/components/api-page';
import { CopyPageMarkdown } from '@/components/copy-page-markdown';
import { CommunityContactFooter } from '@/components/community-contact-footer';
import type { ComponentPropsWithoutRef, ComponentType } from 'react';
import { ExternalLink } from 'lucide-react';
import type { TOCItemType } from 'fumadocs-core/toc';
import { openapi } from '@/lib/openapi';

function DocsRelativeLink(props: ComponentPropsWithoutRef<'a'> & { resolver: ReturnType<typeof createRelativeLink> }) {
const { resolver, className, ...rest } = props;
Expand Down Expand Up @@ -37,36 +41,71 @@ export default async function Page(props: PageProps<'/docs/[[...slug]]'>) {
const page = source.getPage(params.slug);
if (!page) notFound();

const MDX = page.data.body;
const pageData = page.data as typeof page.data & {
body: ComponentType<{ components?: ReturnType<typeof getMDXComponents> }>;
toc?: TOCItemType[];
full?: boolean;
_openapi?: { method?: string };
};
const MDX = pageData.body;
const markdownPath =
page.slugs[0] === 'api-reference' && page.slugs.length > 2 && pageData._openapi?.method
? `/api-md/${page.slugs.slice(1).join('/')}.md`
: null;
const isEnterprisePage = (page.slugs[0] ?? '') === 'enterprise';
const showToc = !isEnterprisePage;
const toc = showToc ? pageData.toc : undefined;
const full = isEnterprisePage || Boolean(pageData.full);

return (
<DocsPage
toc={page.data.toc}
full={page.data.full}
breadcrumb={{ enabled: false }}
tableOfContent={{
header: <TocHeaderControls />,
footer: <ContributorsTocFooter featureId={page.slugs.join('/')} />,
}}
tableOfContentPopover={{
header: <TocHeaderControls />,
footer: <ContributorsTocFooter featureId={page.slugs.join('/')} />,
}}
toc={toc}
full={full}
breadcrumb={{ enabled: !isEnterprisePage }}
tableOfContent={
showToc
? {
footer: <ContributorsTocFooter featureId={page.slugs.join('/')} />,
}
: undefined
}
tableOfContentPopover={
showToc
? {
footer: <ContributorsTocFooter featureId={page.slugs.join('/')} />,
}
: undefined
}
>
<DocsBody>
<DocsBody className={isEnterprisePage ? 'enterprise-doc' : undefined}>
{markdownPath ? (
<div className="not-prose mb-4 flex justify-end">
<CopyPageMarkdown mdPath={markdownPath} />
</div>
) : null}
<MDX
components={getMDXComponents({
// this allows you to link to other pages with relative file paths
a: (props) => <DocsRelativeLink {...props} resolver={createRelativeLink(source, page)} />,
OpenAPIPage: async (props) => (
<OpenAPIPage {...(await openapi.preloadOpenAPIPage(page))} {...props} />
),
})}
/>
{!isEnterprisePage ? <CommunityContactFooter /> : null}
</DocsBody>
</DocsPage>
);
}

export async function generateStaticParams() {
return source.generateParams();
const params = source.generateParams();
if (params.length === 0) {
throw new Error(
'Docs source returned no static params. Run `npx fumadocs-mdx` in docs-fumadocs and restart the dev server.',
);
}
return params;
}

export async function generateMetadata(props: PageProps<'/docs/[[...slug]]'>): Promise<Metadata> {
Expand Down
55 changes: 49 additions & 6 deletions docs-fumadocs/app/docs/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,54 @@
import { source } from '@/lib/source';
import { DocsLayout } from 'fumadocs-ui/layouts/docs';
import { baseOptions } from '@/lib/layout.shared';
import type * as PageTree from 'fumadocs-core/page-tree';
import type { LayoutTab } from 'fumadocs-ui/layouts/shared';
import { DocsShell } from '@/components/docs-shell';

export default function Layout({ children }: LayoutProps<'/docs'>) {
return (
<DocsLayout tree={source.getPageTree()} {...baseOptions()}>
{children}
</DocsLayout>
function folderUrls(folder: PageTree.Folder): string[] {
const urls: string[] = [];
if (folder.index?.url) urls.push(folder.index.url);
for (const child of folder.children) {
if (child.type === 'page') urls.push(child.url);
if (child.type === 'folder') urls.push(...folderUrls(child));
}
return urls;
}

function findRootFolder(tree: PageTree.Root, title: string): PageTree.Folder | undefined {
return tree.children.find(
(node): node is PageTree.Folder => node.type === 'folder' && node.name === title,
);
}

export default async function Layout({ children }: LayoutProps<'/docs'>) {
const options = baseOptions();
const tree = source.getPageTree();
const docsRoot = findRootFolder(tree, 'Docs');
const apiRoot = findRootFolder(tree, 'API Reference');
const tabs: LayoutTab[] = [
{
title: 'Docs',
url: '/docs/quickstart/',
urls: new Set(docsRoot ? folderUrls(docsRoot) : ['/docs/', '/docs/quickstart/']),
},
{
title: 'API Reference',
url: '/docs/api-reference/',
urls: new Set(apiRoot ? folderUrls(apiRoot) : ['/docs/api-reference/']),
},
{
title: 'Enterprise',
url: '/docs/enterprise/',
},
{
title: 'Changelog',
url: '/docs/changelog/',
},
{
title: 'Blogs',
url: '/docs/blog/',
},
];

return <DocsShell tree={tree} options={options} tabs={tabs}>{children}</DocsShell>;
}
Loading
Loading