From 1e8cd2bd1c61f18296f7eeed7596e54a5094a8b9 Mon Sep 17 00:00:00 2001 From: Kent Beck Date: Sat, 21 Mar 2020 02:26:01 -0700 Subject: [PATCH] Separated specification and implementation in TopErrorBoundary (#1031) * Encapsulate SceneHistory. A little. * Clean up TopErrorBoundary --- src/components/TopErrorBoundary.tsx | 124 ++++++++++++++-------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/src/components/TopErrorBoundary.tsx b/src/components/TopErrorBoundary.tsx index fcbc40e6..fbe38fc9 100644 --- a/src/components/TopErrorBoundary.tsx +++ b/src/components/TopErrorBoundary.tsx @@ -20,6 +20,10 @@ export class TopErrorBoundary extends React.Component< localStorage: "", }; + render() { + return this.state.hasError ? this.errorSplash() : this.props.children; + } + componentDidCatch(error: Error) { resetCursor(); const _localStorage: any = {}; @@ -88,74 +92,70 @@ export class TopErrorBoundary extends React.Component< ); } - render() { - if (this.state.hasError) { - return ( -
-
-
- {t("errorSplash.headingMain_pre")} - + private errorSplash() { + return ( +
+
+
+ {t("errorSplash.headingMain_pre")} + +
+
+ {t("errorSplash.clearCanvasMessage")} + +
+
+ + ⚠️ + + {t("errorSplash.clearCanvasCaveat")} +
-
- {t("errorSplash.clearCanvasMessage")} -
+
+
+ {t("errorSplash.openIssueMessage_pre")} + -
-
- - ⚠️ - - {t("errorSplash.clearCanvasCaveat")} - -
+ {t("errorSplash.openIssueMessage_post")}
-
-
- {t("errorSplash.openIssueMessage_pre")} - - {t("errorSplash.openIssueMessage_post")} -
-
-
- -