Skip to content

hotfix layer 2 #15448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions app/[locale]/layer-2/_components/layer-2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,12 @@ const Layer2Hub = ({
<div className="max-w-[224px]">
<p className="text-5xl">
$
{growThePieData.dailyTxCosts["ethereum"].toLocaleString(
locale as Lang,
{ minimumFractionDigits: 2, maximumFractionDigits: 2 }
)}
{(
growThePieData.dailyTxCosts["ethereum"] || 0
).toLocaleString(locale as Lang, {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})}
</p>
<p className="text-body-medium">
{t("page-layer-2-blockchain-transaction-cost")}
Expand Down
15 changes: 13 additions & 2 deletions src/components/Layer2NetworksTable/NetworksSubComponent.tsx
Original file line number Diff line number Diff line change
@@ -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"

Expand All @@ -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 (
Expand Down Expand Up @@ -60,6 +66,7 @@ const NetworkSubComponent = ({ network }) => {
</p>
<p>
{(() => {
if (!network.launchDate) return "-"
const launch = new Date(network.launchDate)
const today = new Date()
const yearDiff = today.getFullYear() - launch.getFullYear()
Expand Down Expand Up @@ -141,7 +148,11 @@ const NetworkSubComponent = ({ network }) => {
</Tooltip>
</p>
</div>
<p>{formatNumber(network.activeAddresses)}</p>
<p>
{network.activeAddresses
? formatNumber(network.activeAddresses)
: "-"}
</p>
</div>
<div className="flex-1">
<div>
Expand Down
36 changes: 26 additions & 10 deletions src/components/Layer2NetworksTable/hooks/useNetworkColumns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const useNetworkColumns: ColumnDef<ExtendedRollup>[] = [
},
cell: ({ table, row }) => {
const meta = table.options.meta as TableMeta

return (
<TableCell
className={cn(
Expand Down Expand Up @@ -78,11 +79,20 @@ export const useNetworkColumns: ColumnDef<ExtendedRollup>[] = [
<Translation id="page-layer-2-networks:page-layer-2-networks-avg-transaction-fee" />
</p>
<p>
$
{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,
}
)}
</>
) : (
<p>-</p>
)}
</p>
</div>
<div>
Expand Down Expand Up @@ -160,11 +170,17 @@ export const useNetworkColumns: ColumnDef<ExtendedRollup>[] = [
row.original.canExpand === false && "border-b-4"
)}
>
$
{row.original.txCosts.toLocaleString(meta.locale as Lang, {
minimumFractionDigits: 2,
maximumFractionDigits: 3,
})}
{row.original.txCosts ? (
<p>
$
{row.original.txCosts.toLocaleString(meta.locale as Lang, {
minimumFractionDigits: 2,
maximumFractionDigits: 3,
})}
</p>
) : (
<p>-</p>
)}
</TableCell>
)
},
Expand Down
16 changes: 13 additions & 3 deletions src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,8 @@ export type StatsBoxState = ValueOrError<string>
export type GrowThePieMetricKey = "txCount" | "txCostsMedianUsd"

export type GrowThePieData = Record<GrowThePieMetricKey, MetricReturnData> & {
dailyTxCosts: Record<string, number>
activeAddresses: Record<string, number>
dailyTxCosts: Record<string, number | undefined>
activeAddresses: Record<string, number | undefined>
}

export type MetricName =
Expand Down Expand Up @@ -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
Expand Down