"use client" import { cn, type CodeHostType, getCodeHostIcon } from "@/lib/utils" import placeholderLogo from "@/public/placeholder_avatar.png" import { BlocksIcon, LockIcon } from "lucide-react" import Image from "next/image" import Link from "next/link" import { useMemo } from "react" import { OrgRole } from "@sourcebot/db" interface NewConnectionCardProps { className?: string role: OrgRole configPathProvided: boolean } export const NewConnectionCard = ({ className, role, configPathProvided }: NewConnectionCardProps) => { const isOwner = role === OrgRole.OWNER const isDisabled = !isOwner || configPathProvided return (
{isDisabled && (
)}

Connect to a Code Host

Create a connection to import repos from a code host.

{isDisabled && (

{configPathProvided ? "Connections are managed through the configuration file." : "Only organization owners can manage connections."}

)}
) } interface CardProps { type: string title: string subtitle: string disabled?: boolean } const Card = ({ type, title, subtitle, disabled = false }: CardProps) => { const Icon = useMemo(() => { const iconInfo = getCodeHostIcon(type as CodeHostType) if (iconInfo) { const { src, className } = iconInfo return ( {`${type} ) } return ( {`${type} ) }, [type, disabled]) const CardContent = (
{Icon}

{title}

{subtitle}

) if (disabled) { return CardContent } return ( {CardContent} ) }