Skip to content

Commit 3e1fc05

Browse files
committed
fix: openapi genereated page w/o TOC
1 parent e1533ab commit 3e1fc05

File tree

1 file changed

+9
-19
lines changed

1 file changed

+9
-19
lines changed

app/[[...slug]]/page.tsx

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,7 @@ const defaultMdxComponents = {
2626
Tab,
2727
Tabs,
2828
TypeTable,
29-
img: (props: ImageZoomProps) => {
30-
// Don't apply ImageZoom to images inside Card components
31-
// This prevents the unwanted zoom behavior on partner logos and other card images
32-
if (
33-
props.className?.includes("object-contain") ||
34-
props.alt?.includes("Network") ||
35-
props.alt?.includes("Protocol") ||
36-
props.alt?.includes("Terminal") ||
37-
props.alt?.includes("Lit") ||
38-
props.alt?.includes("Rhinestone") ||
39-
props.alt?.includes("Lilypad")
40-
) {
41-
// eslint-disable-next-line @next/next/no-img-element, jsx-a11y/alt-text
42-
return <img {...(props as any)} />;
43-
}
44-
return <ImageZoom {...props} />;
45-
},
29+
img: (props: ImageZoomProps) => <ImageZoom {...props} />,
4630
Card: (props: CardProps) => <Card {...props} />,
4731
Cards: (props: HTMLAttributes<HTMLDivElement>) => <Cards {...props} />,
4832
Callout: (props: CalloutProps) => <Callout {...props} />,
@@ -54,9 +38,15 @@ export default async function Page(props: { params: Promise<{ slug?: string[] }>
5438
if (!page) notFound();
5539

5640
const MDX = page.data.body;
57-
// Don't show the TOC or edit button on the root page
41+
// Don't show the TOC or edit button on the root page, or the auto-generated API reference pages
5842
const isRootPage = !params.slug || params.slug.length === 0;
59-
const isApiPage = params.slug?.[0] === "reference";
43+
const isApiReferencePage = params.slug?.[0] === "api-reference";
44+
// Ignore the `api-reference/endpoints` page since it's manually written, so we want the TOC
45+
const isApiReferenceRootPage =
46+
params.slug?.length === 2 &&
47+
params.slug?.[0] === "api-reference" &&
48+
params.slug?.[1] === "endpoints";
49+
const isApiPage = isApiReferencePage && !isApiReferenceRootPage;
6050
const githubPath = `docs/${page.file.path}`;
6151
const githubInfo = {
6252
repo: "docs",

0 commit comments

Comments
 (0)