| 15 | } |
| 16 | |
| 17 | export function AgentCard({ agent, onEdit, onDelete, onToggle }: AgentCardProps) { |
| 18 | const sourceLabel = agent.source === "json" ? "JSON" : agent.source === "markdown" ? "Markdown" : "Built-in"; |
| 19 | const modeLabel = agent.mode || "subagent"; |
| 20 | |
| 21 | return ( |
| 22 | <Card className={cn("border-border/70", agent.disabled && "opacity-60")}> |
| 23 | <CardHeader className="pb-2"> |
| 24 | <div className="flex flex-wrap items-center gap-2"> |
| 25 | <Badge variant="secondary">{modeLabel}</Badge> |
| 26 | <Badge variant="outline">{sourceLabel}</Badge> |
| 27 | {agent.disabled && <Badge variant="destructive">Disabled</Badge>} |
| 28 | </div> |
| 29 | <CardTitle className="text-base">{agent.name}</CardTitle> |
| 30 | </CardHeader> |
| 31 | <CardContent className="space-y-3"> |
| 32 | <div className="text-sm text-muted-foreground"> |
| 33 | {agent.description || "No description"} |
| 34 | </div> |
| 35 | {agent.model && ( |
| 36 | <div className="text-xs text-muted-foreground font-mono">{agent.model}</div> |
| 37 | )} |
| 38 | <div className="flex items-center gap-2"> |
| 39 | <Button size="sm" variant="outline" onClick={() => onToggle(agent)}> |
| 40 | {agent.disabled ? <ToggleRight className="h-4 w-4" /> : <ToggleLeft className="h-4 w-4" />} |
| 41 | {agent.disabled ? "Enable" : "Disable"} |
| 42 | </Button> |
| 43 | <Button size="sm" variant="ghost" onClick={() => onEdit(agent)}> |
| 44 | <Code className="h-4 w-4" /> |
| 45 | Edit |
| 46 | </Button> |
| 47 | <Button size="sm" variant="ghost" className="text-destructive" onClick={() => onDelete(agent)}> |
| 48 | <Trash className="h-4 w-4" /> |
| 49 | Delete |
| 50 | </Button> |
| 51 | </div> |
| 52 | </CardContent> |
| 53 | </Card> |
| 54 | ); |
| 55 | } |