fix #55 js exception

This commit is contained in:
Paul Miller
2023-04-27 12:29:02 -05:00
parent f68e5656c1
commit d970db31c4
4 changed files with 24 additions and 4 deletions

View File

@@ -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 }) {
<SmallHeader class={isReceive() ? "text-m-green" : "text-m-red"}>
{isReceive() ? "RECEIVE" : "SEND"}
</SmallHeader>
<SubtleText>{props.item.confirmation_time ? prettyPrintTime(props.item.confirmation_time.Confirmed.time) : "Unconfirmed"}</SubtleText>
<SubtleText>{props.item.confirmation_time?.Confirmed ? prettyPrintTime(props.item.confirmation_time?.Confirmed?.time) : "Unconfirmed"}</SubtleText>
</div>
</div>
</>

View File

@@ -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 (
<SafeArea>
<Title>Oh no!</Title>
<DefaultMain>
<LargeHeader>Error</LargeHeader>
<SmallHeader>This never should've happened</SmallHeader>
<p class="bg-white/10 rounded-xl p-4 font-mono">
<span class="font-bold">
{props.error.name}</span>: {props.error.message}
</p>
<div class="h-full" />
<ButtonLink href="/" intent="red">Dangit</ButtonLink>
</DefaultMain>
</SafeArea>
);
}

View File

@@ -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() {
</Head>
<Body>
<Suspense>
<ErrorBoundary>
<ErrorBoundary fallback={(e) => <ErrorDisplay error={e} />}>
<MegaStoreProvider>
<Routes>
<FileRoutes />

View File

@@ -5,7 +5,6 @@ import { ButtonLink, DefaultMain, LargeHeader, SafeArea } from "~/components/lay
export default function NotFound() {
return (
<SafeArea>
<Title>Not Found</Title>
<HttpStatusCode code={404} />
<DefaultMain>