import React, { useState } from "react"; import { Modal, Button, Tabs } from "antd"; import { CheckCircleOutlined, EyeOutlined } from "@ant-design/icons"; import type { TabsProps } from "antd"; import { MESSAGE_TAB } from "@/constants"; import { useNotificationStore } from "@/store/NotificationStore"; import { Eraser, FileText } from "lucide-react"; import dayjs from "dayjs"; interface MessageModalProps { visible: boolean; onClose: () => void; socket: any; } const MessageModal: React.FC = ({ visible, onClose, socket, }) => { const [activeKey, setActiveKey] = useState(MESSAGE_TAB.UNREAD); const { notifications } = useNotificationStore(); console.log("notifications", notifications); const tabItems: TabsProps["items"] = [ { key: MESSAGE_TAB.ALL, label: ( 全部 {notifications.length > 9 ? "9+" : notifications.length} ), }, { key: MESSAGE_TAB.UNREAD, label: ( 未读{" "} {notifications.filter( (notification) => notification.status === MESSAGE_TAB.UNREAD ).length > 9 ? "9+" : notifications.filter( (notification) => notification.status === MESSAGE_TAB.UNREAD ).length} ), }, { key: MESSAGE_TAB.HAS_READ, label: ( 已读 {notifications.filter( (notification) => notification.status === MESSAGE_TAB.HAS_READ ).length > 9 ? "9+" : notifications.filter( (notification) => notification.status === MESSAGE_TAB.HAS_READ ).length} ), }, ]; return ( 消息中心 (1)
清除消息
} open={visible} onCancel={onClose} footer={null} width={600} style={{ top: 10 }} >
{ setActiveKey(key); }} />
{notifications .filter( (notification) => activeKey === MESSAGE_TAB.ALL || notification.status === activeKey ) .map((message, index) => (
病例时效提醒
{dayjs(message.timestamp).format("YYYY-MM-DD HH:mm")}

{message.title}

{message.message}

{message.footer || "祝您工作顺利!"}

))}
); }; export default MessageModal;