mirror of
https://github.com/supabase/supabase.git
synced 2026-10-09 11:25:06 +03:00
## Summary Brings the Log Drains docs up to the same standard as the Metrics API page. - Replaces the plain destination table with a visual `LogDrainDestinationCards` component — a 3-column card grid that mirrors the product UI destination picker. Cards link to anchors on the same page (no sub-pages needed since setup is simpler than Metrics). - Adds a "What you can do" intro section and a consistent "Required configuration + Steps" structure for every destination. - Adds two destinations that were missing from the docs entirely: **Last9** and **Syslog** (both are live in the product). Config fields sourced from `LogDrainDestinationSheetForm.tsx`. - Cleans up raw `<ul><li>` HTML to markdown lists. - Adds an "Additional resources" footer (pricing, Metrics API, JS SDK tracing). ## Files changed - `apps/docs/content/guides/telemetry/log-drains.mdx` — core of the changes - `apps/docs/components/LogDrainDestinationCards.tsx` — new card grid component - `apps/docs/components/LogDrainDestinationCards.data.ts` — destination data (9 entries) - `apps/docs/internals/markdown-schema/LogDrainDestinationCards.ts` — markdown fallback renderer - `apps/docs/features/docs/MdxBase.shared.tsx` — register new component - `apps/docs/internals/generate-guides-markdown.ts` — register new component ## 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 update ## What is the current behavior? not supanice, also missing syslog and last9 <img width="619" height="687" alt="image" src="https://github.com/user-attachments/assets/58e8f07c-eb40-4d30-a5e2-3988d1af87c2" /> ## What is the new behavior? hopefully more supanice, also added syslog and last9 <img width="568" height="667" alt="image" src="https://github.com/user-attachments/assets/be61e67f-58aa-4e8c-be0d-44206f1b16de" /> ## Additional context <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Reorganized the Log Drains guide with destination-specific sections and a new destination chooser. * Added support and setup guidance for Last9 and Syslog destinations. * Clarified HTTP batching, JSON delivery, compression, authentication, and endpoint requirements. * Updated OpenTelemetry, Datadog, Loki, Amazon S3, Sentry, and Axiom instructions. * Added Edge Function examples covering compressed and uncompressed payloads. * Added links to pricing, Metrics API, and JavaScript tracing resources. * **UI Improvements** * Updated destination listings with clearer, consistent icons and presentation. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Nik Richers <nik@validmind.ai>
121 lines
3.9 KiB
TypeScript
121 lines
3.9 KiB
TypeScript
'use client'
|
|
|
|
import type { ContentListingGroup, ContentListingItem } from '~/lib/content-listings.schema'
|
|
import {
|
|
getContentListingById,
|
|
getContentListingGroupLabel,
|
|
isExternalContentListingHref,
|
|
} from '~/lib/content-listings.utils'
|
|
import { useSendTelemetryEvent } from '~/lib/telemetry'
|
|
import Link from 'next/link'
|
|
import { useCallback } from 'react'
|
|
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 = {
|
|
2: 'col-span-12 md:col-span-6',
|
|
3: 'col-span-12 md:col-span-4',
|
|
4: 'col-span-12 md: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 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
|
|
|
|
// 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 && <p className="text-foreground-light">{group.description}</p>}
|
|
<ul className={listClassName}>
|
|
{group.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}
|
|
>
|
|
<GlassPanel
|
|
title={item.title}
|
|
icon={resolveContentListingIcon(item.icon)}
|
|
hasLightIcon={item.hasLightIcon ?? typeof item.icon === 'string'}
|
|
badge={item.badge ? <Badge variant="success">{item.badge}</Badge> : undefined}
|
|
>
|
|
{item.description}
|
|
</GlassPanel>
|
|
</Link>
|
|
</li>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<li key={key}>
|
|
<Link
|
|
href={item.href}
|
|
onClick={() => trackClick(item)}
|
|
target={external ? '_blank' : undefined}
|
|
>
|
|
<strong>{item.title}</strong>: {item.description}
|
|
</Link>
|
|
</li>
|
|
)
|
|
})}
|
|
</ul>
|
|
</div>
|
|
</section>
|
|
)
|
|
}
|
|
|
|
export function ContentListings({ id }: { id: string }) {
|
|
const group = getContentListingById(id)
|
|
if (!group || !group.items.length) return null
|
|
|
|
return (
|
|
<div className="my-10 space-y-10">
|
|
<ContentListingsGroup group={group} />
|
|
</div>
|
|
)
|
|
}
|