Files
supabase/apps/docs/pages/reference/python/crawlers/[...slug].tsx
Kevin Grüneberg 43240e0de1 chore: skip import of combined JS spec for non-JS docs (#28133)
* chore: skip import of combined JS spec for non-JS docs

* fix import
2024-07-24 11:17:19 +08:00

45 lines
1.4 KiB
TypeScript

import clientLibsCommonSections from '~/spec/common-client-libs-sections.json'
import spec from '~/spec/supabase_py_v2.yml' assert { type: 'yml' }
import RefSectionHandler from '~/components/reference/RefSectionHandler'
import { flattenSections } from '~/lib/helpers'
import handleRefGetStaticPaths from '~/lib/mdx/handleRefStaticPaths'
import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps'
import { useRouter } from 'next/compat/router'
import RefSEO from '~/components/reference/RefSEO'
import { MenuId } from '~/components/Navigation/NavigationMenu/NavigationMenu'
const sections = flattenSections(clientLibsCommonSections)
const libraryPath = '/python'
export default function PyReference(props) {
const router = useRouter()
const slug = router.query.slug[0]
const filteredSection = sections.filter((section) => section.id === slug)
const pageTitle = filteredSection[0]?.title
? `${filteredSection[0]?.title} | Supabase`
: 'Supabase'
return (
<>
<RefSEO title={pageTitle} />
<RefSectionHandler
menuId={MenuId.RefPythonV2}
sections={filteredSection}
spec={spec}
pageProps={props}
type="client-lib"
/>
</>
)
}
export async function getStaticProps() {
return handleRefStaticProps(sections, libraryPath)
}
export async function getStaticPaths() {
return handleRefGetStaticPaths(sections)
}