diff --git a/frontend/src/components/errors/ErrorCatcherBox.tsx b/frontend/src/components/errors/ErrorCatcherBox.tsx index cadd821..afa63a1 100644 --- a/frontend/src/components/errors/ErrorCatcherBox.tsx +++ b/frontend/src/components/errors/ErrorCatcherBox.tsx @@ -1,11 +1,15 @@ +import {Box, Form} from "@steffo/bluelib-react" import * as React from "react" import {ErrorBox} from "./ErrorBox" +import {IgnoreErrorButton} from "./IgnoreErrorButton" +import {ReportBugButton} from "./ReportBugButton" interface ErrorCatcherBoxProps { children?: React.ReactNode, } + interface ErrorCatcherBoxState { error?: Error, } @@ -18,6 +22,7 @@ export class ErrorCatcherBox extends React.Component { + return {...state, error: undefined} + }) + } + render() { - if (this.state.error) { + if(this.state.error) { return ( - + + {this.state.error.toString()} +
+ + + + +
+
) } else { return this.props.children diff --git a/frontend/src/components/errors/IgnoreErrorButton.tsx b/frontend/src/components/errors/IgnoreErrorButton.tsx new file mode 100644 index 0000000..7795f3c --- /dev/null +++ b/frontend/src/components/errors/IgnoreErrorButton.tsx @@ -0,0 +1,18 @@ +import {faAngleDoubleRight} from "@fortawesome/free-solid-svg-icons" +import {FontAwesomeIcon} from "@fortawesome/react-fontawesome" +import {Button} from "@steffo/bluelib-react" +import * as React from "react" + + +export interface IgnoreErrorButtonProps { + onClick?: (event: React.MouseEvent) => void; +} + + +export function IgnoreErrorButton({onClick}: IgnoreErrorButtonProps): JSX.Element { + return ( + + ) +} diff --git a/frontend/src/components/errors/ReportBugButton.tsx b/frontend/src/components/errors/ReportBugButton.tsx new file mode 100644 index 0000000..8705b09 --- /dev/null +++ b/frontend/src/components/errors/ReportBugButton.tsx @@ -0,0 +1,25 @@ +import {faBug} from "@fortawesome/free-solid-svg-icons" +import {FontAwesomeIcon} from "@fortawesome/react-fontawesome" +import {navigate} from "@reach/router" +import {Button} from "@steffo/bluelib-react" +import * as React from "react" + + +export function ReportBugButton(): JSX.Element { + const onClick = + React.useCallback( + async () => { + await navigate("https://github.com/Steffo99/sophon/issues/new?assignees=&labels=bug&template=1_bug_report.md&title=") + }, + [], + ) + + return React.useMemo( + () => ( + + ), + [onClick], + ) +}