1- /* eslint-disable react/no-unstable-nested-components */
2- import { Callout } from 'fumadocs-ui/components/callout' ;
3- import { Pre , CodeBlock } from 'fumadocs-ui/components/codeblock' ;
4- import { ImageZoom } from 'fumadocs-ui/components/image-zoom' ;
5- import { Tab , Tabs } from 'fumadocs-ui/components/tabs' ;
6- import defaultComponents from 'fumadocs-ui/mdx' ;
7- import { DocsPage , DocsBody } from 'fumadocs-ui/page' ;
1+ import { DocsBody , DocsDescription , DocsPage , DocsTitle } from 'fumadocs-ui/page' ;
82import { notFound } from 'next/navigation' ;
93
10- import { source } from '@/app/source' ;
4+ import { LLMCopyButton , ViewOptions } from '@/components/page-actions' ;
5+ import { source } from '@/lib/source' ;
6+ import { getMDXComponents } from '@/mdx-components' ;
117
128import { Edit } from './Edit' ;
139
14- import type { MDXComponents , MDXContent } from 'mdx/types' ;
1510import type { Metadata } from 'next' ;
16- import type { ReactNode } from 'react' ;
1711
1812export default async function Page ( props : { readonly params : Promise < { slugs ?: string [ ] } > } ) {
1913 const params = await props . params ;
2014 const page = source . getPage ( params . slugs ) ;
2115
2216 if ( ! page ) notFound ( ) ;
2317
24- const Mdx = page . data . body as MDXContent ;
18+ const Mdx = page . data . body ;
2519
26- const path = `apps/website/content/docs/${ page . file . path } ` ;
20+ const path = `apps/website/content/docs/${ page . path } ` ;
2721 const footer = path . includes ( '/api/' ) ? null : (
2822 < a
2923 className = "inline-flex items-center justify-center font-medium ring-offset-fd-background transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-fd-ring disabled:pointer-events-none disabled:opacity-50 border bg-fd-secondary text-fd-secondary-foreground hover:bg-fd-secondary/80 h-9 rounded-md px-3 text-xs gap-1.5"
@@ -44,27 +38,21 @@ export default async function Page(props: { readonly params: Promise<{ slugs?: s
4438 tableOfContentPopover = { { footer } }
4539 toc = { page . data . toc }
4640 >
41+ < DocsTitle > { page . data . title } </ DocsTitle >
42+ < DocsDescription > { page . data . description } </ DocsDescription >
43+ < div className = "flex flex-row gap-2 items-center border-b pb-6" >
44+ < LLMCopyButton markdownUrl = { `${ page . url } .mdx` } />
45+ < ViewOptions githubUrl = { `https://github.com/imranbarbhuiya/TagScript/tree/main/${ path } ` } markdownUrl = { `${ page . url } .mdx` } />
46+ </ div >
4747 < DocsBody >
48- < Mdx
49- components = { {
50- ...( defaultComponents as MDXComponents ) ,
51- pre : ( { ref : _ref , ...rest } ) => (
52- < CodeBlock { ...rest } >
53- < Pre > { rest . children } </ Pre >
54- </ CodeBlock >
55- ) ,
56- Tab,
57- Tabs,
58- InstallTabs : ( { items, children } : { readonly children : ReactNode ; readonly items : string [ ] } ) => (
59- < Tabs id = "package-manager" items = { items } >
60- { children }
61- </ Tabs >
62- ) ,
63- blockquote : ( props ) => < Callout > { props . children } </ Callout > ,
64- img : ( props ) => < ImageZoom { ...props } />
65- } }
66- />
48+ < Mdx components = { getMDXComponents ( ) } />
6749 </ DocsBody >
50+ { /* <Rate
51+ onRateAction={async (url, feedback) => {
52+ 'use server';
53+ console.log('Feedback received:', { url, feedback });
54+ }}
55+ /> */ }
6856 </ DocsPage >
6957 ) ;
7058}
@@ -73,7 +61,7 @@ export async function generateStaticParams() {
7361 return source . generateParams ( ) ;
7462}
7563
76- export async function generateMetadata ( props : { params : Promise < { slugs ?: string [ ] } > } ) {
64+ export async function generateMetadata ( props : { params : Promise < { slugs ?: string [ ] } > } ) : Promise < Metadata > {
7765 const params = await props . params ;
7866 const page = source . getPage ( params . slugs ) ;
7967
@@ -94,11 +82,28 @@ export async function generateMetadata(props: { params: Promise<{ slugs?: string
9482 title : page . data . title ,
9583 description : page . data . description ,
9684 openGraph : {
85+ title : page . data . title ,
86+ description : page . data . description ,
9787 url : `/docs/${ page . slugs . join ( '/' ) } ` ,
9888 images : image
9989 } ,
10090 twitter : {
101- images : image
91+ card : 'summary_large_image' ,
92+ title : page . data . title ,
93+ description : page . data . description ,
94+ images : image ,
95+ site : 'https://tagscript.js.org'
96+ } ,
97+ alternates : {
98+ canonical : `https://tagscript.js.org/${ page . url } ` ,
99+ languages : {
100+ en : `https://tagscript.js.org/${ page . url } `
101+ }
102+ } ,
103+ appleWebApp : {
104+ capable : true ,
105+ title : 'Tagscript' ,
106+ statusBarStyle : 'default'
102107 }
103- } satisfies Metadata ;
108+ } ;
104109}
0 commit comments