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) + : "-"} +

diff --git a/src/components/Layer2NetworksTable/hooks/useNetworkColumns.tsx b/src/components/Layer2NetworksTable/hooks/useNetworkColumns.tsx index 659822a947f..e30c5f48d08 100644 --- a/src/components/Layer2NetworksTable/hooks/useNetworkColumns.tsx +++ b/src/components/Layer2NetworksTable/hooks/useNetworkColumns.tsx @@ -49,6 +49,7 @@ export const useNetworkColumns: ColumnDef[] = [ }, cell: ({ table, row }) => { const meta = table.options.meta as TableMeta + return ( [] = [

- $ - {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, + } + )} + + ) : ( +

-

+ )}

@@ -160,11 +170,17 @@ export const useNetworkColumns: ColumnDef[] = [ row.original.canExpand === false && "border-b-4" )} > - $ - {row.original.txCosts.toLocaleString(meta.locale as Lang, { - minimumFractionDigits: 2, - maximumFractionDigits: 3, - })} + {row.original.txCosts ? ( +

+ $ + {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 export type GrowThePieMetricKey = "txCount" | "txCostsMedianUsd" export type GrowThePieData = Record & { - dailyTxCosts: Record - activeAddresses: Record + dailyTxCosts: Record + activeAddresses: Record } export type MetricName = @@ -642,9 +642,19 @@ export type NonEVMChainName = "Starknet" export type ExtendedRollup = Rollup & { networkMaturity: MaturityLevel - txCosts: number + txCosts: number | undefined tvl: number walletsSupported: string[] + activeAddresses: number | undefined + launchDate: string | null + walletsSupportedCount: number + blockspaceData: { + nft: number + defi: number + social: number + token_transfers: number + unlabeled: number + } | null } // Wallets