import React from 'react'; import { Alert, Screen, AlertSeverity } from '../../types'; import { MobileBottomNav } from './MobileLayout'; interface OperatorTasksScreenProps { tasks: Alert[]; onNavigate: (screen: Screen) => void; } const getTaskFromAlert = (alert: Alert) => { let taskTitle = 'Tugas Tidak Dikenal'; let icon = 'fa-question-circle'; const locationMatch = alert.message.match(/di (.*?)(?:\(|$)/); const location = locationMatch?.[1]?.trim() || 'Lokasi tidak diketahui'; if (alert.message.toLowerCase().includes('mortalitas')) { taskTitle = 'Tangani Mortalitas'; icon = 'fa-skull-crossbones text-red-600'; } else if (alert.message.toLowerCase().includes('kepadatan')) { taskTitle = 'Periksa Kepadatan'; icon = 'fa-users text-yellow-600'; } else if (alert.message.toLowerCase().includes('suhu')) { taskTitle = 'Cek Suhu Kandang'; icon = 'fa-temperature-high text-red-600'; } else if (alert.message.toLowerCase().includes('offline')) { taskTitle = 'Periksa Sensor Offline'; icon = 'fa-satellite-dish text-yellow-600'; } return { title: taskTitle, icon, location }; }; const TaskCard: React.FC<{ alert: Alert }> = ({ alert }) => { const { title, icon, location } = getTaskFromAlert(alert); const isCritical = alert.severity === AlertSeverity.CRITICAL; return (

{title}

{location}

); }; const OperatorTasksScreen: React.FC = ({ tasks, onNavigate }) => (

Tugas Hari Ini

Tugas dibuat otomatis dari notifikasi kritis.

{tasks.length > 0 ? ( tasks.map((task) => ) ) : (

Semua tugas selesai!

)}
); export default OperatorTasksScreen;