mirror of
https://github.com/supabase/supabase.git
synced 2026-10-16 06:39:09 +03:00
The end of the Great Migration is here!!! Moves the last pages over, deleting pages like the FAQ that we don't use and that contain duplicated information anyway. Dev secret auth page URL had to change as App Router doesn't like the leading underscores in the path. Also fixes the not-found recommendations to use the proper Next.js not-found page so it will return a 404 as it should. (I was under the erroneous impression that I couldn't get the pathname in not-found.tsx, that is not true, so this works better.)
55 lines
1.9 KiB
TypeScript
55 lines
1.9 KiB
TypeScript
import { notFound } from 'next/navigation'
|
|
|
|
import { REFERENCES } from '~/content/navigation.references'
|
|
import { ApiReferencePage } from '~/features/docs/Reference.apiPage'
|
|
import { CliReferencePage } from '~/features/docs/Reference.cliPage'
|
|
import { ClientSdkReferencePage } from '~/features/docs/Reference.sdkPage'
|
|
import { SelfHostingReferencePage } from '~/features/docs/Reference.selfHostingPage'
|
|
import {
|
|
generateReferenceMetadata,
|
|
generateReferenceStaticParams,
|
|
parseReferencePath,
|
|
redirectNonexistentReferenceSection,
|
|
} from '~/features/docs/Reference.utils'
|
|
|
|
export default async function ReferencePage({
|
|
params: { slug },
|
|
}: {
|
|
params: { slug: Array<string> }
|
|
}) {
|
|
if (!Object.keys(REFERENCES).includes(slug[0].replaceAll('-', '_'))) {
|
|
notFound()
|
|
}
|
|
|
|
const parsedPath = parseReferencePath(slug)
|
|
const isClientSdkReference = parsedPath.__type === 'clientSdk'
|
|
const isCliReference = parsedPath.__type === 'cli'
|
|
const isApiReference = parsedPath.__type === 'api'
|
|
const isSelfHostingReference = parsedPath.__type === 'self-hosting'
|
|
|
|
if (isClientSdkReference) {
|
|
const { sdkId, maybeVersion, path } = parsedPath
|
|
|
|
const sdkData = REFERENCES[sdkId]
|
|
const latestVersion = sdkData.versions[0]
|
|
const version = maybeVersion ?? latestVersion
|
|
|
|
await redirectNonexistentReferenceSection(sdkId, version, path, version === latestVersion)
|
|
|
|
return <ClientSdkReferencePage sdkId={sdkId} libVersion={version} />
|
|
} else if (isCliReference) {
|
|
return <CliReferencePage />
|
|
} else if (isApiReference) {
|
|
return <ApiReferencePage />
|
|
} else if (isSelfHostingReference) {
|
|
return (
|
|
<SelfHostingReferencePage service={parsedPath.service} servicePath={parsedPath.servicePath} />
|
|
)
|
|
} else {
|
|
notFound()
|
|
}
|
|
}
|
|
|
|
export const generateStaticParams = generateReferenceStaticParams
|
|
export const generateMetadata = generateReferenceMetadata
|