"use client"; import Link from "next/link"; import Image from "next/image"; import { useTranslations } from "next-intl"; import type { CliCatalogEntry } from "@/shared/schemas/cliCatalog"; import type { ToolBatchStatus } from "@/shared/types/cliBatchStatus"; import CliStatusBadge from "@/app/(dashboard)/dashboard/cli-code/components/CliStatusBadge"; import { cn } from "@/shared/utils/cn"; export interface CliToolCardProps { tool: CliCatalogEntry; batchStatus: ToolBatchStatus | null; detailHref: string; hasActiveProviders: boolean; } export default function CliToolCard({ tool, batchStatus, detailHref, hasActiveProviders, }: CliToolCardProps) { const t = useTranslations("cliCommon"); const installed = batchStatus?.detection.installed ?? false; const configStatus = batchStatus?.config.status ?? null; const version = batchStatus?.detection.version ?? "not found"; const endpoint = batchStatus?.config.endpoint ?? null; const showInstallChips = !installed && tool.configType !== "guide"; const title = (
{/* Icon / image */} {tool.image ? ( {tool.name} ) : ( )}
{tool.name} {version}

{tool.description}

chevron_right
); return ( {/* Header */} {title} {/* Status strip */}
{/* Detection */} {installed ? t("card.detected") : t("card.notDetected")} {/* Config status */} {configStatus && ( )} {/* Endpoint */} {endpoint && ( {endpoint} )}
{/* Badges row */}
{tool.baseUrlSupport === "partial" && ( {t("card.baseUrlPartial")} )} {tool.acpSpawnable === true && ( {t("card.alsoAcp")} )} {showInstallChips && ( <> 📋 Manual config ⬇ Install )}
{/* Footer */}
{installed ? t("card.configure") : t("card.howToInstall")} {!hasActiveProviders && ( {t("card.connectProviderHint")} )}
); }