import { ArrowUpRight } from 'lucide-react'
import type { ReactNode } from 'react'
import { cn } from 'ui'
import { getMarketplaceType, getMarketplaceTypeLabel } from './Marketplace.constants'
import type { IntegrationDefinition } from '@/components/interfaces/Integrations/Landing/Integrations.constants'
interface RailRowProps {
label: string
value: ReactNode
href?: string
mono?: boolean
}
const RailRow = ({ label, value, href, mono }: RailRowProps) => {
const valueCls = cn(
'flex items-center gap-1 text-sm',
href ? 'text-brand-link' : 'text-foreground',
mono && 'font-mono'
)
const content = (
<>
{value}
{href && }
>
)
return (
{label}
{href ? (
{content}
) : (
{content}
)}
)
}
interface RailGroupProps {
title: string
children: ReactNode
}
const RailGroup = ({ title, children }: RailGroupProps) => (
)
interface MarketplaceDetailRailProps {
integration: IntegrationDefinition
isInstalled: boolean
}
const tryHostname = (url: string | null | undefined) => {
if (!url) return undefined
try {
return new URL(url).hostname
} catch {
return undefined
}
}
export const MarketplaceDetailRail = ({ integration, isInstalled }: MarketplaceDetailRailProps) => {
const typeLabel = getMarketplaceTypeLabel(getMarketplaceType(integration))
const docsUrl = integration.docsUrl ?? undefined
const siteUrl = integration.siteUrl ?? undefined
const siteHost = tryHostname(siteUrl)
return (
)
}