diff --git a/app/[locale]/layer-2/_components/layer-2.tsx b/app/[locale]/layer-2/_components/layer-2.tsx index e7f071c1b92..6bbe9a0d517 100644 --- a/app/[locale]/layer-2/_components/layer-2.tsx +++ b/app/[locale]/layer-2/_components/layer-2.tsx @@ -124,10 +124,12 @@ const Layer2Hub = ({
$ - {growThePieData.dailyTxCosts["ethereum"].toLocaleString( - locale as Lang, - { minimumFractionDigits: 2, maximumFractionDigits: 2 } - )} + {( + growThePieData.dailyTxCosts["ethereum"] || 0 + ).toLocaleString(locale as Lang, { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + })}
{t("page-layer-2-blockchain-transaction-cost")} diff --git a/src/components/Layer2NetworksTable/NetworksSubComponent.tsx b/src/components/Layer2NetworksTable/NetworksSubComponent.tsx index 8b50e284cd6..8719fd0c2ee 100644 --- a/src/components/Layer2NetworksTable/NetworksSubComponent.tsx +++ b/src/components/Layer2NetworksTable/NetworksSubComponent.tsx @@ -1,5 +1,7 @@ import { MdInfoOutline } from "react-icons/md" +import { ExtendedRollup } from "@/lib/types" + import NetworkUsageChart from "@/components/Layer2NetworksTable/NetworkUsageChart" import Tooltip from "@/components/Tooltip" @@ -21,7 +23,11 @@ const formatNumber = (num: number): string => { return num.toString() } -const NetworkSubComponent = ({ network }) => { +type NetworkSubComponentProps = { + network: ExtendedRollup +} + +const NetworkSubComponent = ({ network }: NetworkSubComponentProps) => { const { t } = useTranslation("page-layer-2-networks") return ( @@ -60,6 +66,7 @@ const NetworkSubComponent = ({ network }) => {
{(() => { + if (!network.launchDate) return "-" const launch = new Date(network.launchDate) const today = new Date() const yearDiff = today.getFullYear() - launch.getFullYear() @@ -141,7 +148,11 @@ const NetworkSubComponent = ({ network }) => {
{formatNumber(network.activeAddresses)}
++ {network.activeAddresses + ? formatNumber(network.activeAddresses) + : "-"} +
- $ - {row.original.txCosts.toLocaleString(meta.locale as Lang, { - minimumFractionDigits: 2, - maximumFractionDigits: 3, - })} + {row.original.txCosts ? ( + <> + $ + {(row.original.txCosts || 0).toLocaleString( + meta.locale as Lang, + { + minimumFractionDigits: 2, + maximumFractionDigits: 3, + } + )} + > + ) : ( +
-
+ )}+ $ + {row.original.txCosts.toLocaleString(meta.locale as Lang, { + minimumFractionDigits: 2, + maximumFractionDigits: 3, + })} +
+ ) : ( +-
+ )} ) }, diff --git a/src/lib/types.ts b/src/lib/types.ts index bcc4550cc36..fa42dc75383 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -559,8 +559,8 @@ export type StatsBoxState = ValueOrError