1
- import { ReactNode , useState } from "react"
1
+ import { lazy , ReactNode , useState } from "react"
2
2
import type { GetStaticProps , InferGetStaticPropsType } from "next"
3
3
import { useRouter } from "next/router"
4
4
import { useTranslation } from "next-i18next"
@@ -14,6 +14,7 @@ import {
14
14
HeadingProps ,
15
15
Icon ,
16
16
SimpleGridProps ,
17
+ SkeletonText ,
17
18
Stack ,
18
19
useToken ,
19
20
} from "@chakra-ui/react"
@@ -29,9 +30,9 @@ import CodeModal from "@/components/CodeModal"
29
30
import CommunityEvents from "@/components/CommunityEvents"
30
31
import HomeHero from "@/components/Hero/HomeHero"
31
32
import { Image } from "@/components/Image"
33
+ import LazyLoadComponent from "@/components/LazyLoadComponent"
32
34
import MainArticle from "@/components/MainArticle"
33
35
import PageMetadata from "@/components/PageMetadata"
34
- import StatsBoxGrid from "@/components/StatsBoxGrid"
35
36
import TitleCardList , { ITitleCardItem } from "@/components/TitleCardList"
36
37
import Translation from "@/components/Translation"
37
38
@@ -70,6 +71,21 @@ import merge from "@/public/images/upgrades/merge.png"
70
71
import robotfixed from "@/public/images/wallet-cropped.png"
71
72
import ethereum from "@/public/images/what-is-ethereum.png"
72
73
74
+ const StatsBoxGrid = lazy ( ( ) => import ( "@/components/StatsBoxGrid" ) )
75
+
76
+ // FIXME: using same design as in #13121 for testing purposes
77
+ const CodeblockSkeleton = ( ) => (
78
+ < Stack px = { 6 } >
79
+ < SkeletonText
80
+ mt = "4"
81
+ noOfLines = { 10 }
82
+ spacing = { 3 }
83
+ skeletonHeight = "1rem"
84
+ startColor = "body.base"
85
+ />
86
+ </ Stack >
87
+ )
88
+
73
89
const SectionHeading = ( props : HeadingProps ) => (
74
90
< Heading
75
91
lineHeight = { 1.4 }
@@ -563,7 +579,17 @@ const HomePage = ({
563
579
< Translation id = "page-index:page-index-network-stats-subtitle" />
564
580
</ SectionDecription >
565
581
</ ContentBox >
566
- < StatsBoxGrid data = { metricResults } />
582
+
583
+ < LazyLoadComponent
584
+ component = { StatsBoxGrid }
585
+ fallback = { < CodeblockSkeleton /> }
586
+ componentProps = { { data : metricResults } }
587
+ intersectionOptions = { {
588
+ root : null ,
589
+ rootMargin : "500px" ,
590
+ threshold : 0 ,
591
+ } }
592
+ />
567
593
</ GrayContainer >
568
594
< Divider mb = { 16 } mt = { 16 } w = "10%" height = "0.25rem" bgColor = "homeDivider" />
569
595
< CommunityEvents events = { communityEvents } />
0 commit comments