import React from 'react'; import { Dialog, DialogTitle, DialogContent, DialogActions, Button, Typography, Box, Alert } from '@mui/material'; import { Warning as WarningIcon } from '@mui/icons-material'; interface RefreshGuardModalProps { open: boolean; onClose: () => void; onConfirm: () => void; message: string; title?: string; confirmButtonText?: string; cancelButtonText?: string; } /** * Modal dialog that warns users about navigating away or refreshing the page. * Synchronized with browser's native beforeunload dialog. */ export const RefreshGuardModal: React.FC = ({ open, onClose, onConfirm, message, title = 'Warning', confirmButtonText = 'Leave Anyway', cancelButtonText = 'Stay' }) => { return ( {title} {message} Your browser may also show a confirmation dialog. Both dialogs are asking the same thing - whether you want to leave the page and lose your current progress. ); };