import { ReactNode } from 'react'; import Switch from '../form/switch/Switch'; import Button from '../ui/button/Button'; import Badge from '../ui/badge/Badge'; import { Site } from '../../services/api'; interface SiteCardProps { site: Site; icon: ReactNode; onToggle: (siteId: number, enabled: boolean) => void; onSettings: (site: Site) => void; onDetails: (site: Site) => void; isToggling?: boolean; } export default function SiteCard({ site, icon, onToggle, onSettings, onDetails, isToggling = false, }: SiteCardProps) { const handleToggle = (enabled: boolean) => { onToggle(site.id, enabled); }; const getStatusColor = () => { if (site.is_active) { return 'bg-green-500 dark:bg-green-600'; } return 'bg-gray-400 dark:bg-gray-500'; }; const getStatusText = () => { if (site.is_active) { return { text: 'Active', color: 'text-green-600 dark:text-green-400', bold: true }; } return { text: 'Inactive', color: 'text-gray-400 dark:text-gray-500', bold: false }; }; const statusText = getStatusText(); return (
{icon}

{site.name}

{site.description || 'No description'}

{site.domain && (

{site.domain}

)}
{site.industry_name && ( {site.industry_name} )} {site.active_sectors_count} / 5 Sectors {site.status && ( {site.status} )}
{/* Status Text and Circle - Same row */}
{statusText.text}
); }