import { Button } from '@heroui/button'; import { Switch } from '@heroui/switch'; import { Chip } from '@heroui/chip'; import { useState } from 'react'; import { MdDeleteForever, MdPublishedWithChanges } from 'react-icons/md'; import DisplayCardContainer from './container'; import { PluginItem } from '@/controllers/plugin_manager'; export interface PluginDisplayCardProps { data: PluginItem; onReload: () => Promise; onToggleStatus: () => Promise; onUninstall: () => Promise; } const PluginDisplayCard: React.FC = ({ data, onReload, onToggleStatus, onUninstall, }) => { const { name, version, author, description, status } = data; const isEnabled = status !== 'disabled'; const [processing, setProcessing] = useState(false); const handleToggle = () => { setProcessing(true); onToggleStatus().finally(() => setProcessing(false)); }; const handleReload = () => { setProcessing(true); onReload().finally(() => setProcessing(false)); }; const handleUninstall = () => { setProcessing(true); onUninstall().finally(() => setProcessing(false)); }; return ( } enableSwitch={ } title={name} tag={ {status === 'active' ? '运行中' : status === 'stopped' ? '已停止' : '已禁用'} } >
版本
{version}
作者
{author || '未知'}
描述
{description || '暂无描述'}
); }; export default PluginDisplayCard;