Skip to content

Commit a043b75

Browse files
committed
Merge dev
2 parents 63e91e5 + d9f108e commit a043b75

File tree

159 files changed

+5745
-1282
lines changed

Some content is hidden

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

159 files changed

+5745
-1282
lines changed

.all-contributorsrc

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8142,6 +8142,42 @@
81428142
"contributions": [
81438143
"doc"
81448144
]
8145+
},
8146+
{
8147+
"login": "chendatony31",
8148+
"name": "Tony Chen",
8149+
"avatar_url": "https://avatars.githubusercontent.com/u/2173383?v=4",
8150+
"profile": "https://tokenpocket.pro",
8151+
"contributions": [
8152+
"doc"
8153+
]
8154+
},
8155+
{
8156+
"login": "metalc",
8157+
"name": "metalc",
8158+
"avatar_url": "https://avatars.githubusercontent.com/u/102876192?v=4",
8159+
"profile": "https://github.com/metalc",
8160+
"contributions": [
8161+
"doc"
8162+
]
8163+
},
8164+
{
8165+
"login": "Tuongg2312",
8166+
"name": "Tuongg2312",
8167+
"avatar_url": "https://avatars.githubusercontent.com/u/107551539?v=4",
8168+
"profile": "https://github.com/Tuongg2312",
8169+
"contributions": [
8170+
"doc"
8171+
]
8172+
},
8173+
{
8174+
"login": "ErikSaunier",
8175+
"name": "Ξrik Saunier",
8176+
"avatar_url": "https://avatars.githubusercontent.com/u/1122363?v=4",
8177+
"profile": "https://github.com/ErikSaunier",
8178+
"contributions": [
8179+
"doc"
8180+
]
81458181
}
81468182
],
81478183
"contributorsPerLine": 7,

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,12 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
13051305
<td align="center"><a href="https://github.com/NachoRoizman"><img src="https://avatars.githubusercontent.com/u/107893772?v=4?s=100" width="100px;" alt=""/><br /><sub><b>NachoRoizman</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=NachoRoizman" title="Documentation">📖</a></td>
13061306
<td align="center"><a href="https://linkedin.com/in/miragaya-ivan"><img src="https://avatars.githubusercontent.com/u/72365253?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Iván Miragaya</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=M-Ivan" title="Code">💻</a></td>
13071307
<td align="center"><a href="https://github.com/smejak"><img src="https://avatars.githubusercontent.com/u/20759274?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jakub Smékal</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=smejak" title="Documentation">📖</a></td>
1308+
<td align="center"><a href="https://tokenpocket.pro"><img src="https://avatars.githubusercontent.com/u/2173383?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tony Chen</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=chendatony31" title="Documentation">📖</a></td>
1309+
<td align="center"><a href="https://github.com/metalc"><img src="https://avatars.githubusercontent.com/u/102876192?v=4?s=100" width="100px;" alt=""/><br /><sub><b>metalc</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=metalc" title="Documentation">📖</a></td>
1310+
</tr>
1311+
<tr>
1312+
<td align="center"><a href="https://github.com/Tuongg2312"><img src="https://avatars.githubusercontent.com/u/107551539?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tuongg2312</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=Tuongg2312" title="Documentation">📖</a></td>
1313+
<td align="center"><a href="https://github.com/ErikSaunier"><img src="https://avatars.githubusercontent.com/u/1122363?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ξrik Saunier</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=ErikSaunier" title="Documentation">📖</a></td>
13081314
</tr>
13091315
</table>
13101316

docs/event-tracking.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,14 @@ import { trackCustomEvent } from "../utils/matomo"
7575
The function requires an object of event options. See the example below.
7676

7777
```javascript
78-
const handleEvent = (): void => {
79-
trackCustomEvent({
80-
eventCategory: `FeedbackWidget toggled`,
81-
eventAction: `Clicked`,
82-
eventName: `Opened feedback widget`,
83-
eventValue: `1`,
84-
})
85-
}
78+
const handleEvent = (): void => {
79+
trackCustomEvent({
80+
eventCategory: `FeedbackWidget toggled`,
81+
eventAction: `Clicked`,
82+
eventName: `Opened feedback widget`,
83+
eventValue: `1`,
84+
})
85+
}
8686
```
8787

