({
params
}: {
params: Promise<{ section: string }>;
})
| 5 | import { ContentT } from '@/types/markdown'; |
| 6 | |
| 7 | export default async function SingleDocPage({ |
| 8 | params |
| 9 | }: { |
| 10 | params: Promise<{ section: string }>; |
| 11 | }) { |
| 12 | const { section } = await params; |
| 13 | let content: ContentT; |
| 14 | |
| 15 | if (process.env.NODE_ENV === 'production') { |
| 16 | const docContent = docsContent.find( |
| 17 | doc => doc.slug === section && doc.section === 'docs' |
| 18 | ); |
| 19 | |
| 20 | content = docContent?.content; |
| 21 | } else { |
| 22 | // dynamically import the file |
| 23 | const { getContentBySlugOnDev } = await import('@/lib/get-content-by-slug-on-dev'); |
| 24 | |
| 25 | let data = await getContentBySlugOnDev({ |
| 26 | type: 'docs', |
| 27 | slug: section, |
| 28 | section: 'docs', |
| 29 | }); |
| 30 | |
| 31 | if (!data.content) { |
| 32 | data = await getContentBySlugOnDev({ |
| 33 | type: 'docs', |
| 34 | slug: 'index', |
| 35 | section: section |
| 36 | }); |
| 37 | } |
| 38 | |
| 39 | content = data.content; |
| 40 | } |
| 41 | |
| 42 | return <Content content={content} />; |
| 43 | } |
nothing calls this directly
no test coverage detected