'use client'; interface Activity { id: string; action: string; entity_type: string; entity_id?: string; user_name?: string; description?: string; created_at: string; } interface Props { activities: Activity[]; maxItems?: number; } const actionIcons: Record = { create: 'βž•', update: '✏️', delete: 'πŸ—‘οΈ', submit: 'πŸ“€', approve: 'βœ…', reject: '❌', scan: 'πŸ”', export: 'πŸ“Š', login: 'πŸ”', batch_delete: 'πŸ—‘οΈ', }; const entityIcons: Record = { aircraft: '✈️', organization: '🏒', cert_application: 'πŸ“‹', risk_alert: '⚠️', audit: 'πŸ”', checklist: 'βœ…', user: 'πŸ‘€', notification: 'πŸ””', }; export default function ActivityTimeline({ activities, maxItems = 20 }: Props) { const items = activities.slice(0, maxItems); if (!items.length) return
НСт активности
; return (
{items.map((a, i) => (
{/* Timeline line */} {i < items.length - 1 &&
} {/* Icon */}
{actionIcons[a.action] || entityIcons[a.entity_type] || 'πŸ“'}
{/* Content */}
{a.user_name || 'БистСма'} Β· {a.action} Β· {a.entity_type}
{new Date(a.created_at).toLocaleString('ru-RU', { hour: '2-digit', minute: '2-digit', day: 'numeric', month: 'short' })}
{a.description &&
{a.description}
}
))}
); }