import Button from '@/components/ui/Button.tsx'; import IconWrapper from '@/components/ui/IconWrapper.tsx'; import { useTranslation } from '@/hooks/useI18n'; import { XCircle } from 'lucide-react'; import { Component, ErrorInfo, ReactNode } from 'react'; interface Props { children?: ReactNode; } interface ErrorState { hasError: boolean; error?: Error; } const ErrorFallback = ({ error, onRefresh }: { error?: Error; onRefresh: () => void }) => { const { t } = useTranslation(); return (

{t('error.somethingWentWrong')}

{t('error.tryRefreshing')}

        {error?.message || t('error.unknownError')}
      
); }; class ErrorBoundary extends Component { state: ErrorState = { hasError: false, error: undefined, }; static getDerivedStateFromError(error: Error): ErrorState { return { hasError: true, error }; } componentDidCatch(error: Error, errorInfo: ErrorInfo) { console.error('Uncaught error:', error, errorInfo); } handleRefresh = () => { window.location.reload(); }; render() { if (this.state.hasError) { return ; } return this.props.children; } } export default ErrorBoundary;