import { useTranslation } from 'react-i18next'; import { CheckCircle, AlertTriangle, Store, Monitor, X } from 'lucide-react'; import { cn } from '@/lib/utils'; interface Notification { id: string; type: 'success' | 'warning' | 'info' | 'system'; titleKey: string; descriptionKey: string; timeKey: string; isRead: boolean; actions?: { labelKey: string; variant: 'primary' | 'secondary' | 'warning' }[]; } const todayNotifications: Notification[] = [ { id: '1', type: 'success', titleKey: 'notifications.scanComplete', descriptionKey: 'notifications.scanCompleteDesc', timeKey: 'notifications.time.2mAgo', isRead: false, actions: [{ labelKey: 'notifications.viewResults', variant: 'primary' }], }, { id: '2', type: 'warning', titleKey: 'notifications.parsingError', descriptionKey: 'notifications.parsingErrorDesc', timeKey: 'notifications.time.15mAgo', isRead: false, actions: [ { labelKey: 'notifications.ignore', variant: 'secondary' }, { labelKey: 'notifications.fix', variant: 'warning' }, ], }, { id: '3', type: 'info', titleKey: 'notifications.newBranch', descriptionKey: 'notifications.newBranchDesc', timeKey: 'notifications.time.1hAgo', isRead: true, }, ]; const yesterdayNotifications: Notification[] = [ { id: '4', type: 'system', titleKey: 'notifications.systemUpdate', descriptionKey: 'notifications.systemUpdateDesc', timeKey: '10:00 AM', isRead: true, }, ]; const iconMap = { success: { icon: CheckCircle, bg: 'bg-emerald-100', text: 'text-emerald-600' }, warning: { icon: AlertTriangle, bg: 'bg-amber-100', text: 'text-amber-600' }, info: { icon: Store, bg: 'bg-blue-100', text: 'text-blue-600' }, system: { icon: Monitor, bg: 'bg-slate-100', text: 'text-slate-600' }, }; const actionStyles = { primary: 'text-emerald-700 bg-emerald-50 hover:bg-emerald-100 border-emerald-100', secondary: 'text-slate-700 bg-white hover:bg-slate-50 border-slate-200 shadow-sm', warning: 'text-amber-700 bg-amber-50 hover:bg-amber-100 border-amber-100', }; interface NotificationPanelProps { onClose: () => void; } export default function NotificationPanel({ onClose }: NotificationPanelProps) { const { t } = useTranslation(); const renderNotification = (notif: Notification) => { const { icon: Icon, bg, text } = iconMap[notif.type]; return (
{/* Left accent bar */} {!notif.isRead ? (
) : (
)} {/* Icon */}
{/* Content */}

{t(notif.titleKey)}

{notif.timeKey.startsWith('notifications.') ? t(notif.timeKey) : notif.timeKey}

{notif.actions && (

{notif.actions.map((action) => ( ))}
)}
{/* Unread dot */} {!notif.isRead && (
)}
); }; return (
{/* Header */}

{t('notifications.title')}

{t('notifications.newCount', { count: 3 })}

{/* Scrollable body */}
{/* Today */}
{t('notifications.today')}
{todayNotifications.map(renderNotification)}
{/* Yesterday */}
{t('notifications.yesterday')}
{yesterdayNotifications.map(renderNotification)}
{/* View all */}
); }