mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 15:39:13 +00:00
The current add-ons page only lists a subset of available add-ons, which often causes confusion with things like Advanced MFA Auth (customers cant find where to configure it). The revised add-on page covers all potentially configured project add-ons including replicas and advanced disk. This should help the customer locate configured add-ons and at the same time discover potentially interesting add-ons. This can be enhanced further in the future with "smart" suggestions based on usage.
71 lines
1.7 KiB
TypeScript
71 lines
1.7 KiB
TypeScript
import { BookOpenIcon } from 'lucide-react'
|
|
import type { MouseEvent } from 'react'
|
|
import { Button } from 'ui'
|
|
|
|
import { ButtonTooltip } from '@/components/ui/ButtonTooltip'
|
|
import { useTrack } from '@/lib/telemetry/track'
|
|
|
|
interface DocsButtonProps {
|
|
href: string
|
|
abbrev?: boolean
|
|
className?: string
|
|
topic?: string
|
|
/** Custom button text, e.g. to distinguish multiple docs buttons side by side. */
|
|
label?: string
|
|
/** Shows only the book icon, with the label in a tooltip */
|
|
iconOnly?: boolean
|
|
}
|
|
|
|
export const DocsButton = ({
|
|
href,
|
|
abbrev = true,
|
|
className,
|
|
topic,
|
|
label,
|
|
iconOnly = false,
|
|
}: DocsButtonProps) => {
|
|
const track = useTrack()
|
|
|
|
const handleClick = (e: MouseEvent<HTMLElement>) => {
|
|
e.stopPropagation()
|
|
track('docs_button_clicked', { ...(topic && { topic }) })
|
|
}
|
|
|
|
const text = label ?? (abbrev ? 'Docs' : 'Documentation')
|
|
const topicLabel = topic ? `${topic} documentation (opens in new tab)` : undefined
|
|
|
|
if (iconOnly) {
|
|
return (
|
|
<ButtonTooltip
|
|
asChild
|
|
variant="default"
|
|
className={className}
|
|
icon={<BookOpenIcon />}
|
|
onClick={handleClick}
|
|
tooltip={{ content: { side: 'bottom', text } }}
|
|
>
|
|
<a
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
href={href}
|
|
aria-label={topicLabel ?? `${text} (opens in new tab)`}
|
|
/>
|
|
</ButtonTooltip>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<Button
|
|
asChild
|
|
variant="default"
|
|
className={className}
|
|
icon={<BookOpenIcon />}
|
|
onClick={handleClick}
|
|
>
|
|
<a target="_blank" rel="noopener noreferrer" href={href} aria-label={topicLabel}>
|
|
{text}
|
|
</a>
|
|
</Button>
|
|
)
|
|
}
|