Skip to content

Commit 4b8934a

Browse files
committed
perf: lazy load chart with loading component
1 parent b5fbf29 commit 4b8934a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

app/[locale]/resources/utils.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import dynamic from "next/dynamic"
12
import { getLocale, getTranslations } from "next-intl/server"
23

34
import { Lang } from "@/lib/types"
@@ -7,13 +8,13 @@ import SectionIconEthGlyph from "@/components/icons/eth-glyph.svg"
78
import SectionIconEthWallet from "@/components/icons/eth-wallet.svg"
89
import SectionIconHeartPulse from "@/components/icons/heart-pulse.svg"
910
import SectionIconPrivacy from "@/components/icons/privacy.svg"
11+
import { Spinner } from "@/components/ui/spinner"
1012

1113
import { formatSmallUSD } from "@/lib/utils/numbers"
1214
import { getLocaleForNumberFormat } from "@/lib/utils/translations"
1315

1416
import BigNumber from "../../../src/components/BigNumber"
1517

16-
import SlotCountdownChart from "./_components/SlotCountdown"
1718
import type { DashboardBox, DashboardSection } from "./types"
1819

1920
import IconBeaconchain from "@/public/images/resources/beaconcha-in.png"
@@ -53,6 +54,17 @@ import IconUltrasoundMoney from "@/public/images/resources/ultrasound-money.png"
5354
import IconVisaOnchainAnalytics from "@/public/images/resources/visa-onchain-analytcs.png"
5455
import IconWalletBeat from "@/public/images/resources/walletbeat.png"
5556

57+
const SlotCountdownChart = dynamic(
58+
() => import("./_components/SlotCountdown"),
59+
{
60+
ssr: false,
61+
loading: () => (
62+
<div className="grid h-32 place-items-center">
63+
<Spinner />
64+
</div>
65+
),
66+
}
67+
)
5668
export const getResources = async ({
5769
txCostsMedianUsd,
5870
}): Promise<DashboardSection[]> => {

0 commit comments

Comments
 (0)