import React from "react"; import { MoreHorizontal } from "lucide-react"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Card } from "@/components/ui/card"; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "@/components/ui/dialog"; import { Switch } from "@/components/ui/switch"; import { cn } from "@/lib/utils"; import type { AiBuilderAgentItem } from "./types"; // --------------------------------------------------------------------------- // AgentCard // --------------------------------------------------------------------------- export type AgentCardProps = { agent: AiBuilderAgentItem; /** Brand icon shown before the title (e.g. a platform connector's logo). */ iconNode?: React.ReactNode; onToggle: (agentId: string, enabled: boolean) => void; onMenuClick: (agentId: string) => void; className?: string; }; export function AgentCard({ agent, iconNode, onToggle, onMenuClick, className, }: AgentCardProps) { const { id, title, description, tags, isEnabled, infoBadge, isComingSoon } = agent; return (
{iconNode && ( {iconNode} )} {title} {isComingSoon && ( Coming Soon )}
onToggle(id, checked)} aria-label={`Toggle ${title}`} />

{description}

{infoBadge && (

{infoBadge}

)} {tags.length > 0 && (
{tags.map((tag) => ( {tag} ))}
)}
); } // --------------------------------------------------------------------------- // AgentMenuModal // --------------------------------------------------------------------------- export type AgentMenuModalProps = { open: boolean; onOpenChange: (open: boolean) => void; agentTitle: string; /** * Agent-specific description. Callers should look this up from a * slug-keyed content map and fall back to the agent's own backend * description when no authored entry exists — never a shared generic * default (see agent-card.md changelog, BUILD-2354). */ description?: string; /** Capability bullets. Omit (or pass an empty array) when no authored content exists. */ features?: Array<{ title: string; description: string }>; /** Short "for example" scenario illustrating what the agent does. */ example?: string; /** Data sources / fields this agent reads or writes. */ dataTouched?: string[]; }; export function AgentMenuModal({ open, onOpenChange, agentTitle, description = "Details for this agent haven't been added yet.", features = [], example, dataTouched, }: AgentMenuModalProps) { return ( {agentTitle} {description} {features.length > 0 && (
{features.map((feature, index) => (
{index + 1}

{feature.title}

{feature.description}

))}
)} {example && (

Example

{example}

)} {dataTouched && dataTouched.length > 0 && (

Data this agent touches

{dataTouched.map((item) => ( {item} ))}
)}
); }