From c02104d843e460be25f4bac0e2b6f96593372249 Mon Sep 17 00:00:00 2001 From: MananTank Date: Fri, 22 Nov 2024 08:18:17 +0000 Subject: [PATCH] [Portal] Fix reference page static generation (#5484) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NOTE: This will not build - Recently the sidebar categories have been updated in the reference pages and this is creating issues with static build. Need to fix those errors --- ## PR-Codex overview This PR focuses on making adjustments to various files, including changing limits on data retrieval, modifying the structure of TypeScript types, and cleaning up the formatting of documentation. ### Detailed summary - Changed `-limit` from `50` to `20` in `apps/portal/src/app/changelog/ghost.ts`. - Removed `classes`, `variables`, `types`, and `enums` from `subgroups` in `apps/portal/src/app/references/components/TDoc/utils/subgroups.ts`. - Cleaned up documentation text in `apps/portal/src/app/typescript/v5/chain/page.mdx`. - Reformatted `PageProps` type definition in `apps/portal/src/app/references/components/TDoc/PageLayout.tsx` for better readability. - Updated return type of `generateStaticParams` function to be more explicit in `apps/portal/src/app/references/components/TDoc/PageLayout.tsx`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` --- apps/portal/src/app/changelog/ghost.ts | 2 +- .../app/references/components/TDoc/PageLayout.tsx | 12 ++++++++---- .../references/components/TDoc/utils/subgroups.ts | 4 ---- apps/portal/src/app/typescript/v5/chain/page.mdx | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/apps/portal/src/app/changelog/ghost.ts b/apps/portal/src/app/changelog/ghost.ts index 27e5454d36f..591b668e180 100644 --- a/apps/portal/src/app/changelog/ghost.ts +++ b/apps/portal/src/app/changelog/ghost.ts @@ -8,7 +8,7 @@ export async function fetchChangeLogs() { key: GHOST_THIRDWEB_BLOG_KEY, fields: ["title", "slug", "published_at"].join(","), filter: "tag:changelog", - limit: "50", + limit: "20", order: "published_at DESC", include: ["authors", "tags"].join(","), }) diff --git a/apps/portal/src/app/references/components/TDoc/PageLayout.tsx b/apps/portal/src/app/references/components/TDoc/PageLayout.tsx index 46b306caede..3b9ab72b8b0 100644 --- a/apps/portal/src/app/references/components/TDoc/PageLayout.tsx +++ b/apps/portal/src/app/references/components/TDoc/PageLayout.tsx @@ -20,7 +20,10 @@ import { getSidebarLinkGroups } from "./utils/getSidebarLinkgroups"; import { fetchAllSlugs, getSlugToDocMap } from "./utils/slugs"; import { nameToSubgroupSlug, subgroups } from "./utils/subgroups"; -type PageProps = { params: Promise<{ version: string; slug?: string[] }> }; +type PageProps = { + params: Promise<{ version: string; slug?: string[] }>; +}; + type LayoutProps = { params: Promise<{ version: string }>; children: React.ReactNode; @@ -100,7 +103,9 @@ export function getTDocPage(options: { } // statically generate pages for latest version - async function generateStaticParams(): Promise { + async function generateStaticParams(): Promise< + Awaited[] + > { const versions = await getVersions(); const returnVal = await Promise.all( @@ -125,8 +130,7 @@ export function getTDocPage(options: { }), ); - const paths = returnVal.flat(); - return paths.map((p) => Promise.resolve(p)); + return returnVal.flat(); } async function generateMetadata(props: PageProps): Promise { diff --git a/apps/portal/src/app/references/components/TDoc/utils/subgroups.ts b/apps/portal/src/app/references/components/TDoc/utils/subgroups.ts index 6f85912c2c3..7925e2b21fd 100644 --- a/apps/portal/src/app/references/components/TDoc/utils/subgroups.ts +++ b/apps/portal/src/app/references/components/TDoc/utils/subgroups.ts @@ -1,11 +1,7 @@ export const subgroups = { components: "UI Components", hooks: "React Hooks", - classes: "Classes", functions: "Core Functions", - variables: "Variables", - types: "Types", - enums: "Enums", }; export const nameToSubgroupSlug = (() => { diff --git a/apps/portal/src/app/typescript/v5/chain/page.mdx b/apps/portal/src/app/typescript/v5/chain/page.mdx index 31c2f3f79a9..e90e09a8046 100644 --- a/apps/portal/src/app/typescript/v5/chain/page.mdx +++ b/apps/portal/src/app/typescript/v5/chain/page.mdx @@ -10,7 +10,7 @@ import { defineChain } from "thirdweb"; const myChain = defineChain(myChainId); ``` -The SDK comes with predefined [popular chains](/references/typescript/v5/variables) like `base`, `polygon`, and more exported from the `thirdweb/chains` entrypoint. +The SDK comes with predefined popular chains like `base`, `polygon`, and more exported from the `thirdweb/chains` entrypoint. ```ts import { polygon } from "thirdweb/chains";