import { Virtuoso } from "react-virtuoso"; import { Alert, Badge, Button, Space, Spin, Switch, Tooltip, Typography } from "antd"; import { CheckCircleFilled, CheckCircleOutlined, EyeFilled, EyeOutlined } from "@ant-design/icons"; import { useTranslation } from "react-i18next"; import { useNavigate } from "react-router-dom"; import "./notification-center.styles.scss"; import day from "../../utils/day.js"; import { useEffect, useRef } from "react"; import { DateTimeFormat } from "../../utils/DateFormatter.jsx"; const { Text, Title } = Typography; /** * Notification Center Component */ const NotificationCenterComponent = ({ visible, notifications, loading, showUnreadOnly, toggleUnreadOnly, markAllRead, loadMore, onNotificationClick, unreadCount, isEmployee, isDarkMode, ref }) => { const { t } = useTranslation(); const navigate = useNavigate(); const virtuosoRef = useRef(null); // Scroll to top when showUnreadOnly changes useEffect(() => { if (virtuosoRef.current) { virtuosoRef.current.scrollToIndex({ index: 0, behavior: "smooth" }); } }, [showUnreadOnly]); const renderNotification = (index, notification) => { const handleClick = () => { if (!notification.read) { onNotificationClick(notification.id); } navigate(`/manage/jobs/${notification.jobid}`); }; return (
<span className="ro-number"> {t("notifications.labels.ro-number", { ro_number: notification.roNumber || t("general.labels.na") })} </span> <Text type="secondary" className="relative-time" title={DateTimeFormat(notification.created_at)}> {day(notification.created_at).fromNow()} </Text>
    {notification.scenarioText.map((text, idx) => (
  • {text}
  • ))}
); }; return (

{t("notifications.labels.notification-center")}

{loading && }
{showUnreadOnly ? ( ) : ( )} toggleUnreadOnly(checked)} size="small" disabled={!isEmployee} />
{!isEmployee ? (
) : (
)}
); }; NotificationCenterComponent.displayName = "NotificationCenterComponent"; export default NotificationCenterComponent;