Skip to content

Commit 0521f77

Browse files
committed
refactor new to crypto wallets to come from start page getStaticProps
1 parent ed39f40 commit 0521f77

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

src/components/StartWithEthereumFlow/DownloadAWallet/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
import { useState } from "react"
22

3+
import { Wallet } from "@/lib/types"
4+
35
import { Image } from "@/components/Image"
46
import { Button, ButtonLink } from "@/components/ui/buttons/Button"
57
import Checkbox from "@/components/ui/checkbox"
68
import { Tag } from "@/components/ui/tag"
79

810
import { trackCustomEvent } from "@/lib/utils/matomo"
9-
import { getNewToCryptoWallets } from "@/lib/utils/wallets"
1011

1112
const DownloadAWallet = ({
1213
handleNext,
1314
stepIndex,
1415
totalSteps,
16+
newToCryptoWallets,
1517
}: {
1618
handleNext: () => void
1719
stepIndex: number
1820
totalSteps: number
21+
newToCryptoWallets: Wallet[]
1922
}) => {
2023
const [hasWallet, setHasWallet] = useState(false)
21-
const newToCryptoWallets = getNewToCryptoWallets()
2224

2325
return (
2426
<div className="flex flex-col items-center gap-8 lg:flex-row lg:gap-24">

src/components/StartWithEthereumFlow/index.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
import { useRef, useState } from "react"
22
import type { SwiperRef } from "swiper/react"
33

4+
import { Wallet } from "@/lib/types"
5+
46
import ConnectYourWallet from "@/components/StartWithEthereumFlow/ConnectYourWallet"
57
import DownloadAWallet from "@/components/StartWithEthereumFlow/DownloadAWallet"
68
import LetUseSomeApps from "@/components/StartWithEthereumFlow/LetUseSomeApps"
79
import { Swiper, SwiperContainer, SwiperSlide } from "@/components/ui/swiper"
810

911
import { cn } from "@/lib/utils/cn"
1012

11-
const StartWithEthereumFlow = () => {
13+
const StartWithEthereumFlow = ({
14+
newToCryptoWallets,
15+
}: {
16+
newToCryptoWallets: Wallet[]
17+
}) => {
1218
const swiperRef = useRef<SwiperRef>(null)
1319
const [activeIndex, setActiveIndex] = useState(1)
1420
const [totalSlides, setTotalSlides] = useState(0)
@@ -97,6 +103,7 @@ const StartWithEthereumFlow = () => {
97103
handleNext={handleNext}
98104
stepIndex={activeIndex}
99105
totalSteps={totalSlides}
106+
newToCryptoWallets={newToCryptoWallets}
100107
/>
101108
</div>
102109
</SwiperSlide>

src/pages/[locale]/start/index.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import dynamic from "next/dynamic"
33
import { useRouter } from "next/router"
44
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"
55

6-
import { BasePageProps, Lang } from "@/lib/types"
6+
import { BasePageProps, Lang, Wallet } from "@/lib/types"
77

88
import { Image } from "@/components/Image"
99
import MainArticle from "@/components/MainArticle"
@@ -15,6 +15,7 @@ import { existsNamespace } from "@/lib/utils/existsNamespace"
1515
import { getLastDeployDate } from "@/lib/utils/getLastDeployDate"
1616
import { getLocaleTimestamp } from "@/lib/utils/time"
1717
import { getRequiredNamespacesForPage } from "@/lib/utils/translations"
18+
import { getNewToCryptoWallets } from "@/lib/utils/wallets"
1819

1920
import { DEFAULT_LOCALE, LOCALES_CODES } from "@/lib/constants"
2021

@@ -54,16 +55,23 @@ export const getStaticProps = (async ({ params }) => {
5455

5556
const messages = await loadNamespaces(locale as string, requiredNamespaces)
5657

58+
const newToCryptoWallets = getNewToCryptoWallets()
59+
5760
return {
5861
props: {
5962
messages,
6063
contentNotTranslated,
6164
lastDeployLocaleTimestamp,
65+
newToCryptoWallets,
6266
},
6367
}
6468
}) satisfies GetStaticProps<BasePageProps>
6569

66-
const StartWithCryptoPage = () => {
70+
const StartWithCryptoPage = ({
71+
newToCryptoWallets,
72+
}: {
73+
newToCryptoWallets: Wallet[]
74+
}) => {
6775
const router = useRouter()
6876

6977
return (
@@ -97,7 +105,7 @@ const StartWithCryptoPage = () => {
97105
</div>
98106

99107
<div id="start-with-ethereum-flow" className="flex flex-col gap-12">
100-
<StartWithEthereumFlow />
108+
<StartWithEthereumFlow newToCryptoWallets={newToCryptoWallets} />
101109
</div>
102110

103111
<div className="flex w-full flex-col gap-12 rounded-2xl border border-accent-c/10 bg-gradient-to-t from-accent-c/10 from-20% to-accent-c/5 to-60% px-12 py-16 md:flex-row dark:from-accent-c/20 dark:to-accent-c/10">

0 commit comments

Comments
 (0)