'use client'; // File: components/reminder/ReminderHistory.tsx import { format } from 'date-fns'; import { History, Bell, ShieldAlert, AlertTriangle } from 'lucide-react'; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from '@/components/ui/card'; import { useReminderHistory } from '@/hooks/use-reminder'; import { ReminderType } from '@/types/workflow'; interface ReminderHistoryProps { taskPublicId: string; } export function ReminderHistoryViewer({ taskPublicId }: ReminderHistoryProps) { const { data: history = [], isLoading } = useReminderHistory(taskPublicId); const getIcon = (type: ReminderType) => { switch (type) { case ReminderType.ESCALATION_L1: return ; case ReminderType.ESCALATION_L2: return ; default: return ; } }; return ( Reminder History ประวัติการแจ้งเตือนและการยกระดับ {isLoading ? ( Loading history... ) : history.length === 0 ? ( No reminders sent yet. ) : ( {history.map((item) => ( {getIcon(item.reminderType)} {item.reminderType.replace('_', ' ')} {format(new Date(item.sentAt), 'dd MMM yyyy HH:mm')} Sent to: {item.user?.fullName ?? 'Unknown User'} {item.escalationLevel > 0 && ` (L${item.escalationLevel})`} ))} )} ); }
Sent to: {item.user?.fullName ?? 'Unknown User'} {item.escalationLevel > 0 && ` (L${item.escalationLevel})`}