mirror of
https://github.com/supabase/supabase.git
synced 2026-09-06 18:11:51 +08:00
## What kind of change does this PR introduce? Docs update / follow-up to #48379. ## What is the current behavior? `/guides/resources` and `/guides/getting-started` hand-roll `GlassPanel` grids in MDX. They look like ContentListings cards after the chrome PR, but they do not use the shared data files, so they miss PostHog `docs_content_listing_clicked` telemetry and the CONTRIBUTING contribution path. ## What is the new behavior? Those pages use `<ContentListings id="…" />` backed by `resources.data.ts` and `getting-started.data.ts`, same pattern as storage. - Section-level `$Show` wrappers stay for framework / web / mobile blocks - Nimbus stays a `$Partial` behind `$Show` - New optional per-item `feature` field gates SDK links (e.g. Flutter / Swift / Kotlin) without splitting whole sections - CONTRIBUTING notes when to use `feature` vs a partial-level `$Show` ## To test Compare the following against `master`: - [Resources](https://docs-git-dnywh-docs-content-listings-resources-239158-supabase.vercel.app/docs/guides/resources): overview, migrate, and postgres grids; icons in light/dark - [Getting started](https://docs-git-dnywh-docs-content-listings-resources-239158-supabase.vercel.app/docs/guides/getting-started): overview, use cases, framework quickstarts, web demos, mobile tutorials; nimbus partial when enabled - Click a card and confirm `docs_content_listing_clicked` fires with the expected `listingId` Everything should look and feel the same. It’s just that we’re using `ContentListings` instead of `GlassPanel` grids. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added centralized Getting Started and Resources content listings, including quickstarts, demos, tutorials, migration guides, and Postgres resources. - Added feature-based visibility controls for individual content listing items. - **Improvements** - Disabled content is now automatically hidden from documentation pages and generated Markdown. - Pages and sections with no available content are omitted entirely. - External documentation links are more secure. - Updated contribution guidance with instructions and examples for feature flags. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
23 lines
937 B
TypeScript
23 lines
937 B
TypeScript
import { CONTENT_LISTINGS } from '~/data/content-listings'
|
|
import { isFeatureEnabled, type Feature } from 'common/enabled-features'
|
|
|
|
import type { ContentListingGroup, ContentListingItem } from './content-listings.schema'
|
|
|
|
/** Label for telemetry — prefers heading, falls back to id. */
|
|
export function getContentListingGroupLabel(group: ContentListingGroup): string {
|
|
return group.heading ?? group.id
|
|
}
|
|
|
|
export function isExternalContentListingHref(href: string): boolean {
|
|
return /^https?:\/\//i.test(href) || href.startsWith('//')
|
|
}
|
|
|
|
export function getContentListingById(id: string): ContentListingGroup | undefined {
|
|
return CONTENT_LISTINGS[id]
|
|
}
|
|
|
|
/** Omits items whose `feature` flag is disabled. Shared by UI and markdown export. */
|
|
export function filterContentListingItems(items: ContentListingItem[]): ContentListingItem[] {
|
|
return items.filter((item) => !item.feature || isFeatureEnabled(item.feature as Feature))
|
|
}
|