From ec1c5340137150ae809dcd8fadf0551cf7eb9642 Mon Sep 17 00:00:00 2001 From: Tomas Pozo Date: Wed, 9 Jul 2025 11:42:54 -0500 Subject: [PATCH] New GuideTemplate with composable components (#36893) * Add db wrappers open in dashboard cta * Restore getLatestRelease return to null * Add guide template components with flexible content positioning * Add Guide components with composition pattern * Remove default branch on tag value * Add GuideTemplate component and do some clean up * Restore original GuideTemplate * Clean up code and unused props * Remove displayName * Remove unwanted export * Refactor EditLink to its own helper file * Apply several fixes * Fix underline on cta button * Remove default main tag * More descriptive button cta label * fix(docs): add iceberg_wrapper dashboard integration --------- Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com> --- .../extensions/wrappers/[[...slug]]/page.tsx | 54 ++++++++++++++- .../docs/features/docs/GuidesMdx.template.tsx | 2 + apps/docs/features/helpers.edit-link.tsx | 39 +++++++++++ apps/docs/features/ui/GuideTemplate.tsx | 35 ++++++++++ apps/docs/features/ui/guide/Guide.tsx | 69 +++++++++++++++++++ apps/docs/features/ui/guide/GuideArticle.tsx | 24 +++++++ apps/docs/features/ui/guide/GuideFooter.tsx | 30 ++++++++ apps/docs/features/ui/guide/GuideHeader.tsx | 26 +++++++ .../features/ui/guide/GuideMdxContent.tsx | 11 +++ apps/docs/features/ui/guide/index.ts | 5 ++ 10 files changed, 293 insertions(+), 2 deletions(-) create mode 100644 apps/docs/features/helpers.edit-link.tsx create mode 100644 apps/docs/features/ui/GuideTemplate.tsx create mode 100644 apps/docs/features/ui/guide/Guide.tsx create mode 100644 apps/docs/features/ui/guide/GuideArticle.tsx create mode 100644 apps/docs/features/ui/guide/GuideFooter.tsx create mode 100644 apps/docs/features/ui/guide/GuideHeader.tsx create mode 100644 apps/docs/features/ui/guide/GuideMdxContent.tsx create mode 100644 apps/docs/features/ui/guide/index.ts diff --git a/apps/docs/app/guides/database/extensions/wrappers/[[...slug]]/page.tsx b/apps/docs/app/guides/database/extensions/wrappers/[[...slug]]/page.tsx index c34efb1c0e9..394c771b240 100644 --- a/apps/docs/app/guides/database/extensions/wrappers/[[...slug]]/page.tsx +++ b/apps/docs/app/guides/database/extensions/wrappers/[[...slug]]/page.tsx @@ -3,8 +3,12 @@ import { readFile } from 'node:fs/promises' import { join, relative } from 'node:path' import rehypeSlug from 'rehype-slug' import emoji from 'remark-emoji' +import Link from 'next/link' +import { Button } from 'ui' +import { Admonition } from 'ui-patterns' -import { GuideTemplate, newEditLink } from '~/features/docs/GuidesMdx.template' +import { Guide, GuideArticle, GuideHeader, GuideFooter, GuideMdxContent } from '~/features/ui/guide' +import { newEditLink } from '~/features/helpers.edit-link' import { genGuideMeta, genGuidesStaticParams, @@ -102,6 +106,7 @@ const pageMap = [ slug: 'airtable', meta: { title: 'Airtable', + dashboardIntegrationPath: 'airtable_wrapper', }, remoteFile: 'airtable.md', }, @@ -109,6 +114,7 @@ const pageMap = [ slug: 'auth0', meta: { title: 'Auth0', + dashboardIntegrationPath: 'auth0_wrapper', }, remoteFile: 'auth0.md', }, @@ -116,6 +122,7 @@ const pageMap = [ slug: 'bigquery', meta: { title: 'BigQuery', + dashboardIntegrationPath: 'bigquery_wrapper', }, remoteFile: 'bigquery.md', }, @@ -123,6 +130,7 @@ const pageMap = [ slug: 'clerk', meta: { title: 'Clerk', + dashboardIntegrationPath: 'clerk_wrapper', }, remoteFile: 'clerk.md', }, @@ -130,6 +138,7 @@ const pageMap = [ slug: 'clickhouse', meta: { title: 'ClickHouse', + dashboardIntegrationPath: 'clickhouse_wrapper', }, remoteFile: 'clickhouse.md', }, @@ -137,6 +146,7 @@ const pageMap = [ slug: 'cognito', meta: { title: 'AWS Cognito', + dashboardIntegrationPath: 'cognito_wrapper', }, remoteFile: 'cognito.md', }, @@ -151,6 +161,7 @@ const pageMap = [ slug: 'firebase', meta: { title: 'Firebase', + dashboardIntegrationPath: 'firebase_wrapper', }, remoteFile: 'firebase.md', }, @@ -158,6 +169,7 @@ const pageMap = [ slug: 'iceberg', meta: { title: 'Iceberg', + dashboardIntegrationPath: 'iceberg_wrapper', }, remoteFile: 'iceberg.md', }, @@ -165,6 +177,7 @@ const pageMap = [ slug: 'logflare', meta: { title: 'Logflare', + dashboardIntegrationPath: 'logflare_wrapper', }, remoteFile: 'logflare.md', }, @@ -172,6 +185,7 @@ const pageMap = [ slug: 'mssql', meta: { title: 'MSSQL', + dashboardIntegrationPath: 'mssql_wrapper', }, remoteFile: 'mssql.md', }, @@ -179,6 +193,7 @@ const pageMap = [ slug: 'notion', meta: { title: 'Notion', + dashboardIntegrationPath: 'notion_wrapper', }, remoteFile: 'notion.md', }, @@ -186,6 +201,7 @@ const pageMap = [ slug: 'paddle', meta: { title: 'Paddle', + dashboardIntegrationPath: 'paddle_wrapper', }, remoteFile: 'paddle.md', }, @@ -193,6 +209,7 @@ const pageMap = [ slug: 'redis', meta: { title: 'Redis', + dashboardIntegrationPath: 'redis_wrapper', }, remoteFile: 'redis.md', }, @@ -200,6 +217,7 @@ const pageMap = [ slug: 's3', meta: { title: 'AWS S3', + dashboardIntegrationPath: 's3_wrapper', }, remoteFile: 's3.md', }, @@ -207,6 +225,7 @@ const pageMap = [ slug: 'snowflake', meta: { title: 'Snowflake', + dashboardIntegrationPath: 'snowflake_wrapper', }, remoteFile: 'snowflake.md', }, @@ -214,6 +233,7 @@ const pageMap = [ slug: 'stripe', meta: { title: 'Stripe', + dashboardIntegrationPath: 'stripe_wrapper', }, remoteFile: 'stripe.md', }, @@ -254,7 +274,31 @@ const WrappersDocs = async (props: { params: Promise }) => { } as SerializeOptions) : undefined - return + const dashboardIntegrationURL = getDashboardIntegrationURL(meta.dashboardIntegrationPath) + + return ( + + + + + {dashboardIntegrationURL && ( + +

You can enable the {meta.title} wrapper right from the Supabase dashboard.

+ + +
+ )} + + + + +
+
+ ) } /** @@ -323,6 +367,12 @@ const getContent = async (params: Params) => { } } +const getDashboardIntegrationURL = (wrapperPath?: string) => { + return wrapperPath + ? `https://supabase.com/dashboard/project/_/integrations/${wrapperPath}/overview` + : null +} + const assetUrlTransform = (url: string, baseUrl: string): string => { const assetPattern = /(\.\.\/)+assets\// diff --git a/apps/docs/features/docs/GuidesMdx.template.tsx b/apps/docs/features/docs/GuidesMdx.template.tsx index 4472742fc2f..e7067e6815f 100644 --- a/apps/docs/features/docs/GuidesMdx.template.tsx +++ b/apps/docs/features/docs/GuidesMdx.template.tsx @@ -92,6 +92,7 @@ const GuideTemplate = ({ meta, content, children, editLink, mdxOptions }: GuideT {content && } {children} +