Skip to content

Commit 35ccc1a

Browse files
authored
Merge pull request #10415 from ethereum/staging
Staging -> dev
2 parents d0410fc + a8a1f76 commit 35ccc1a

File tree

6 files changed

+19
-14
lines changed

6 files changed

+19
-14
lines changed

src/components/Link.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { Lang } from "../utils/languages"
1717
import { trackCustomEvent, MatomoEventOptions } from "../utils/matomo"
1818
import * as url from "../utils/url"
1919
import { Direction } from "../types"
20+
import { SITE_URL, DISCORD_PATH } from "../constants"
2021

2122
export interface IBaseProps {
2223
to?: string
@@ -63,8 +64,10 @@ const Link: React.FC<IProps> = ({
6364

6465
// TODO: in the next PR we are going to deprecate the `to` prop and just use `href`
6566
// this is to support the ButtonLink component which uses the `to` prop
66-
const to = (toProp ?? href)!
67+
let to = (toProp ?? href)!
6768

69+
const isDiscordInvite = url.isDiscordInvite(to)
70+
if (isDiscordInvite) to = new URL(DISCORD_PATH, SITE_URL).href
6871
const isExternal = url.isExternal(to)
6972
const isHash = url.isHash(to)
7073
const isGlossary = url.isGlossary(to)

src/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
export const SITE_URL = "https://ethereum.org" as const
2+
export const DISCORD_PATH = "/discord/" as const
13
export const GATSBY_FUNCTIONS_PATH = process.env.GATSBY_FUNCTIONS_PATH || "/api"
24

35
// Quiz Hub

src/data/quizzes/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,27 @@ const quizzes: RawQuizzes = {
1212
questions: ["b001", "b002", "b003", "b004"],
1313
},
1414
web3: {
15-
title: "what-is-web3",
15+
title: "web3",
1616
questions: ["c001", "c002", "c003", "c004", "c005"],
1717
},
1818
wallets: {
19-
title: "what-is-a-wallet",
19+
title: "wallets",
2020
questions: ["d001", "d002", "d003", "d004"],
2121
},
2222
security: {
23-
title: "security",
23+
title: "ethereum-security",
2424
questions: ["e001", "e002", "e003", "e004", "d003"],
2525
},
2626
nfts: {
27-
title: "what-are-nfts",
27+
title: "nft-page",
2828
questions: ["f001", "f002", "f003", "f004", "f005"],
2929
},
3030
"layer-2": {
31-
title: "using-layer-2",
31+
title: "layer-2",
3232
questions: ["g001", "g002", "g003", "g004"],
3333
},
3434
merge: {
35-
title: "what-is-the-merge",
35+
title: "page-assets-merge",
3636
questions: ["h001", "h002", "h003", "h004", "h005"],
3737
},
3838
}

src/intl/en/common.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
"page-developers-aria-label": "Developers' Menu",
139139
"page-index-meta-title": "Home",
140140
"page-last-updated": "Page last updated",
141+
"page-what-is-ethereum-what-is-ether": "What is ether?",
141142
"pbs": "Proposer-builder separation",
142143
"pools": "Pooled staking",
143144
"privacy-policy": "Privacy policy",

src/intl/en/learn-quizzes.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,22 @@
1010
"explanation": "Explanation",
1111
"next-question": "Next question",
1212
"next-quiz": "Next quiz",
13-
"page-what-is-ethereum-what-is-ether": "What is ether?",
13+
"page-assets-merge": "The Merge",
1414
"passed": "You passed the quiz!",
1515
"questions": "Questions",
1616
"questions-answered": "Questions answered:",
1717
"quizzes-subtitle": "Find out how well you understand Ethereum and cryptocurrencies. Are you ready to become an expert?",
1818
"retry": "Retry rate:",
1919
"score": "Score",
2020
"see-results": "See results",
21-
"security": "Security",
2221
"share-results": "Share results",
2322
"start": "Start",
2423
"submit-answer": "Check answer",
2524
"test-your-knowledge": "Test your Ethereum knowledge",
2625
"try-again": "Try again",
2726
"using-ethereum": "Using Ethereum",
2827
"using-ethereum-description": "Delve into the real-world applications of Ethereum and uncover how this revolutionary blockchain platform is reshaping industries. This is a great way to make sure you understand things well enough before you start using cryptocurrencies actively.",
29-
"using-layer-2": "Using layer 2",
30-
"what-are-nfts": "What are NFTs?",
3128
"want-more-quizzes": "Want to see more quizzes here?",
32-
"what-is-a-wallet": "What is a wallet?",
33-
"what-is-the-merge": "What is the Merge?",
34-
"what-is-web3": "What is Web3?",
3529
"your-results": "Your results",
3630
"your-total": "Your total points",
3731
"a001-prompt": "The biggest difference between Ethereum and Bitcoin is:",

src/utils/url.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
import { DISCORD_PATH } from "../constants"
2+
13
const HASH_PATTERN = /^#.*/
24
const isHashLink = (href: string): boolean => HASH_PATTERN.test(href)
35

6+
export const isDiscordInvite = (href: string): boolean =>
7+
href.includes(DISCORD_PATH) && !href.includes("http")
8+
49
export const isExternal = (href: string): boolean =>
510
href.includes("http") || href.includes("mailto:") || href.includes("ipfs")
611

0 commit comments

Comments
 (0)