mirror of
https://github.com/supabase/supabase.git
synced 2026-10-07 02:15:05 +03: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 -->
54 lines
1.6 KiB
JavaScript
54 lines
1.6 KiB
JavaScript
import { z } from 'zod'
|
|
|
|
const contentListingIconKindSchema = z.enum([
|
|
'braces',
|
|
'otlp',
|
|
'datadog',
|
|
'grafana',
|
|
'cloud',
|
|
'sentry',
|
|
'axiom',
|
|
'last9',
|
|
'server',
|
|
])
|
|
|
|
const contentListingIconChipSchema = z.object({
|
|
kind: contentListingIconKindSchema,
|
|
color: z.string().min(1),
|
|
bg: z.string().min(1),
|
|
})
|
|
|
|
export const contentListingIconSchema = z.union([z.string().min(1), contentListingIconChipSchema])
|
|
|
|
export const contentListingItemSchema = z.object({
|
|
title: z.string().min(1),
|
|
href: z.string().min(1),
|
|
description: z.string().min(1),
|
|
icon: contentListingIconSchema.optional(),
|
|
hasLightIcon: z.boolean().optional(),
|
|
badge: z.string().min(1).optional(),
|
|
/** Grid cards only. Defaults to inline (next to the title), matching existing usage. */
|
|
badgePosition: z.enum(['inline', 'below']).optional(),
|
|
/**
|
|
* When set, the item is omitted unless `isFeatureEnabled(feature)` is true.
|
|
* Use for SDK- or product-gated links (e.g. `sdk:dart`) inside a shared listing.
|
|
*/
|
|
feature: z.string().min(1).optional(),
|
|
})
|
|
|
|
export const contentListingGroupTypeSchema = z.enum(['list', 'grid'])
|
|
|
|
export const contentListingGridColumnsSchema = z.union([z.literal(2), z.literal(3), z.literal(4)])
|
|
|
|
export const contentListingHeadingLevelSchema = z.enum(['h2', 'h3', 'h4'])
|
|
|
|
export const contentListingGroupSchema = z.object({
|
|
id: z.string().min(1),
|
|
heading: z.string().min(1).optional(),
|
|
headingLevel: contentListingHeadingLevelSchema.optional(),
|
|
description: z.string().optional(),
|
|
type: contentListingGroupTypeSchema.optional(),
|
|
columns: contentListingGridColumnsSchema.optional(),
|
|
items: z.array(contentListingItemSchema).min(1),
|
|
})
|