import { useState, useEffect } from 'react' import { useCSFApi } from '@/hooks/use-csf-api' interface FirewallStatusCardProps { className?: string } export function FirewallStatusCard({ className = '' }: FirewallStatusCardProps) { const { status, getStatus, startFirewall, stopFirewall, restartFirewall, loading, error } = useCSFApi() const [actionLoading, setActionLoading] = useState(false) useEffect(() => { getStatus() }, [getStatus]) const handleAction = async (action: () => Promise) => { setActionLoading(true) try { await action() } finally { setActionLoading(false) } } const getStatusColor = () => { if (!status) return 'bg-gray-500' return status.running ? 'bg-green-500' : 'bg-red-500' } const getStatusText = () => { if (!status) return 'Desconocido' return status.running ? 'Activo' : 'Inactivo' } return (

Estado del Firewall

{error && (

{error}

)}
Estado: {getStatusText()}
{status && ( <>
Versión: {status.version}
IPv4: {status.ipv4_active ? 'Activo' : 'Inactivo'}
IPv6: {status.ipv6_active ? 'Activo' : 'Inactivo'}
{status.testing_mode && (

⚠️ Modo de prueba activado

)} )}
) }