import React, { useEffect, useState } from 'react'; import { Button, Modal, Empty } from '@douyinfe/semi-ui'; import { useTranslation } from 'react-i18next'; import { API, showError } from '../helpers'; import { marked } from 'marked'; import { IllustrationNoContent, IllustrationNoContentDark } from '@douyinfe/semi-illustrations'; const NoticeModal = ({ visible, onClose, isMobile }) => { const { t } = useTranslation(); const [noticeContent, setNoticeContent] = useState(''); const [loading, setLoading] = useState(false); const handleCloseTodayNotice = () => { const today = new Date().toDateString(); localStorage.setItem('notice_close_date', today); onClose(); }; const displayNotice = async () => { setLoading(true); try { const res = await API.get('/api/notice'); const { success, message, data } = res.data; if (success) { if (data !== '') { const htmlNotice = marked.parse(data); setNoticeContent(htmlNotice); } else { setNoticeContent(''); } } else { showError(message); } } catch (error) { showError(error.message); } finally { setLoading(false); } }; useEffect(() => { if (visible) { displayNotice(); } }, [visible]); const renderContent = () => { if (loading) { return