"use client"; import { IconArrowUpCircle } from "@tabler/icons-react"; import { Badge } from "@kandev/ui/badge"; import { Button } from "@kandev/ui/button"; import Link from "@/components/routing/app-link"; import { PluginRepoLink } from "./plugin-repo-link"; import { PluginStatusBadge } from "./plugin-status-badge"; import type { MarketplaceEntry, PluginRecord } from "@/lib/types/plugins"; type PluginRowProps = { plugin: PluginRecord; busy: boolean; /** Set when the marketplace has a newer version than the installed one. */ update?: MarketplaceEntry; onEnable: (plugin: PluginRecord) => void; onDisable: (plugin: PluginRecord) => void; onUninstall: (plugin: PluginRecord) => void; onUpdate?: (entry: MarketplaceEntry) => void; }; /** * One plugin's row. Div-based (not a ``) so it wraps/stacks naturally * on narrow viewports and inside the mobile settings sheet — no separate * mobile layout needed. */ export function PluginRow({ plugin, busy, update, onEnable, onDisable, onUninstall, onUpdate, }: PluginRowProps) { const canEnable = plugin.status === "disabled" || plugin.status === "registered"; const canDisable = plugin.status === "active" || plugin.status === "error"; return (
{plugin.display_name} {plugin.signed === false && ( unsigned )}
{plugin.id} · v{plugin.version}
{plugin.description && (
{plugin.description}
)} {plugin.categories.length > 0 && (
{plugin.categories.map((category) => ( {category} ))}
)}
); } type PluginRowActionsProps = Omit & { canEnable: boolean; canDisable: boolean; onEnable: (plugin: PluginRecord) => void; onDisable: (plugin: PluginRecord) => void; onUninstall: (plugin: PluginRecord) => void; }; function PluginRowActions({ plugin, busy, update, canEnable, canDisable, onEnable, onDisable, onUninstall, onUpdate, }: PluginRowActionsProps) { return (
{update && onUpdate && ( )} {canEnable && ( )} {canDisable && ( )}
); }