1- import { source } from '@/app /source' ;
1+ import { source } from '@/lib /source' ;
22import type { Metadata } from 'next' ;
3- import { DocsPage , DocsBody } from 'fumadocs-ui/page' ;
3+ import { DocsBody , DocsDescription , DocsPage , DocsTitle } from 'fumadocs-ui/layouts/docs /page' ;
44import { notFound } from 'next/navigation' ;
5- import defaultMdxComponents from 'fumadocs-ui/mdx' ;
5+ import { getMDXComponents } from '@/mdx-components' ;
6+ import { createRelativeLink } from 'fumadocs-ui/mdx' ;
67import { Step , Steps } from 'fumadocs-ui/components/steps' ;
78import { File , Folder , Files } from 'fumadocs-ui/components/files' ;
89import { 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
2213export 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 ) ;
0 commit comments