Skip to content

Commit 3c59c5c

Browse files
committed
linting, fix img src path
1 parent 3e1d93c commit 3c59c5c

File tree

5 files changed

+47
-42
lines changed

5 files changed

+47
-42
lines changed

src/components/AssetDownload/AssetDownloadArtist.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
import { useTranslation } from "next-i18next"
12
import { Flex } from "@chakra-ui/react"
23

34
import Emoji from "@/components/Emoji"
45
import Link from "@/components/Link"
56
import Text from "@/components/OldText"
6-
import { useTranslation } from "next-i18next"
77

88
type AssetDownloadArtistProps = {
99
artistName: string

src/components/AssetDownload/AssetDownloadImage.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Center } from "@chakra-ui/react"
2+
23
import { Image, type ImageProps } from "@/components/Image"
34

45
interface AssetDownloadImageProps {
@@ -7,8 +8,8 @@ interface AssetDownloadImageProps {
78
}
89

910
const AssetDownloadImage = ({ image, alt }: AssetDownloadImageProps) => (
10-
<Center border="1px" borderColor="white700" p={8} w="100%">
11-
<Image src={image} alt={alt} w="100%" alignSelf="center" />
11+
<Center border="1px" borderColor="white700" p="8" w="full">
12+
<Image src={image} alt={alt} w="full" alignSelf="center" />
1213
</Center>
1314
)
1415

src/components/AssetDownload/index.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import { extname } from "path"
2-
import { Box, Flex, FlexProps } from "@chakra-ui/react"
2+
3+
import type { StaticImageData } from "next/image"
34
import { useTranslation } from "next-i18next"
5+
import { Box, Flex, type FlexProps } from "@chakra-ui/react"
46

5-
import { ButtonLink } from "@/components/Buttons"
6-
import OldHeading from "@/components/OldHeading"
77
import AssetDownloadArtist from "@/components/AssetDownload/AssetDownloadArtist"
88
import AssetDownloadImage from "@/components/AssetDownload/AssetDownloadImage"
9-
9+
import { ButtonLink } from "@/components/Buttons"
1010
import type { ImageProps } from "@/components/Image"
11+
import OldHeading from "@/components/OldHeading"
12+
1113
import { trackCustomEvent } from "@/lib/utils/matomo"
1214

1315
type AssetDownloadProps = {
@@ -36,6 +38,7 @@ const AssetDownload = ({
3638
eventName: title,
3739
})
3840
}
41+
const imgSrc = (image as StaticImageData).src
3942

4043
return (
4144
<Flex
@@ -55,9 +58,9 @@ const AssetDownload = ({
5558
)}
5659
</Box>
5760
<Flex gap={5} mt={4}>
58-
<ButtonLink href={image.src} onClick={matomoHandler} target="_blank">
59-
{t("page-assets-download-download")}{" "}
60-
({extname(image.src).slice(1).toUpperCase()})
61+
<ButtonLink href={imgSrc} onClick={matomoHandler} target="_blank">
62+
{t("page-assets-download-download")} (
63+
{extname(imgSrc).slice(1).toUpperCase()})
6164
</ButtonLink>
6265
{svgUrl && (
6366
<ButtonLink href={svgUrl} onClick={matomoHandler} target="_blank">

src/lib/utils/translations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const getRequiredNamespacesForPage = (
3939
const getRequiredNamespacesForPath = (path: string) => {
4040
let requiredNamespaces: string[] = []
4141

42-
if (path.startsWith("/assets")) {
42+
if (path === "assets") {
4343
requiredNamespaces = [...requiredNamespaces, "page-assets"]
4444
}
4545

src/pages/assets.tsx

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,47 @@
1+
import type { GetStaticProps } from "next/types"
2+
import { type SSRConfig, useTranslation } from "next-i18next"
3+
import { serverSideTranslations } from "next-i18next/serverSideTranslations"
14
import {
25
Box,
36
Center,
47
Flex,
58
Heading,
6-
SimpleGrid,
79
type HeadingProps,
10+
SimpleGrid,
811
type SimpleGridProps,
912
useColorModeValue,
1013
} from "@chakra-ui/react"
11-
import { type SSRConfig, useTranslation } from "next-i18next"
12-
import type { GetStaticProps } from "next/types"
13-
import { serverSideTranslations } from "next-i18next/serverSideTranslations"
14+
15+
import type { ChildOnlyProp } from "@/lib/types"
1416

1517
import AssetDownload from "@/components/AssetDownload"
16-
import InlineLink from "@/components/Link"
17-
import PageMetadata from "@/components/PageMetadata"
1818
import FeedbackCard from "@/components/FeedbackCard"
19-
import OldHeading from "@/components/OldHeading"
2019
import { Image } from "@/components/Image"
20+
import InlineLink from "@/components/Link"
21+
import OldHeading from "@/components/OldHeading"
22+
import PageMetadata from "@/components/PageMetadata"
23+
24+
import { getLastDeployDate } from "@/lib/utils/getLastDeployDate"
25+
// import efLogo from "@/public/ef-logo.png"
26+
// import efLogoWhite from "@/public/ef-logo-white.png"
27+
// import ethDiamondBlackHero from "@/public/assets/eth-diamond-black.png"
28+
// import ethDiamondPurpleHero from "@/public/assets/eth-diamond-purple.png"
29+
// import ethGifCat from "@/public/eth-gif-cat.png"
30+
// import ethGifChalk from "@/public/eth-gif-chalk.png"
31+
// import ethGifSun from "@/public/eth-gif-sun.png"
32+
// import ethGifWaves from "@/public/eth-gif-waves.png"
33+
// import ethPortraitPurpleWhite from "@/public/assets/ethereum-logo-portrait-purple-white.png"
34+
// import leslieTheRhino from "@/public/upgrades/upgrade_rhino.png"
35+
import { getRequiredNamespacesForPage } from "@/lib/utils/translations"
2136

22-
import beaconChain from "@/public/upgrades/core.png"
23-
import dao from "@/public/use-cases/dao-2.png"
24-
import defi from "@/public/use-cases/defi.png"
25-
import developers from "@/public/developers-eth-blocks.png"
26-
import doge from "@/public/doge-computer.png"
27-
import enterprise from "@/public/enterprise-eth.png"
28-
import eth from "@/public/eth.png"
2937
import ethDiamondBlack from "@/public/assets/eth-diamond-black.png"
3038
import ethDiamondBlackGray from "@/public/assets/eth-diamond-black-gray.png"
3139
import ethDiamondBlackWhite from "@/public/assets/eth-diamond-black-white.jpg"
32-
import ethDiamondColor from "@/public/assets/eth-diamond-rainbow.png"
3340
import ethDiamondGlyph from "@/public/assets/eth-diamond-glyph.png"
3441
import ethDiamondPurple from "@/public/assets/eth-diamond-purple.png"
3542
import ethDiamondPurplePurple from "@/public/assets/eth-diamond-purple-purple.png"
3643
import ethDiamondPurpleWhite from "@/public/assets/eth-diamond-purple-white.jpg"
44+
import ethDiamondColor from "@/public/assets/eth-diamond-rainbow.png"
3745
import ethGlyphColored from "@/public/assets/eth-glyph-colored.png"
3846
import ethLandscapeBlack from "@/public/assets/ethereum-logo-landscape-black.png"
3947
import ethLandscapeBlackGray from "@/public/assets/ethereum-logo-landscape-black-gray.png"
@@ -49,33 +57,26 @@ import ethWordmarkBlackGray from "@/public/assets/ethereum-wordmark-black-gray.p
4957
import ethWordmarkPurple from "@/public/assets/ethereum-wordmark-purple.png"
5058
import ethWordmarkPurplePurple from "@/public/assets/ethereum-wordmark-purple-purple.png"
5159
import ethWordmarkPurpleWhite from "@/public/assets/ethereum-wordmark-purple-white.png"
60+
import developers from "@/public/developers-eth-blocks.png"
61+
import doge from "@/public/doge-computer.png"
62+
import enterprise from "@/public/enterprise-eth.png"
63+
import eth from "@/public/eth.png"
5264
import finance from "@/public/finance_transparent.png"
5365
import future from "@/public/future_transparent.png"
5466
import hackathon from "@/public/hackathon_transparent.png"
5567
import hero from "@/public/home/hero.png"
5668
import heroPanda from "@/public/home/hero-panda.png"
69+
import mergePanda from "@/public/home/merge-panda.png"
5770
import impact from "@/public/impact_transparent.png"
5871
import infrastructure from "@/public/infrastructure_transparent.png"
72+
import beaconChain from "@/public/upgrades/core.png"
5973
import merge from "@/public/upgrades/merge.png"
60-
import mergePanda from "@/public/home/merge-panda.png"
6174
import newRings from "@/public/upgrades/newrings.png"
6275
import oldShip from "@/public/upgrades/oldship.png"
76+
import dao from "@/public/use-cases/dao-2.png"
77+
import defi from "@/public/use-cases/defi.png"
6378
import wallet from "@/public/wallet.png"
6479
import whatIsEthereum from "@/public/what-is-ethereum.png"
65-
// import efLogo from "@/public/ef-logo.png"
66-
// import efLogoWhite from "@/public/ef-logo-white.png"
67-
// import ethDiamondBlackHero from "@/public/assets/eth-diamond-black.png"
68-
// import ethDiamondPurpleHero from "@/public/assets/eth-diamond-purple.png"
69-
// import ethGifCat from "@/public/eth-gif-cat.png"
70-
// import ethGifChalk from "@/public/eth-gif-chalk.png"
71-
// import ethGifSun from "@/public/eth-gif-sun.png"
72-
// import ethGifWaves from "@/public/eth-gif-waves.png"
73-
// import ethPortraitPurpleWhite from "@/public/assets/ethereum-logo-portrait-purple-white.png"
74-
// import leslieTheRhino from "@/public/upgrades/upgrade_rhino.png"
75-
76-
import { getRequiredNamespacesForPath } from "@/lib/utils/translations"
77-
import { getLastDeployDate } from "@/lib/utils/getLastDeployDate"
78-
import type { ChildOnlyProp } from "@/lib/types"
7980

8081
const Row = (props: SimpleGridProps) => (
8182
<SimpleGrid
@@ -109,7 +110,7 @@ const H3 = (props: ChildOnlyProp) => (
109110
export const getStaticProps = (async (context) => {
110111
const { locale } = context
111112
// load i18n required namespaces for the given page
112-
const requiredNamespaces = getRequiredNamespacesForPath("/assets")
113+
const requiredNamespaces = getRequiredNamespacesForPage("assets")
113114
const lastDeployDate = getLastDeployDate()
114115

115116
return {

0 commit comments

Comments
 (0)