Add ErrorBoundary component to catch rendering error and redirect to recovery page

also add softreset button on recovery page
This commit is contained in:
TheMas3212
2022-01-11 17:50:41 +11:00
parent b7fb59691b
commit 562d4ee800
3 changed files with 74 additions and 32 deletions
+3 -1
View File
@@ -15,9 +15,10 @@ export function ActivateRecoveryMode(): void {
interface IProps {
router: IRouter;
softReset: () => void;
}
export function RecoveryRoot({ router }: IProps): React.ReactElement {
export function RecoveryRoot({ router, softReset }: IProps): React.ReactElement {
function recover(): void {
RecoveryMode = false;
router.toTerminal();
@@ -48,6 +49,7 @@ export function RecoveryRoot({ router }: IProps): React.ReactElement {
<br />
<Typography>You can disable recovery mode now. But chances are the game will not work correctly.</Typography>
<Button onClick={recover}>DISABLE RECOVERY MODE</Button>
<Button onClick={softReset}>PERFORM SOFT RESET</Button>
</>
);
}