mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 18:05:11 +03:00
## I have read the CONTRIBUTING.md file. YES ## What kind of change does this PR introduce? Revert. Removes the Multigres Public Alpha docs section that was published in #49020. Linear: MUL-1621 (follow-up to MUL-452). ## What is the current behavior? - Overview guide live at `/docs/guides/database/multigres` - Compatibility stub live at `/docs/guides/database/multigres/compatibility` - Database sidebar has a Multigres section - Features table lists Database / Multigres / `public alpha` - Database "What you get" cards render for Multigres ## What is the new behavior? Clean revert of #49020: overview and compatibility pages removed, sidebar entry removed, features table row removed, "What you get" cards removed. The unrelated `ContentListings` optional-`href` support this PR introduced is also reverted since nothing else uses it yet. Docs go back up once Sugu gives the go-ahead to re-publish (tracked in MUL-1621). ## Additional context - `pnpm --filter docs exec vitest run lib/content-listings.test.ts` — 20 passed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Documentation** - Removed Multigres documentation, navigation links, feature listings, and related references. - Updated the JavaScript client library link in the getting-started guide. - Corrected the High Availability badge’s “Read more” link. - **Content Listings** - Content listing entries now require links and consistently render as linked items. - Non-linked listing items are no longer displayed as static content. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Nik Richers <nik@validmind.ai>
144 lines
5.0 KiB
TypeScript
144 lines
5.0 KiB
TypeScript
'use client'
|
|
|
|
import type { ContentListingGroup, ContentListingItem } from '~/lib/content-listings.schema'
|
|
import {
|
|
filterContentListingItems,
|
|
getContentListingById,
|
|
getContentListingGroupLabel,
|
|
isExternalContentListingHref,
|
|
} from '~/lib/content-listings.utils'
|
|
import { useSendTelemetryEvent } from '~/lib/telemetry'
|
|
import Link from 'next/link'
|
|
import { useCallback, useMemo } from 'react'
|
|
import ReactMarkdown from 'react-markdown'
|
|
import { Badge, Heading } from 'ui'
|
|
import { GlassPanel } from 'ui-patterns/GlassPanel'
|
|
|
|
import { resolveContentListingIcon } from './iconChip'
|
|
|
|
const GRID_ITEM_CLASS = {
|
|
// Stay 2-up until xl (~1280px) so cards aren't cramped beside the docs sidebar.
|
|
2: 'col-span-12 md:col-span-6',
|
|
3: 'col-span-12 md:col-span-6 xl:col-span-4',
|
|
4: 'col-span-12 md:col-span-6 xl:col-span-3',
|
|
} as const
|
|
|
|
function useContentListingClickHandler(group: ContentListingGroup) {
|
|
const sendTelemetryEvent = useSendTelemetryEvent()
|
|
const groupLabel = getContentListingGroupLabel(group)
|
|
|
|
const trackClick = useCallback(
|
|
(item: ContentListingItem) => {
|
|
sendTelemetryEvent({
|
|
action: 'docs_content_listing_clicked',
|
|
properties: {
|
|
targetPath: item.href,
|
|
linkTitle: item.title,
|
|
...(groupLabel ? { groupTitle: groupLabel } : {}),
|
|
listingId: group.id,
|
|
},
|
|
})
|
|
},
|
|
[sendTelemetryEvent, group.id, groupLabel]
|
|
)
|
|
|
|
return { trackClick }
|
|
}
|
|
|
|
function ContentListingGroupHeading({ group }: { group: ContentListingGroup }) {
|
|
if (!group.heading) return null
|
|
|
|
return <Heading tag={group.headingLevel ?? 'h2'}>{group.heading}</Heading>
|
|
}
|
|
|
|
function ContentListingsGroup({ group }: { group: ContentListingGroup }) {
|
|
const { trackClick } = useContentListingClickHandler(group)
|
|
const items = useMemo(() => filterContentListingItems(group.items), [group.items])
|
|
const isGrid = group.type === 'grid'
|
|
const listClassName = isGrid ? 'grid md:grid-cols-12 gap-4' : 'list-disc pl-6 space-y-2'
|
|
const gridItemClassName = isGrid ? GRID_ITEM_CLASS[group.columns ?? 3] : undefined
|
|
|
|
if (!items.length) return null
|
|
|
|
// Heading stays outside `not-prose` so it inherits the surrounding MDX prose
|
|
// typography. The list itself opts out so its explicit Tailwind layout wins.
|
|
return (
|
|
<section className="space-y-4">
|
|
<ContentListingGroupHeading group={group} />
|
|
<div className="not-prose space-y-4">
|
|
{group.description && (
|
|
<div className="text-foreground-light [&_a]:text-foreground [&_a]:underline [&_p]:m-0">
|
|
<ReactMarkdown>{group.description}</ReactMarkdown>
|
|
</div>
|
|
)}
|
|
<ul className={listClassName}>
|
|
{items.map((item) => {
|
|
const external = isExternalContentListingHref(item.href)
|
|
const key = `${group.id}-${item.href}`
|
|
|
|
if (isGrid) {
|
|
return (
|
|
<li key={key} className={gridItemClassName}>
|
|
<Link
|
|
href={item.href}
|
|
passHref
|
|
className="block h-full"
|
|
onClick={() => trackClick(item)}
|
|
target={external ? '_blank' : undefined}
|
|
rel={external ? 'noopener noreferrer' : undefined}
|
|
>
|
|
<GlassPanel
|
|
title={item.title}
|
|
icon={resolveContentListingIcon(item.icon)}
|
|
hasLightIcon={item.hasLightIcon ?? typeof item.icon === 'string'}
|
|
badge={
|
|
item.badge && item.badgePosition !== 'below' ? (
|
|
<Badge variant="success">{item.badge}</Badge>
|
|
) : undefined
|
|
}
|
|
>
|
|
{item.badge && item.badgePosition === 'below' && (
|
|
<Badge variant="success" className="mb-3 block w-fit">
|
|
{item.badge}
|
|
</Badge>
|
|
)}
|
|
{item.subtitle && (
|
|
<span className="mb-2 block text-tertiary-foreground">{item.subtitle}</span>
|
|
)}
|
|
{item.description}
|
|
</GlassPanel>
|
|
</Link>
|
|
</li>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<li key={key}>
|
|
<Link
|
|
href={item.href}
|
|
onClick={() => trackClick(item)}
|
|
target={external ? '_blank' : undefined}
|
|
rel={external ? 'noopener noreferrer' : undefined}
|
|
>
|
|
<strong>{item.title}</strong>: {item.description}
|
|
</Link>
|
|
</li>
|
|
)
|
|
})}
|
|
</ul>
|
|
</div>
|
|
</section>
|
|
)
|
|
}
|
|
|
|
export function ContentListings({ id }: { id: string }) {
|
|
const group = getContentListingById(id)
|
|
if (!group || !filterContentListingItems(group.items).length) return null
|
|
|
|
return (
|
|
<div className="my-10 space-y-10">
|
|
<ContentListingsGroup group={group} />
|
|
</div>
|
|
)
|
|
}
|