Skip to content

Commit bf455a1

Browse files
authored
Merge pull request #576 from objectstack-ai/copilot/update-fumadocs-to-latest
2 parents dcb9f98 + 8b70a92 commit bf455a1

183 files changed

Lines changed: 15755 additions & 813 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/docs/app/[lang]/blog/[[...slug]]/page.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { notFound } from 'next/navigation';
2-
import { blog } from '@/app/source';
3-
import defaultMdxComponents from 'fumadocs-ui/mdx';
2+
import { blog } from '@/lib/source';
3+
import { getMDXComponents } from '@/mdx-components';
44
import { HomeLayout } from 'fumadocs-ui/layouts/home';
5-
import { baseOptions } from '@/app/layout.config';
5+
import { baseOptions } from '@/lib/layout.shared';
66
import Link from 'next/link';
77
import { ArrowLeft } from 'lucide-react';
88

@@ -16,9 +16,7 @@ interface BlogPostData {
1616
body: React.ComponentType;
1717
}
1818

19-
const components = {
20-
...defaultMdxComponents,
21-
} as any;
19+
const components = getMDXComponents() as any;
2220

2321
export default async function BlogPage({
2422
params,
@@ -32,7 +30,7 @@ export default async function BlogPage({
3230
const posts = blog.getPages();
3331

3432
return (
35-
<HomeLayout {...baseOptions}>
33+
<HomeLayout {...baseOptions()}>
3634
<main className="container max-w-5xl mx-auto px-4 py-16">
3735
<div className="mb-12">
3836
<h1 className="text-4xl font-bold mb-4">Blog</h1>
@@ -114,7 +112,7 @@ export default async function BlogPage({
114112
const MDX = page.data.body;
115113

116114
return (
117-
<HomeLayout {...baseOptions}>
115+
<HomeLayout {...baseOptions()}>
118116
<main className="container max-w-4xl mx-auto px-4 py-16">
119117
<Link
120118
href="/blog"

apps/docs/app/[lang]/docs/[[...slug]]/page.tsx

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,14 @@
1-
import { source } from '@/app/source';
1+
import { source } from '@/lib/source';
22
import type { Metadata } from 'next';
3-
import { DocsPage, DocsBody } from 'fumadocs-ui/page';
3+
import { DocsBody, DocsDescription, DocsPage, DocsTitle } from 'fumadocs-ui/layouts/docs/page';
44
import { notFound } from 'next/navigation';
5-
import defaultMdxComponents from 'fumadocs-ui/mdx';
5+
import { getMDXComponents } from '@/mdx-components';
6+
import { createRelativeLink } from 'fumadocs-ui/mdx';
67
import { Step, Steps } from 'fumadocs-ui/components/steps';
78
import { File, Folder, Files } from 'fumadocs-ui/components/files';
89
import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
9-
10-
const components = {
11-
...defaultMdxComponents,
12-
Step,
13-
Steps,
14-
File,
15-
Folder,
16-
Files,
17-
FileTree: Files,
18-
Tab,
19-
Tabs,
20-
};
10+
import { LLMCopyButton, ViewOptions } from '@/components/ai/page-actions';
11+
import { gitConfig } from '@/lib/layout.shared';
2112

2213
export default async function Page(props: {
2314
params: Promise<{ lang: string; slug?: string[] }>;
@@ -26,19 +17,33 @@ export default async function Page(props: {
2617
const page = source.getPage(params.slug ?? [], params.lang);
2718
if (!page) notFound();
2819

29-
const data = page.data as any;
30-
const Content = data.body;
20+
const MDX = page.data.body;
3121

3222
return (
33-
<DocsPage toc={data.toc} full={data.full}>
23+
<DocsPage toc={page.data.toc} full={page.data.full}>
24+
<DocsTitle>{page.data.title}</DocsTitle>
25+
<DocsDescription className="mb-0">{page.data.description}</DocsDescription>
26+
<div className="flex flex-row gap-2 items-center border-b pb-6">
27+
<LLMCopyButton markdownUrl={`${page.url}.mdx`} />
28+
<ViewOptions
29+
markdownUrl={`${page.url}.mdx`}
30+
githubUrl={`https://github.com/${gitConfig.user}/${gitConfig.repo}/blob/${gitConfig.branch}/content/docs/${page.path}`}
31+
/>
32+
</div>
3433
<DocsBody>
35-
<h1 className="mb-2 text-3xl font-bold text-foreground">{page.data.title}</h1>
36-
{page.data.description && (
37-
<p className="mb-8 text-lg text-muted-foreground">
38-
{page.data.description}
39-
</p>
40-
)}
41-
<Content components={components} />
34+
<MDX
35+
components={getMDXComponents({
36+
a: createRelativeLink(source, page),
37+
Step,
38+
Steps,
39+
File,
40+
Folder,
41+
Files,
42+
FileTree: Files,
43+
Tab,
44+
Tabs,
45+
})}
46+
/>
4247
</DocsBody>
4348
</DocsPage>
4449
);

apps/docs/app/[lang]/docs/layout.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import { source } from '@/app/source';
2-
import type { Metadata } from 'next';
1+
import { source } from '@/lib/source';
32
import { DocsLayout } from 'fumadocs-ui/layouts/docs';
43
import type { ReactNode } from 'react';
5-
import { baseOptions } from '@/app/layout.config';
4+
import { baseOptions } from '@/lib/layout.shared';
65

76
export default async function Layout({
87
params,
@@ -16,7 +15,7 @@ export default async function Layout({
1615
return (
1716
<DocsLayout
1817
tree={source.pageTree[lang]}
19-
{...baseOptions}
18+
{...baseOptions()}
2019
i18n
2120
>
2221
{children}

apps/docs/app/[lang]/layout.tsx

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,17 @@ export default async function LanguageLayout({
1818
const { lang } = await params;
1919

2020
return (
21-
<html lang={lang} suppressHydrationWarning>
22-
<body>
23-
<RootProvider
24-
i18n={{
25-
locale: lang,
26-
locales: i18n.languages.map((l) => ({
27-
name: LANGUAGE_NAMES[l] || l,
28-
locale: l,
29-
})),
30-
}}
31-
>
32-
{children}
33-
</RootProvider>
34-
</body>
35-
</html>
21+
<RootProvider
22+
i18n={{
23+
locale: lang,
24+
locales: i18n.languages.map((l) => ({
25+
name: LANGUAGE_NAMES[l] || l,
26+
locale: l,
27+
})),
28+
}}
29+
>
30+
{children}
31+
</RootProvider>
3632
);
3733
}
3834

apps/docs/app/[lang]/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Database, Monitor, HardDrive, ShieldCheck, Puzzle, Code2, Rocket, Users, Blocks, LucideIcon } from 'lucide-react';
22
import { HomeLayout } from 'fumadocs-ui/layouts/home';
3-
import { baseOptions } from '@/app/layout.config';
3+
import { baseOptions } from '@/lib/layout.shared';
44
import { getHomepageTranslations } from '@/lib/homepage-i18n';
55
import { HeroSection } from '@/components/hero-section';
66
import { CodePreview } from '@/components/code-preview';
@@ -91,7 +91,7 @@ export default async function HomePage({
9191
];
9292

9393
return (
94-
<HomeLayout {...baseOptions} i18n>
94+
<HomeLayout {...baseOptions()} i18n>
9595
<main className="flex min-h-screen flex-col items-center justify-center text-center px-4 py-16 sm:py-24 md:py-32 overflow-hidden bg-background text-foreground selection:bg-primary/20">
9696

9797
{/* Hero Section */}

apps/docs/app/api/search/route.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
import { source } from '@/app/source';
2-
import { createSearchAPI } from 'fumadocs-core/search/server';
1+
import { source } from '@/lib/source';
2+
import { createFromSource } from 'fumadocs-core/search/server';
33

4-
export const { GET } = createSearchAPI('simple', {
5-
indexes: source.getPages().map((page) => ({
6-
title: page.data.title ?? 'Untitled',
7-
content: page.data.description ?? '',
8-
url: page.url,
9-
})),
4+
export const { GET } = createFromSource(source, {
5+
language: 'english',
106
});

apps/docs/app/global.css

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
@import "tailwindcss";
2-
@import "fumadocs-ui/style.css";
3-
4-
@layer base {
5-
:root {
6-
--radius: 0.5rem;
7-
}
8-
}
9-
10-
@layer utilities {
11-
.text-balance {
12-
text-wrap: balance;
13-
}
14-
}
1+
@import 'tailwindcss';
2+
@import 'fumadocs-ui/css/neutral.css';
3+
@import 'fumadocs-ui/css/preset.css';

apps/docs/app/layout.config.tsx

Lines changed: 0 additions & 47 deletions
This file was deleted.

apps/docs/app/layout.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import './global.css';
2-
import { redirect } from 'next/navigation';
32
import type { ReactNode } from 'react';
43
import type { Metadata } from 'next';
5-
import { i18n } from '@/lib/i18n';
64

75
export const metadata: Metadata = {
86
title: {
@@ -16,11 +14,9 @@ export const metadata: Metadata = {
1614
};
1715

1816
export default function RootLayout({ children }: { children: ReactNode }) {
19-
// Root layout is only used for redirects with middleware
20-
// The actual layout is in [lang]/layout.tsx
2117
return (
2218
<html lang="en" suppressHydrationWarning>
23-
<body>{children}</body>
19+
<body className="flex flex-col min-h-screen">{children}</body>
2420
</html>
2521
);
2622
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { getLLMText, source } from '@/lib/source';
2+
3+
export const revalidate = false;
4+
5+
export async function GET() {
6+
const scan = source.getPages().map(getLLMText);
7+
const scanned = await Promise.all(scan);
8+
9+
return new Response(scanned.join('\n\n'));
10+
}

0 commit comments

Comments
 (0)