diff --git a/packages/files-ui/src/App.tsx b/packages/files-ui/src/App.tsx index f36a1873de..9d3f3c4e1e 100644 --- a/packages/files-ui/src/App.tsx +++ b/packages/files-ui/src/App.tsx @@ -1,9 +1,9 @@ -import React, { useCallback } from "react" -import { init as initSentry, ErrorBoundary, showReportDialog } from "@sentry/react" +import React from "react" +import { init as initSentry, ErrorBoundary } from "@sentry/react" import { Web3Provider } from "@chainsafe/web3-context" import { ThemeSwitcher } from "@chainsafe/common-theme" import "@chainsafe/common-theme/dist/font-faces.css" -import { Button, CssBaseline, Modal, Router, ToastProvider, Typography } from "@chainsafe/common-components" +import { CssBaseline, Router, ToastProvider } from "@chainsafe/common-components" import { FilesProvider } from "./Contexts/FilesContext" import FilesRoutes from "./Components/FilesRoutes" import AppWrapper from "./Components/Layouts/AppWrapper" @@ -18,6 +18,7 @@ import { BillingProvider } from "./Contexts/BillingContext" import { PosthogProvider } from "./Contexts/PosthogContext" import { NotificationsProvider } from "./Contexts/NotificationsContext" import { StylesProvider, createGenerateClassName } from "@material-ui/styles" +import ErrorModal from "./Components/Modules/ErrorModal" // making material and jss use one className generator const generateClassName = createGenerateClassName({ @@ -77,29 +78,6 @@ const App = () => { // This will default to testnet unless mainnet is specifically set in the ENV const directAuthNetwork = (process.env.REACT_APP_DIRECT_AUTH_NETWORK === "mainnet") ? "mainnet" : "testnet" - const fallBack = useCallback(({ error, componentStack, eventId, resetError }) => ( - - - An error occurred and has been logged. If you would like to - provide additional info to help us debug and resolve the issue, - click the `"`Provide Additional Details`"` button - - {error?.message.toString()} - {componentStack} - {eventId} - - - - ), []) - return ( { themes={{ light: lightTheme, dark: darkTheme }} > window.location.reload()} > diff --git a/packages/files-ui/src/Components/Modules/ErrorModal.tsx b/packages/files-ui/src/Components/Modules/ErrorModal.tsx new file mode 100644 index 0000000000..63401716a6 --- /dev/null +++ b/packages/files-ui/src/Components/Modules/ErrorModal.tsx @@ -0,0 +1,107 @@ +/* eslint-disable max-len */ +import React from "react" +import { Button, Modal, Typography } from "@chainsafe/common-components" +import { ROUTE_LINKS } from "../FilesRoutes" + +interface Props { + error: Error + componentStack: string | null + eventId: string | null + resetError: () => void +} + +const ErrorModal = ({ error, componentStack, resetError }: Props) => { + + const generalStyle = { + margin: "1rem", + backgrounColor: "var(--gray1)", + color: "var(--gray9)" + } + + return + + An unexpected error occured + + + If you would like to provide additional info to help us debug and resolve the issue, reach out on + Discord + + +
+ + Error: + + +
{error?.message.toString()}
+
+ + Stack: + + + {componentStack} + +
+ +
+
+} + +export default ErrorModal \ No newline at end of file