'use client'; import { Shield, BarChart3, Palette, Link, Wrench, MoreVertical, Power, Settings, Trash2, Download, Star, User, Calendar, CheckCircle, XCircle, Sparkles, Crown, Zap } from 'lucide-react'; import { Switch } from '@/components/ui/switch'; import { Button } from '@/components/ui/button'; import { Badge } from '@/components/ui/badge'; import { S3ConfigModal } from './S3ConfigModal'; import { useState } from 'react'; import { Plugin } from '@/lib/plugins/config'; interface PluginCardProps { plugin: Plugin; onToggle: (pluginId: string) => void; } const categoryConfig = { security: { icon: Shield, label: 'Seguridad', color: 'text-red-600 dark:text-red-400' }, analytics: { icon: BarChart3, label: 'Analíticas', color: 'text-blue-600 dark:text-blue-400' }, ui: { icon: Palette, label: 'Interfaz', color: 'text-purple-600 dark:text-purple-400' }, integration: { icon: Link, label: 'Integración', color: 'text-emerald-600 dark:text-emerald-400' }, utility: { icon: Wrench, label: 'Utilidades', color: 'text-amber-600 dark:text-amber-400' } }; export function PluginCard({ plugin, onToggle }: PluginCardProps) { const [showS3Modal, setShowS3Modal] = useState(false); const config = categoryConfig[plugin.category]; const CategoryIcon = config.icon; const handleConfigureClick = () => { if (plugin.id === 's3') { setShowS3Modal(true); } }; const handleS3ConfigSave = async (s3Config: any) => { try { const response = await fetch('/api/plugins/s3', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify(s3Config), }); if (!response.ok) { throw new Error('Error al guardar la configuración'); } const result = await response.json(); if (!result.success) { throw new Error(result.error || 'Error al guardar la configuración'); } } catch (error) { console.error('Error saving S3 config:', error); throw error; } }; return (
{plugin.description}