mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 09:55:06 +03:00
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Docs restructure of the self-hosting overview: short fit intro, Get started / community listings above the fold, parallel h2 sections for how self-hosting differs (including local development), responsibilities, and telemetry, plus a streamlined support listing with better card content. Closes DOCS-1251. ## What is the current behavior? - Linear item: Explore two PR approaches for the self-hosting page - The self-hosting overview page (`/guides/self-hosting`) is the top search hit for "supabase self-hosting," but reads as a wall of text: three full prose/bullet sections (differs / responsibilities / telemetry) come before the getting-started CTA, which is buried as one small card partway down the page. ## What is the new behavior? - Short fit intro; `self-hosting-get-started` and `self-hosting-community` listings sit directly under the intro. - Top-level h2s for how self-hosting differs, responsibilities, telemetry, and support (no "More about self-hosting" wrapper). - Under differs: rewritten single-project + platform-gap copy, plus `### Not the same as local development` (CLI stack is not a production self-host; points to Docker / community options). - Telemetry clarifies CLI local-dev telemetry vs Docker Compose (no phone-home). - Merged support into a single `self-hosting-support` listing; Enterprise subsection unchanged. - Minor a11y: `aria-hidden` on GlassPanel decorative icon background. ## Additional context - Worktree: `~/GitHub/supabase/supabase-worktrees/nikrichers/docs-1251-self-hosting-inform` - Review: removed the "More about self-hosting" grouping after feedback that it undersold differs / responsibilities. - Companion prototype PR 48416 is closed; this branch is the direction under review. - Verification: | Check | Result | | ----------------------------------------------- | ------------------------------------------------------------------ | | `pnpm lint:mdx content/guides/self-hosting.mdx` | Pass — no errors/warnings on this file | | Vercel docs preview | Pass — full-page after screenshot captured from the preview deploy | ### Proof: intro and get-started above the fold; parallel h2s for differs, responsibilities, and telemetry **Verified:** `pnpm lint:mdx content/guides/self-hosting.mdx` (pass) · Vercel docs preview (pass) ### Before & After | [Before (production)](https://supabase.com/docs/guides/self-hosting) | [After (PR preview)](https://docs-git-nikrichers-docs-1251-self-hosting-inform-supabase.vercel.app/docs/guides/self-hosting) | | ------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- | |  |  | ### Test plan - [ ] Visit the preview link and confirm the page opens with intro above the Get started listings - [ ] Confirm parallel h2s for differs / responsibilities / telemetry / support (no "More about self-hosting") - [ ] Confirm "Not the same as local development" distinguishes the CLI stack from self-hosting - [ ] Confirm Support and community is one card grid - [ ] Check mobile width — layout should still be usable - [ ] Confirm `/guides/self-hosting/docker` link still works <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Documentation** - Reorganized the self-hosting guide with clearer getting-started resources and community links. - Added dedicated guidance for local development, managed Supabase, telemetry, and self-hosting responsibilities. - Consolidated support resources into one section covering discussions, issues, chat, Reddit, and sharing experiences. - **Accessibility** - Marked decorative icon backgrounds as hidden from assistive technologies. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Nik Richers <nik@validmind.ai> Co-authored-by: Claude <noreply@anthropic.com>
142 lines
4.9 KiB
TypeScript
142 lines
4.9 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 } from 'ui'
|
|
import { GlassPanel } from 'ui-patterns/GlassPanel'
|
|
import { Heading } from 'ui/src/components/CustomHTMLElements'
|
|
|
|
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.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>
|
|
)
|
|
}
|