From d970db31c46a65202addae56c560115c48c36501 Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Thu, 27 Apr 2023 12:29:02 -0500 Subject: [PATCH] fix #55 js exception --- src/components/Activity.tsx | 4 ++-- src/components/ErrorDisplay.tsx | 20 ++++++++++++++++++++ src/root.tsx | 3 ++- src/routes/[...404].tsx | 1 - 4 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 src/components/ErrorDisplay.tsx diff --git a/src/components/Activity.tsx b/src/components/Activity.tsx index 5e21f5b..9171864 100644 --- a/src/components/Activity.tsx +++ b/src/components/Activity.tsx @@ -19,7 +19,7 @@ type OnChainTx = { sent: number fee?: number confirmation_time?: { - "Confirmed": { + "Confirmed"?: { height: number time: number } @@ -63,7 +63,7 @@ function OnChainItem(props: { item: OnChainTx }) { {isReceive() ? "RECEIVE" : "SEND"} - {props.item.confirmation_time ? prettyPrintTime(props.item.confirmation_time.Confirmed.time) : "Unconfirmed"} + {props.item.confirmation_time?.Confirmed ? prettyPrintTime(props.item.confirmation_time?.Confirmed?.time) : "Unconfirmed"} diff --git a/src/components/ErrorDisplay.tsx b/src/components/ErrorDisplay.tsx new file mode 100644 index 0000000..bbd7878 --- /dev/null +++ b/src/components/ErrorDisplay.tsx @@ -0,0 +1,20 @@ +import { Title } from "solid-start"; +import { ButtonLink, DefaultMain, LargeHeader, SafeArea, SmallHeader } from "~/components/layout"; + +export default function ErrorDisplay(props: { error: Error }) { + return ( + + Oh no! + + Error + This never should've happened +

+ + {props.error.name}: {props.error.message} +

+
+ Dangit + + + ); +} diff --git a/src/root.tsx b/src/root.tsx index 09f594e..1a7393d 100644 --- a/src/root.tsx +++ b/src/root.tsx @@ -15,6 +15,7 @@ import { import "./root.css"; import { Provider as MegaStoreProvider } from "~/state/megaStore"; import { Toaster } from "~/components/Toaster"; +import ErrorDisplay from "./components/ErrorDisplay"; export default function Root() { return ( @@ -35,7 +36,7 @@ export default function Root() { - + }> diff --git a/src/routes/[...404].tsx b/src/routes/[...404].tsx index 92f1dc0..1c69657 100644 --- a/src/routes/[...404].tsx +++ b/src/routes/[...404].tsx @@ -5,7 +5,6 @@ import { ButtonLink, DefaultMain, LargeHeader, SafeArea } from "~/components/lay export default function NotFound() { return ( - Not Found