import type { LucideIcon } from 'lucide-react' import type { ReactNode } from 'react' import { cn } from 'ui' import { ShimmeringLoader } from 'ui-patterns/ShimmeringLoader' import { DocsButton } from '@/components/ui/DocsButton' import { ResourceList } from '@/components/ui/Resource/ResourceList' export interface AddonRowProps { icon: LucideIcon title: string description: string docsUrl: string isEnabled: boolean /** Short state shown on the right (e.g. "Enabled", "Small", "2 active"). Hidden while loading. */ status?: string /** Secondary text under the status (e.g. price). When multiple lines are passed, the first is emphasized. */ detail?: string | readonly string[] action: ReactNode isLoading?: boolean isError?: boolean } const AddonDetail = ({ detail }: { detail: string | readonly string[] }) => { const lines = typeof detail === 'string' ? [detail] : detail if (lines.length === 0) return null const [firstLine, ...otherLines] = lines return (
0 && 'text-foreground-light')}>{firstLine}
{otherLines.map((line, index) => (
{line}
))}
) } export const AddonRow = ({ icon: Icon, title, description, docsUrl, isEnabled, status, detail, action, isLoading = false, isError = false, }: AddonRowProps) => { return (
{title}

{description}

{isLoading && } {!isLoading && isError && Failed to load} {!isLoading && !isError && ( <> {status && (
{status}
)} {detail && } )}
{action}
) } interface AddonCategoryProps { label: string children: ReactNode } export const AddonCategory = ({ label, children }: AddonCategoryProps) => (

{label}

{children}
)