8888
## Hidden gem of tracking: Value

gatsby-browser.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
defaultLanguage,
2323
isLang,
2424
} from "./src/utils/languages"
25+
import { IS_DEV } from "./src/utils/env"
2526
import { Context } from "./src/types"
2627

2728
// Default languages included:
@@ -42,7 +43,7 @@ export const wrapPageElement: GatsbyBrowser<
4243

4344
// client side redirect on paths that don't have a locale in them. Most useful
4445
// on dev env where we don't have server redirects
45-
if (!isLang(pathLocale)) {
46+
if (IS_DEV && !isLang(pathLocale)) {
4647
let detected =
4748
window.localStorage.getItem("eth-org-language") ||
4849
browserLang({

gatsby-config.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,19 @@ const config: GatsbyConfig = {
230230
},
231231
},
232232
// Needed for Gatsby Cloud redirect support
233-
`gatsby-plugin-gatsby-cloud`,
233+
{
234+
resolve: `gatsby-plugin-gatsby-cloud`,
235+
options: {
236+
generateMatchPathRewrites: false,
237+
},
238+
},
234239
// Creates `_redirects` & `_headers` build files for Netlify
235-
`gatsby-plugin-netlify`,
240+
{
241+
resolve: `gatsby-plugin-netlify`,
242+
options: {
243+
generateMatchPathRewrites: false,
244+
},
245+
},
236246
],
237247
// https://www.gatsbyjs.com/docs/reference/release-notes/v2.28/#feature-flags-in-gatsby-configjs
238248
flags: {

gatsby-node.ts

Lines changed: 58 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ import redirects from "./redirects.json"
2323

2424
const exec = util.promisify(child_process.exec)
2525

26+
const commonRedirectProps = {
27+
isPermanent: true,
28+
ignoreCase: true,
29+
force: true,
30+
}
31+
2632
/**
2733
* Markdown isOutdated check
2834
* Parse header ids in markdown file (both translated and english) and compare their info structure.
@@ -190,13 +196,11 @@ export const createPages: GatsbyNode<any, Context>["createPages"] = async ({
190196
}) => {
191197
const { createPage, createRedirect } = actions
192198

193-
// server side redirects
199+
// custom redirects defined in `redirects.json`
194200
redirects.forEach((redirect) => {
195201
createRedirect({
202+
...commonRedirectProps,
196203
...redirect,
197-
isPermanent: true,
198-
ignoreCase: true,
199-
force: true,
200204
})
201205
})
202206

@@ -260,6 +264,12 @@ export const createPages: GatsbyNode<any, Context>["createPages"] = async ({
260264
// e.g. English file: "src/content/community/index.md"
261265
// e.g. corresponding German file: "src/content/translations/de/community/index.md"
262266
if (language === defaultLanguage) {
267+
createRedirect({
268+
...commonRedirectProps,
269+
fromPath: slug.slice(3),
270+
toPath: slug,
271+
})
272+
263273
for (const lang of supportedLanguages) {
264274
const splitPath = relativePath.split("/")
265275
splitPath.splice(2, 0, `translations/${lang}`)
@@ -315,6 +325,14 @@ export const createPages: GatsbyNode<any, Context>["createPages"] = async ({
315325
// we can remove this logic and the `/pages-conditional/` directory.
316326
const outdatedMarkdown = [`eth`, `dapps`, `wallets`, `what-is-ethereum`]
317327
outdatedMarkdown.forEach((page) => {
328+
const originalPath = `/${page}/`
329+
330+
createRedirect({
331+
...commonRedirectProps,
332+
fromPath: originalPath,
333+
toPath: `/${defaultLanguage}${originalPath}`,
334+
})
335+
318336
supportedLanguages.forEach(async (lang) => {
319337
const markdownPath = path.resolve(
320338
`src/content/translations/${lang}/${page}/index.md`
@@ -326,7 +344,7 @@ export const createPages: GatsbyNode<any, Context>["createPages"] = async ({
326344
page,
327345
lang
328346
)
329-
const originalPath = `/${page}/`
347+
330348
const slug = `/${lang}${originalPath}`
331349

332350
createPage<Context>({
@@ -356,14 +374,29 @@ export const onCreatePage: GatsbyNode<any, Context>["onCreatePage"] = async ({
356374
page,
357375
actions,
358376
}) => {
359-
const { createPage, deletePage } = actions
377+
const { createPage, deletePage, createRedirect } = actions
360378

361-
// create routes without the lang prefix e.g. `/{path}` as our i18n plugin
362-
// only creates `/{lang}/{path}` routes. This is useful on dev env to avoid
363-
// getting a 404 since we don't have server side redirects
364-
if (IS_DEV && page.path.startsWith(`/${defaultLanguage}`)) {
379+
const isDefaultLang = page.path.startsWith(`/${defaultLanguage}`)
380+
381+
if (isDefaultLang) {
365382
const path = page.path.slice(3)
366-
createPage({ ...page, path })
383+
384+
if (IS_DEV) {
385+
// create routes without the lang prefix e.g. `/{path}` as our i18n plugin
386+
// only creates `/{lang}/{path}` routes. This is useful on dev env to avoid
387+
// getting a 404 since we don't have server side redirects
388+
createPage({ ...page, path })
389+
}
390+
391+
if (!IS_DEV && !path.match(/^\/404(\/|.html)$/)) {
392+
// on prod, indicate our servers to redirect the root paths to the
393+
// `/{defaultLang}/{path}`
394+
createRedirect({
395+
...commonRedirectProps,
396+
fromPath: path,
397+
toPath: page.path,
398+
})
399+
}
367400
}
368401

369402
const isTranslated = page.context.locale !== defaultLanguage
@@ -387,6 +420,20 @@ export const onCreatePage: GatsbyNode<any, Context>["onCreatePage"] = async ({
387420
}
388421
}
389422

423+
export const onPostBootstrap: GatsbyNode["onPostBootstrap"] = ({ actions }) => {
424+
const { createRedirect } = actions
425+
426+
supportedLanguages.forEach((lang) => {
427+
createRedirect({
428+
...commonRedirectProps,
429+
fromPath: `/${lang}/*`,
430+
toPath: `/${lang}/404`,
431+
statusCode: 404,
432+
force: false,
433+
})
434+
})
435+
}
436+
390437
export const createSchemaCustomization: GatsbyNode["createSchemaCustomization"] =
391438
({ actions, schema }) => {
392439
const { createTypes } = actions

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
"@types/node": "^17.0.23",
8080
"@types/react": "^17.0.39",
8181
"@types/react-dom": "^17.0.11",
82+
"@types/react-instantsearch-dom": "^6.12.3",
8283
"@types/styled-components": "^5.1.25",
8384
"@types/styled-system": "^5.1.15",
8485
"babel-preset-gatsby": "^2.14.0",

redirects.json

Lines changed: 8 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -47,94 +47,14 @@
4747
"fromPath": "/beginners",
4848
"toPath": "/en/what-is-ethereum/"
4949
},
50-
{
51-
"fromPath": "/",
52-
"toPath": "/en/"
53-
},
54-
{
55-
"fromPath": "/what-is-ethereum/",
56-
"toPath": "/en/what-is-ethereum/"
57-
},
58-
{
59-
"fromPath": "/eth/",
60-
"toPath": "/en/eth/"
61-
},
62-
{
63-
"fromPath": "/dapps/",
64-
"toPath": "/en/dapps/"
65-
},
66-
{
67-
"fromPath": "/wallets/",
68-
"toPath": "/en/wallets/"
69-
},
7050
{
7151
"fromPath": "/eth2/",
7252
"toPath": "/en/upgrades/"
7353
},
74-
{
75-
"fromPath": "/upgrades/",
76-
"toPath": "/en/upgrades/"
77-
},
78-
{
79-
"fromPath": "/staking/",
80-
"toPath": "/en/staking/"
81-
},
82-
{
83-
"fromPath": "/learn/",
84-
"toPath": "/en/learn/"
85-
},
86-
{
87-
"fromPath": "/community/",
88-
"toPath": "/en/community/"
89-
},
9054
{
9155
"fromPath": "/build/",
9256
"toPath": "/en/developers/learning-tools/"
9357
},
94-
{
95-
"fromPath": "/developers/",
96-
"toPath": "/en/developers/"
97-
},
98-
{
99-
"fromPath": "/enterprise/",
100-
"toPath": "/en/enterprise/"
101-
},
102-
{
103-
"fromPath": "/whitepaper/",
104-
"toPath": "/en/whitepaper/"
105-
},
106-
{
107-
"fromPath": "/foundation/",
108-
"toPath": "/en/foundation/"
109-
},
110-
{
111-
"fromPath": "/eips/",
112-
"toPath": "/en/eips/"
113-
},
114-
{
115-
"fromPath": "/about/",
116-
"toPath": "/en/about/"
117-
},
118-
{
119-
"fromPath": "/privacy-policy/",
120-
"toPath": "/en/privacy-policy/"
121-
},
122-
{
123-
"fromPath": "/terms-of-use/",
124-
"toPath": "/en/terms-of-use/"
125-
},
126-
{
127-
"fromPath": "/cookie-policy/",
128-
"toPath": "/en/cookie-policy/"
129-
},
130-
{
131-
"fromPath": "/languages/",
132-
"toPath": "/en/languages/"
133-
},
134-
{
135-
"fromPath": "/enterprise/",
136-
"toPath": "/en/enterprise/"
137-
},
13858
{
13959
"fromPath": "/java/",
14060
"toPath": "/en/developers/docs/programming-languages/java/"
@@ -167,26 +87,14 @@
16787
"fromPath": "/dart/",
16888
"toPath": "/en/developers/docs/programming-languages/dart/"
16989
},
170-
{
171-
"fromPath": "/nft/",
172-
"toPath": "/en/nft/"
173-
},
17490
{
17591
"fromPath": "/nfts/",
17692
"toPath": "/en/nft/"
17793
},
178-
{
179-
"fromPath": "/dao/",
180-
"toPath": "/en/dao/"
181-
},
18294
{
18395
"fromPath": "/daos/",
18496
"toPath": "/en/dao/"
18597
},
186-
{
187-
"fromPath": "/defi/",
188-
"toPath": "/en/defi/"
189-
},
19098
{
19199
"fromPath": "/layer2/",
192100
"toPath": "/en/layer-2/"
@@ -362,5 +270,13 @@
362270
{
363271
"fromPath": "/*/contributing/translation-program/content-versions/",
364272
"toPath": "/:splat/contributing/translation-program/content-buckets/"
273+
},
274+
{
275+
"fromPath": "/*/developers/docs/smart-contracts/source-code-verification/",
276+
"toPath": "/:splat/developers/docs/smart-contracts/verifying/"
277+
},
278+
{
279+
"fromPath": "/*/developers/docs/smart-contracts/upgrading-smart-contracts/",
280+
"toPath": "/:splat/developers/docs/smart-contracts/upgrading/"
365281
}
366282
]

src/assets/wallets/tokenpocket.png

5.68 KB
Loading

src/components/AssetDownload.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ interface IPropsWithSVG extends IPropsBase {
2626
}
2727
interface IPropsWithImage extends IPropsBase {
2828
svg?: never
29-
image: string
29+
image: any
3030
}
3131

3232
export type IProps = IPropsWithImage | IPropsWithSVG

0 commit comments

Comments
 (0)