import React from 'react'; import { LiveCount } from '../../types'; import { formatNumber } from '../../utils/formatters.ts'; const statusConfig: { [key in LiveCount['status']]: { text: string; bg: string; pulse: boolean; icon: string }; } = { online: { text: 'Menghitung', bg: 'bg-green-500', pulse: true, icon: 'fa-video' }, offline: { text: 'Offline', bg: 'bg-gray-500', pulse: false, icon: 'fa-video-slash' }, processing: { text: 'Memproses', bg: 'bg-blue-500', pulse: true, icon: 'fa-cogs' }, }; const CameraCountCard: React.FC<{ liveCount: LiveCount }> = ({ liveCount }) => { const status = statusConfig[liveCount.status]; return (
{liveCount.cameraName}
{status.pulse && ( )} {status.text}
{liveCount.status === 'online' && (

{formatNumber(liveCount.count)}

ekor terdeteksi

)} {liveCount.status !== 'online' && (
)}

{liveCount.cameraName}

{liveCount.locationName}

); }; export default CameraCountCard;