Skip to content

Commit b66fbd0

Browse files
committed
Merge branch 'stats-box-grid' into what-is-ethereum-stats
2 parents 441e3d0 + 6443488 commit b66fbd0

20 files changed

+204
-347
lines changed

netlify.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@
2121
included_files = [
2222
"!./src/data/**/*",
2323
"!./public/**/*",
24-
24+
"!./src/intl/**/*",
2525
]

src/components/Codeblock.tsx

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, { useEffect, useState } from "react"
1+
import React, { useState } from "react"
2+
import { useTranslation } from "next-i18next"
23
import Highlight, {
34
defaultProps,
45
Language,
@@ -9,9 +10,9 @@ import { Box, BoxProps, Flex, useColorModeValue } from "@chakra-ui/react"
910

1011
import CopyToClipboard from "@/components/CopyToClipboard"
1112
import Emoji from "@/components/Emoji"
12-
1313
// https://github.com/FormidableLabs/prism-react-renderer/tree/master#custom-language-support
14-
;(typeof global !== "undefined" ? global : window).Prism = Prism
14+
;
15+
(typeof global !== "undefined" ? global : window).Prism = Prism
1516
require("prismjs/components/prism-solidity")
1617

1718
const LINES_BEFORE_COLLAPSABLE = 8
@@ -217,6 +218,7 @@ const Codeblock: React.FC<IProps> = ({
217218
codeLanguage,
218219
fromHomepage = false,
219220
}) => {
221+
const { t } = useTranslation('common')
220222
const selectedTheme = useColorModeValue(codeTheme.light, codeTheme.dark)
221223

222224
const codeText = React.Children.toArray(children)
@@ -321,13 +323,9 @@ const Codeblock: React.FC<IProps> = ({
321323
totalLines - 1 > LINES_BEFORE_COLLAPSABLE && (
322324
<TopBarItem onClick={() => setIsCollapsed(!isCollapsed)}>
323325
{isCollapsed ? (
324-
// TODO: Implement after intl
325-
// <Translation id="show-all" />
326-
<>Show all</>
326+
t("show-all")
327327
) : (
328-
// TODO: Implement after intl
329-
// <Translation id="show-less" />
330-
<>Show less</>
328+
t("show-less")
331329
)}
332330
</TopBarItem>
333331
)}
@@ -338,16 +336,12 @@ const Codeblock: React.FC<IProps> = ({
338336
{!isCopied ? (
339337
<>
340338
<Emoji text=":clipboard:" fontSize="md" />{" "}
341-
{/* TODO: Implement after intl */}
342-
{/* <Translation id="copy" /> */}
343-
Copy
339+
{t("copy")}
344340
</>
345341
) : (
346342
<>
347343
<Emoji text=":white_check_mark:" fontSize="md" />{" "}
348-
{/* TODO: Implement after intl */}
349-
{/* <Translation id="copied" /> */}
350-
Copied
344+
{t("copied")}
351345
</>
352346
)}
353347
</TopBarItem>

src/components/ExpandableCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const ExpandableCard = ({
3434
eventName = "",
3535
}: ExpandableCardProps) => {
3636
const [isVisible, setIsVisible] = useState(false)
37-
const { t } = useTranslation("common") // TODO: Double-check namespace
37+
const { t } = useTranslation("common")
3838
const matomo = {
3939
eventAction,
4040
eventCategory: `ExpandableCard${eventCategory}`,

src/components/PageMetadata.tsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@ import Head from "next/head"
44
import { useRouter } from "next/router"
55
import { useTranslation } from "next-i18next"
66

7-
import { DEFAULT_LOCALE, SITE_URL } from "@/lib/constants"
8-
9-
import ogImageDapps from "@/public/doge-computer.png"
10-
import ogImageDevelopers from "@/public/enterprise-eth.png"
11-
import ogImageDefault from "@/public/home/hero.png"
12-
import ogImageUpgrades from "@/public/upgrades/upgrade_doge.png"
7+
import { SITE_URL } from "@/lib/constants"
138

149
type NameMeta = {
1510
name: string
@@ -44,33 +39,38 @@ const PageMetadata: React.FC<IProps> = ({
4439
const desc = description || t("site-description")
4540
const siteTitle = t("site-title")
4641
const fullTitle = `${title} | ${siteTitle}`
42+
const origin = process.env.NEXT_PUBLIC_SITE_URL || SITE_URL // TODO: Remove .env var usage after launch
43+
44+
// Remove any query params (?) or hash links (#)
45+
const path = asPath.replace(/[\?\#].*/, "")
46+
const slug = path.split("/")
4747

4848
/* Set canonical URL w/ language path to avoid duplicate content */
4949
/* e.g. set ethereum.org/about/ to ethereum.org/en/about/ */
50-
const canonical = canonicalUrl || join(SITE_URL, DEFAULT_LOCALE, asPath)
51-
const url = locale ? join(SITE_URL, locale, asPath) : canonical
50+
const url = new URL(join(locale!, path), origin).href
51+
const canonical = canonicalUrl || url
5252

5353
/* Set fallback ogImage based on path */
54-
let ogImage = ogImageDefault.src
54+
let ogImage = "/home/hero.png"
5555

56-
if (asPath.includes("/developers/")) {
57-
ogImage = ogImageDevelopers.src
56+
if (slug.includes("developers")) {
57+
ogImage = "/enterprise-eth.png"
5858
}
5959

60-
if (asPath.includes("/dapps/")) {
61-
ogImage = ogImageDapps.src
60+
if (slug.includes("dapps")) {
61+
ogImage = "/doge-computer.png"
6262
}
6363

64-
if (asPath.includes("/roadmap/")) {
65-
ogImage = ogImageUpgrades.src
64+
if (slug.includes("roadmap")) {
65+
ogImage = "/upgrades/upgrade_doge.png"
6666
}
6767

6868
if (image) {
6969
ogImage = image
7070
}
7171

72-
const ogImageUrl = join(SITE_URL, ogImage)
73-
const metadata: Array<Meta> = [
72+
const ogImageUrl = new URL(ogImage, origin).href
73+
const metadata: Meta[] = [
7474
{ name: `description`, content: desc },
7575
{ name: `image`, content: ogImageUrl },
7676
{ property: `og:title`, content: fullTitle },

src/components/ReleaseBanner.tsx

Lines changed: 0 additions & 142 deletions
This file was deleted.

src/components/SideNav.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,13 @@ const SideNavLink = ({ children, ...props }: LinkProps) => {
6666
export interface IPropsNavLink {
6767
item: DeveloperDocsLink
6868
path: string
69+
isTopLevel?: boolean
6970
}
7071

71-
const NavLink: React.FC<IPropsNavLink> = ({ item, path }) => {
72+
const NavLink: React.FC<IPropsNavLink> = ({ item, path, isTopLevel }) => {
7273
const { t } = useTranslation("page-developers-docs")
73-
const isLinkInPath = path.includes(item.to) || path.includes(item.path)
74+
const isLinkInPath =
75+
isTopLevel || path.includes(item.to) || path.includes(item.path)
7476
const [isOpen, setIsOpen] = useState<boolean>(isLinkInPath)
7577

7678
useEffect(() => {
@@ -115,7 +117,7 @@ const NavLink: React.FC<IPropsNavLink> = ({ item, path }) => {
115117
key={item.id}
116118
animate={isOpen ? "open" : "closed"}
117119
variants={innerLinksVariants}
118-
initial="closed"
120+
initial={isOpen ? "open" : "closed"}
119121
>
120122
{item.items.map((childItem, idx) => (
121123
<NavLink item={childItem} path={path} key={idx} />
@@ -166,7 +168,7 @@ const SideNav = ({ path }: SideNavProps) => {
166168
aria-label={t("common:nav-developers-docs")}
167169
>
168170
{docLinks.map((item, idx) => (
169-
<NavLink item={item} path={path} key={idx} />
171+
<NavLink item={item} path={path} key={idx} isTopLevel />
170172
))}
171173
</Box>
172174
)

src/components/Staking/StakingProductsCardGrid.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import {
2525
UnknownProductGlyphIcon,
2626
WarningProductGlyphIcon,
2727
} from "@/components/icons/staking"
28-
import Translation from "@/components/Translation"
2928

3029
import { MatomoEventOptions } from "@/lib/utils/matomo"
3130

@@ -276,8 +275,7 @@ const StakingProductCard: React.FC<ICardProps> = ({
276275
</List>
277276
</Box>
278277
<Box {...PADDED_DIV_STYLE}>
279-
{/* TODO: Matomo - re-enable */}
280-
<ButtonLink to={url} /* customEventOptions={matomo} */ width="100%">
278+
<ButtonLink to={url} customEventOptions={matomo} width="100%">
281279
{t("page-staking-products-get-started")}
282280
</ButtonLink>
283281
</Box>

0 commit comments

Comments
 (0)