diff --git a/package-lock.json b/package-lock.json index 552eada82a..c183678b9f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,6 +30,7 @@ "react-chartjs-2": "^5.3.1", "react-datepicker": "^8.8.0", "react-dom": "^19.2.7", + "react-error-boundary": "^6.1.2", "react-hotkeys-hook": "^5.3.3", "react-i18next": "17.0.8", "react-icons": "^5.7.0", @@ -5497,6 +5498,15 @@ "react": "^19.2.7" } }, + "node_modules/react-error-boundary": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/react-error-boundary/-/react-error-boundary-6.1.2.tgz", + "integrity": "sha512-3DpCr5HVdZ0caUjYE/kIHBEJN0mNP3ZCgf16c48uJ5TbWjorKVp+YG8W3XqlJ7vJAVNw6wNIImyPXmFydwmyng==", + "license": "MIT", + "peerDependencies": { + "react": "^18.0.0 || ^19.0.0" + } + }, "node_modules/react-fast-compare": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-2.0.4.tgz", diff --git a/package.json b/package.json index 731f42b574..1696b3dca9 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "react-chartjs-2": "^5.3.1", "react-datepicker": "^8.8.0", "react-dom": "^19.2.7", + "react-error-boundary": "^6.1.2", "react-hotkeys-hook": "^5.3.3", "react-i18next": "17.0.8", "react-icons": "^5.7.0", diff --git a/src/App.tsx b/src/App.tsx index 70bca7e225..8badf7c5ad 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -19,6 +19,8 @@ import { useAppDispatch } from "./store"; import { fetchOcVersion, fetchUserInfo } from "./slices/userInfoSlice"; import { subscribeToAuthEvents } from "./utils/broadcastSync"; import { useTableFilterStateValidation } from "./hooks/useTableFilterStateValidation"; +import { ErrorBoundary } from "react-error-boundary"; +import opencastLogo from "./img/opencast-white.svg?url"; function App() { const dispatch = useAppDispatch(); @@ -43,49 +45,65 @@ function App() { }, []); return ( - - - } /> + +
+ {/* Opencast logo in upper left corner */} +
+ + Opencast Logo + +
+
+
+ Something went wrong. Please reload the page. +
+ + }> + + + } /> - } /> + } /> - } /> + } /> - } /> + } /> - } /> + } /> - } /> + } /> - } /> + } /> - } /> + } /> - } /> + } /> - } /> + } /> - } /> + } /> - } /> + } /> - } /> + } /> - } /> + } /> - } + } + /> + + -
- -
+ + ); } diff --git a/src/components/shared/modals/Modal.tsx b/src/components/shared/modals/Modal.tsx index 0ada5549b1..1274de6e39 100644 --- a/src/components/shared/modals/Modal.tsx +++ b/src/components/shared/modals/Modal.tsx @@ -12,6 +12,7 @@ import { useTranslation } from "react-i18next"; import ButtonLikeAnchor from "../ButtonLikeAnchor"; import { FocusTrap } from "focus-trap-react"; import { LuX } from "react-icons/lu"; +import { ErrorBoundary } from "react-error-boundary"; export type ModalProps = { open?: boolean; @@ -88,8 +89,13 @@ export const Modal = forwardRef>( {header} - + + Something went wrong. Please close the modal and try again. + + }> {children} + ,