// Update Notification Component // Shows a notification when new build is available and provides update options import React from 'react'; import { Modal, Button, Space, Typography } from '@/shared/antd-imports'; import { ReloadOutlined, CloseOutlined, DownloadOutlined } from '@/shared/antd-imports'; import { useTranslation } from 'react-i18next'; import { useServiceWorker } from '../../utils/serviceWorkerRegistration'; const { Text, Title } = Typography; interface UpdateNotificationProps { visible: boolean; onClose: () => void; onUpdate: () => void; } const UpdateNotification: React.FC = ({ visible, onClose, onUpdate }) => { const { t } = useTranslation('common'); const [isUpdating, setIsUpdating] = React.useState(false); const { hardReload } = useServiceWorker(); const handleUpdate = async () => { setIsUpdating(true); try { if (hardReload) { await hardReload(); } else { // Fallback to regular reload window.location.reload(); } onUpdate(); } catch (error) { console.error('Error during update:', error); // Fallback to regular reload window.location.reload(); } }; const handleLater = () => { onClose(); }; return ( {t('update-available')} } open={visible} onCancel={handleLater} footer={null} centered closable={false} maskClosable={false} width={460} styles={{ body: { padding: '20px 24px' } }} >
{t('update-description')}

{t('update-instruction')}
{t('update-whats-new', { interpolation: { escapeValue: false } })}
); }; export default UpdateNotification;