/** * React error boundary component. * * Catches render-time exceptions in child components and shows a fallback UI. */ import React from "react"; import { Button, makeStyles, Text, tokens } from "@fluentui/react-components"; interface ErrorBoundaryState { hasError: boolean; errorMessage: string | null; } interface ErrorBoundaryProps { children: React.ReactNode; } interface ErrorBoundaryFallbackProps { message: string; onReload: () => void; } const useFallbackStyles = makeStyles({ root: { display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", minHeight: "100vh", padding: tokens.spacingVerticalL, textAlign: "center", gap: tokens.spacingVerticalM, }, message: { maxWidth: "40rem", }, }); function ErrorBoundaryFallback({ message, onReload }: ErrorBoundaryFallbackProps): React.ReactElement { const styles = useFallbackStyles(); return (