Skip to content

Commit eadc633

Browse files
authored
Merge pull request #12522 from ethereum/find-wallet-revamp
feat: /wallets/find-wallet revamp ✨
2 parents 68fd190 + fe4edc8 commit eadc633

File tree

100 files changed

+2423
-2593
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+2423
-2593
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"i18next": "^23.6.0",
3737
"lodash.merge": "^4.6.2",
3838
"lodash.shuffle": "^4.2.0",
39+
"lodash.union": "^4.6.0",
3940
"next": "13.4.8",
4041
"next-i18next": "^14.0.3",
4142
"next-mdx-remote": "^3.0.8",

public/content/translations/es/developers/tutorials/how-to-mint-an-nft/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Como acuñar un NFT (parte 2/3 de la serie de tutoriales de NFT)
33
description: Este tutorial describe como acuñar un NFT en la cadena de bloques de Ethereum usando nuestro contrato inteligente y Web3.
44
author: "Sumi Mudgil"
55
tags:
6-
- "NTF"
6+
- "NFT"
77
- "ERC-721"
88
- "alchemy"
99
- "solidity"

public/content/translations/es/developers/tutorials/how-to-view-nft-in-metamask/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Cómo visualizar su NFT en su cartera (parte 3/3 de la serie de tutoriale
33
description: Este tutorial explica cómo visualizar un NFT en MetaMask
44
author: "Sumi Mudgil"
55
tags:
6-
- "NTF"
6+
- "NFT"
77
- "ERC-721"
88
- "Alchemy"
99
- "tókenes no fungibles"

public/content/translations/es/developers/tutorials/how-to-write-and-deploy-an-nft/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Cómo escribir & y desplegar un NFT (parte 1/3 de la serie de tutoriales
33
description: Este tutorial es la parte 1 de una serie sobre NFT que le indicará cómo escribir y desplegar un contrato inteligente de un token no fungible o NFT (ERC-721 token) paso a paso usando Ethereum y el sistema de archivos interplanetario (IPFS).
44
author: "Sumi Mudgil"
55
tags:
6-
- "NTF"
6+
- "NFT"
77
- "ERC-721"
88
- "Alchemy"
99
- "Solidity"

public/wallets/find-wallet-hero.png

-111 KB
Binary file not shown.

public/wallets/okx.jpeg

-1.12 KB
Binary file not shown.

src/components/DataProductCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ const DataProductCard = ({
129129
objectFit="cover"
130130
alt=""
131131
minWidth="24px"
132-
me="0.5rem"
132+
me={2}
133133
/>
134134
)}
135135
{coin}
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
import { ReactNode, useContext } from "react"
2+
import { useRouter } from "next/router"
3+
import { useTranslation } from "next-i18next"
4+
import {
5+
AccordionButton,
6+
AccordionIcon,
7+
AccordionItem,
8+
AccordionPanel,
9+
Box,
10+
Heading,
11+
List,
12+
Text,
13+
} from "@chakra-ui/react"
14+
15+
import Select from "@/components/Select"
16+
17+
import { getLanguageCodeName } from "@/lib/utils/intl"
18+
import { trackCustomEvent } from "@/lib/utils/matomo"
19+
import {
20+
getAllWalletsLanguages,
21+
getWalletsTopLanguages,
22+
} from "@/lib/utils/wallets"
23+
24+
import { WalletSupportedLanguageContext } from "@/contexts/WalletSupportedLanguageContext"
25+
26+
export const LanguageSupportFilter = () => {
27+
const { t } = useTranslation("page-wallets-find-wallet")
28+
const { locale } = useRouter()
29+
30+
// Context API
31+
const { supportedLanguage, setSupportedLanguage } = useContext(
32+
WalletSupportedLanguageContext
33+
)
34+
35+
const allWalletsLanguages = getAllWalletsLanguages(locale!)
36+
const allWalletsLanguagesOptions = allWalletsLanguages!.map(
37+
({ langCode, langName }) => {
38+
return {
39+
label: langName,
40+
value: langCode,
41+
}
42+
}
43+
)
44+
45+
const handleLanguageFilterSelectChange = (selectedLanguage) => {
46+
if (!selectedLanguage) return
47+
48+
setSupportedLanguage(selectedLanguage.value)
49+
50+
trackCustomEvent({
51+
eventCategory: "WalletFilterSidebar",
52+
eventAction: `Language search`,
53+
eventName: getLanguageCodeName(selectedLanguage.value, locale!),
54+
})
55+
}
56+
57+
const handleTopLanguageClick = (languageCode: string) => {
58+
setSupportedLanguage(languageCode)
59+
60+
trackCustomEvent({
61+
eventCategory: "WalletFilterSidebar",
62+
eventAction: `Language search`,
63+
eventName: getLanguageCodeName(languageCode, locale!),
64+
})
65+
}
66+
67+
return (
68+
<AccordionItem
69+
background="background.highlight"
70+
borderRadius="base"
71+
borderColor="transparent"
72+
p={6}
73+
zIndex={1}
74+
>
75+
{({ isExpanded }) => (
76+
<>
77+
<Heading
78+
as="h3"
79+
borderBottom={isExpanded ? "1px" : "none"}
80+
borderColor="body.light"
81+
fontSize="lg"
82+
fontWeight={600}
83+
lineHeight={1.4}
84+
py={1}
85+
ps={4}
86+
pe={2.5}
87+
borderRadius={1}
88+
_hover={{ color: "primary.hover" }}
89+
>
90+
<AccordionButton
91+
color="inherit"
92+
fontWeight="inherit"
93+
fontSize="inherit"
94+
p={0}
95+
textAlign="initial"
96+
_hover={{ background: "transparent" }}
97+
>
98+
<Text as="span" flex={1}>
99+
{t("page-find-wallet-languages-supported")}
100+
</Text>
101+
102+
<AccordionIcon
103+
color="primary.base"
104+
boxSize={9}
105+
_hover={{ color: "primary.hover" }}
106+
/>
107+
</AccordionButton>
108+
</Heading>
109+
110+
<AccordionPanel as={List} p={0} m={0}>
111+
<Select
112+
instanceId="language-support-filter"
113+
aria-label={t("page-find-wallet-languages-supported")}
114+
aria-placeholder={t("page-find-wallet-languages-search-language")}
115+
options={allWalletsLanguagesOptions}
116+
onChange={handleLanguageFilterSelectChange}
117+
placeholder={getLanguageCodeName(supportedLanguage, locale!)}
118+
isSearchable
119+
variant="outline"
120+
/>
121+
122+
<Box mt={2}>
123+
<Text color="body.medium" size="sm">
124+
{t("page-find-wallet-popular-languages")}
125+
</Text>
126+
127+
{getWalletsTopLanguages(5, locale!)
128+
.map<ReactNode>((language) => {
129+
return (
130+
<Text
131+
key={language.code}
132+
as="span"
133+
color="primary.base"
134+
size="sm"
135+
cursor="pointer"
136+
onClick={() => handleTopLanguageClick(language.code)}
137+
>
138+
{language.langName}
139+
</Text>
140+
)
141+
})
142+
// `.reduce()` used to generate the comma separator between languages
143+
.reduce((prev, curr) => [prev, ", ", curr])}
144+
</Box>
145+
</AccordionPanel>
146+
</>
147+
)}
148+
</AccordionItem>
149+
)
150+
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
import { useContext } from "react"
2+
import { useTranslation } from "next-i18next"
3+
import { Box, Text } from "@chakra-ui/react"
4+
5+
import { WalletFilter } from "@/lib/types"
6+
7+
import { Button } from "@/components/Buttons"
8+
9+
import { trackCustomEvent } from "@/lib/utils/matomo"
10+
import { walletsListingCount } from "@/lib/utils/wallets"
11+
12+
import { DEFAULT_LOCALE, NAV_BAR_PX_HEIGHT } from "@/lib/constants"
13+
14+
import { FilterBurgerIcon } from "../icons/wallets"
15+
16+
import { WalletSupportedLanguageContext } from "@/contexts/WalletSupportedLanguageContext"
17+
18+
interface MobileFiltersButtonProps {
19+
filters: WalletFilter
20+
showMobileSidebar: boolean
21+
onOpen: () => void
22+
onClose: () => void
23+
}
24+
25+
export const MobileFiltersButton = ({
26+
filters,
27+
showMobileSidebar,
28+
onOpen,
29+
onClose,
30+
}: MobileFiltersButtonProps) => {
31+
const { t } = useTranslation("page-wallets-find-wallet")
32+
33+
// Context API
34+
const { supportedLanguage } = useContext(WalletSupportedLanguageContext)
35+
36+
const handleClick = () => {
37+
showMobileSidebar ? onClose() : onOpen()
38+
39+
trackCustomEvent({
40+
eventCategory: "MobileFilterToggle",
41+
eventAction: `Tap MobileFilterToggle`,
42+
eventName: `show mobile filters ${!showMobileSidebar}`,
43+
})
44+
}
45+
46+
return (
47+
<Box
48+
position="sticky"
49+
top={NAV_BAR_PX_HEIGHT}
50+
bg="background.base"
51+
w="full"
52+
zIndex="docked"
53+
py="5px"
54+
>
55+
<Button
56+
rightIcon={<FilterBurgerIcon />}
57+
variant="outline"
58+
border="none"
59+
ps={0}
60+
ms={4}
61+
gap={4}
62+
sx={{
63+
svg: {
64+
boxSize: 8,
65+
line: { stroke: "primary.base" },
66+
circle: { stroke: "primary.base" },
67+
},
68+
}}
69+
onClick={handleClick}
70+
>
71+
<Box>
72+
<Text align="start">{t("page-find-wallet-filters")}</Text>
73+
<Text
74+
align="start"
75+
fontSize="sm"
76+
lineHeight="14px"
77+
color="body.medium"
78+
>
79+
{walletsListingCount(filters) +
80+
(supportedLanguage === DEFAULT_LOCALE ? 0 : 1)}{" "}
81+
{t("page-find-wallet-active")}
82+
</Text>
83+
</Box>
84+
</Button>
85+
</Box>
86+
)
87+
}

0 commit comments

Comments
 (0)