import { useNavigate, useParams } from 'react-router';
import { ArrowLeft, Calendar, AlertCircle, Bell, CheckCircle, Clock } from 'lucide-react';
import { companyMessages, dismissMessage } from '../data/companyMessages';
function getIcon(type: 'urgent' | 'reminder' | 'info', className = 'w-5 h-5') {
if (type === 'urgent') return ;
if (type === 'reminder') return ;
return ;
}
function typeStyle(type: 'urgent' | 'reminder' | 'info') {
if (type === 'urgent') return {
wrapper: 'bg-destructive/10 text-destructive',
deadline: 'bg-destructive/6 border-destructive/20',
deadlineText: 'text-destructive',
step: 'bg-destructive/10 text-destructive',
};
if (type === 'reminder') return {
wrapper: 'bg-primary/10 text-primary',
deadline: 'bg-primary/5 border-primary/20',
deadlineText: 'text-primary',
step: 'bg-primary/10 text-primary',
};
return {
wrapper: 'bg-muted text-muted-foreground',
deadline: 'bg-muted border-border',
deadlineText: 'text-foreground',
step: 'bg-muted text-muted-foreground',
};
}
export function NotificationDetail() {
const navigate = useNavigate();
const { id } = useParams();
const notification = id ? companyMessages.find(m => m.id === id) : null;
if (!notification) {
return (
Уведомление не найдено
);
}
const style = typeStyle(notification.type);
const handleComplete = () => {
dismissMessage(notification.id);
navigate('/');
};
const handleLater = () => navigate('/');
return (
{/* Хедер */}
Уведомление
{/* Контент */}
{/* Иконка и заголовок */}
{getIcon(notification.type, 'w-6 h-6')}
{notification.title}
{notification.description}
{/* Дедлайн */}
{notification.deadline && (
Срок:
{notification.deadline}
)}
{/* Полное описание */}
Подробности
{notification.fullContent}
{/* Шаги */}
{notification.steps && notification.steps.length > 0 && (
Что нужно сделать
{notification.steps.map((step, i) => (
))}
)}
{/* Кнопки */}
);
}