import React from 'react'; import { Camera, CameraType } from '../../types.ts'; interface CameraCardProps { camera: Camera; onEdit: () => void; onDelete: () => void; } const statusConfig: { [key in Camera['status']]: { text: string; bg: string; pulseClass: string }; } = { online: { text: 'Online', bg: 'bg-green-500', pulseClass: 'bg-green-300 animate-pulse' }, offline: { text: 'Offline', bg: 'bg-gray-500', pulseClass: 'bg-gray-300' }, error: { text: 'Error', bg: 'bg-red-500', pulseClass: 'bg-red-300' }, }; const typeConfig: { [key in CameraType]: { icon: string; color: string } } = { [CameraType.STANDARD]: { icon: 'fa-video', color: 'text-gray-500' }, [CameraType.INFRARED]: { icon: 'fa-moon', color: 'text-purple-500' }, [CameraType.THERMAL]: { icon: 'fa-temperature-high', color: 'text-orange-500' }, [CameraType.THREE_D]: { icon: 'fa-cube', color: 'text-blue-500' }, }; const CameraCard: React.FC = ({ camera, onEdit, onDelete }) => { const status = statusConfig[camera.status]; const typeInfo = typeConfig[camera.cameraType] || typeConfig[CameraType.STANDARD]; return (
{status.text}

{camera.name}

{camera.cameraType}

{camera.model}

); }; export default CameraCard;