import React from 'react'; import { Box, Button, Typography } from '@mui/material'; interface Props { children: React.ReactNode; } interface State { hasError: boolean; error: Error | null; } export default class ErrorBoundary extends React.Component { state: State = { hasError: false, error: null }; static getDerivedStateFromError(error: Error): State { return { hasError: true, error }; } componentDidCatch(error: Error, info: React.ErrorInfo) { console.error('ErrorBoundary caught:', error, info.componentStack); } render() { if (this.state.hasError) { return ( Something went wrong An unexpected error occurred. Please try refreshing the page. ); } return this.props.children; } }