Skip to content

Commit 2d40136

Browse files
committed
Merge branch 'dev' into pr/JoeChenJ/14851
2 parents 8e26406 + e18eb15 commit 2d40136

File tree

1,046 files changed

+31386
-5940
lines changed

Some content is hidden

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

1,046 files changed

+31386
-5940
lines changed

.all-contributorsrc

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12697,6 +12697,33 @@
1269712697
"contributions": [
1269812698
"content"
1269912699
]
12700+
},
12701+
{
12702+
"login": "jenish-thapa",
12703+
"name": "Jenish Thapa",
12704+
"avatar_url": "https://avatars.githubusercontent.com/u/141203631?v=4",
12705+
"profile": "https://github.com/jenish-thapa",
12706+
"contributions": [
12707+
"ideas"
12708+
]
12709+
},
12710+
{
12711+
"login": "iusx",
12712+
"name": "iusx",
12713+
"avatar_url": "https://avatars.githubusercontent.com/u/57232813?v=4",
12714+
"profile": "https://jiangxue.org/~ritsu",
12715+
"contributions": [
12716+
"code"
12717+
]
12718+
},
12719+
{
12720+
"login": "JJOptimist",
12721+
"name": "JJOptimist",
12722+
"avatar_url": "https://avatars.githubusercontent.com/u/86833563?v=4",
12723+
"profile": "https://github.com/JJOptimist",
12724+
"contributions": [
12725+
"bug"
12726+
]
1270012727
}
1270112728
],
1270212729
"contributorsPerLine": 7,

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
# NEXT_PUBLIC_ALGOLIA_APP_ID=insertValue
88
# NEXT_PUBLIC_ALGOLIA_SEARCH_KEY=insertValue
99
# NEXT_PUBLIC_ALGOLIA_BASE_SEARCH_INDEX_NAME=insertValue
10+
11+
# Github token for read-only use with api functions
1012
# NEXT_PUBLIC_GITHUB_TOKEN_READ_ONLY=insertValue
1113

1214
# Etherscan API key (required for Etherscan API fetches)

.eslintrc.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
["^@/data"],
3434
// From the `constants` directory.
3535
["^@/lib/constants"],
36-
// From the `.storybook/utils` file
37-
["^@/storybook-utils"],
36+
// `.storybook` directory and utils files`
37+
["^@/storybook","^@/storybook-utils"],
3838
// Parent imports. Put `..` last.
3939
["^\\.\\.(?!/?$)", "^\\.\\./?$"],
4040
// Other relative imports. Put same-folder imports and `.` last.

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
* @wackerow @corwintines @pettinarip @minimalsm
99

1010
# Owners of specific files
11-
/src/data/consensus-bounty-hunters.json @djrtwo @asanso @fredriksvantes
11+
/src/data/consensus-bounty-hunters.json @asanso @fredriksvantes
1212
/src/data/wallets/new-to-crypto.ts @konopkja @minimalsm
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Suggest a resource
2+
description: Suggest a new resource to list on ethereum.org/resources
3+
title: Suggest a resource
4+
labels: ["resource 📚"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Before suggesting a resource, make sure you've read [our listing policy](https://www.ethereum.org/en/contributing/adding-resources/).
10+
- type: markdown
11+
attributes:
12+
value: Only continue with the issue if your resource meets the criteria listed there.
13+
- type: markdown
14+
attributes:
15+
value: If it does, complete the following information which we need to accurately list the resource.
16+
- type: markdown
17+
id: resource_info
18+
attributes:
19+
value: "## Resource info"
20+
- type: input
21+
id: resource_name
22+
attributes:
23+
label: Name
24+
description: Please provide the official name of the resource
25+
validations:
26+
required: true
27+
- type: input
28+
id: resource_url
29+
attributes:
30+
label: Resource URL
31+
description: Please provide a URL to the resource
32+
validations:
33+
required: true
34+
- type: textarea
35+
id: resource_description
36+
attributes:
37+
label: Description
38+
description: Please provide a short 1-2 sentence description of the resource
39+
validations:
40+
required: true
41+
- type: textarea
42+
id: resource_logo
43+
attributes:
44+
label: Logo
45+
description: |
46+
Please provide an SVG or transparent PNG
47+
Tip: You can attach images by clicking this area to highlight it and then dragging files in.
48+
- type: input
49+
id: resource_category
50+
attributes:
51+
label: Category
52+
description: Please specify a best fit to categorize the resource (e.g., DeFi, NFT, Scaling, etc.)
53+
- type: checkboxes
54+
id: resource_work_on
55+
attributes:
56+
label: Would you like to work on this issue?
57+
options:
58+
- label: "Yes"
59+
required: false
60+
- label: "No"
61+
required: false
62+
validations:
63+
required: true

.storybook/main.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import path from "path"
2+
13
import TsconfigPathsPlugin from "tsconfig-paths-webpack-plugin"
24
import type { StorybookConfig } from "@storybook/nextjs"
35

@@ -51,6 +53,11 @@ const config: StorybookConfig = {
5153
extensions: config.resolve.extensions,
5254
}),
5355
]
56+
57+
config.resolve.alias = {
58+
...config.resolve.alias,
59+
"@/storybook/*": path.resolve(__dirname, "./.storybook/"),
60+
}
5461
}
5562

5663
// This modifies the existing image rule to exclude .svg files

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1942,6 +1942,11 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
19421942
<td align="center" valign="top" width="14.28%"><a href="https://github.com/itzVarsha"><img src="https://avatars.githubusercontent.com/u/138134029?v=4?s=100" width="100px;" alt="Varshitha"/><br /><sub><b>Varshitha</b></sub></a><br /><a href="#maintenance-itzVarsha" title="Maintenance">🚧</a></td>
19431943
<td align="center" valign="top" width="14.28%"><a href="https://alexandriaroberts.dev/"><img src="https://avatars.githubusercontent.com/u/31341867?v=4?s=100" width="100px;" alt="Alexandria Roberts"/><br /><sub><b>Alexandria Roberts</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=alexandriaroberts" title="Code">💻</a></td>
19441944
<td align="center" valign="top" width="14.28%"><a href="https://github.com/colinlyguo"><img src="https://avatars.githubusercontent.com/u/102356659?v=4?s=100" width="100px;" alt="colin"/><br /><sub><b>colin</b></sub></a><br /><a href="#content-colinlyguo" title="Content">🖋</a></td>
1945+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/jenish-thapa"><img src="https://avatars.githubusercontent.com/u/141203631?v=4?s=100" width="100px;" alt="Jenish Thapa"/><br /><sub><b>Jenish Thapa</b></sub></a><br /><a href="#ideas-jenish-thapa" title="Ideas, Planning, & Feedback">🤔</a></td>
1946+
<td align="center" valign="top" width="14.28%"><a href="https://jiangxue.org/~ritsu"><img src="https://avatars.githubusercontent.com/u/57232813?v=4?s=100" width="100px;" alt="iusx"/><br /><sub><b>iusx</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=iusx" title="Code">💻</a></td>
1947+
</tr>
1948+
<tr>
1949+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/JJOptimist"><img src="https://avatars.githubusercontent.com/u/86833563?v=4?s=100" width="100px;" alt="JJOptimist"/><br /><sub><b>JJOptimist</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/issues?q=author%3AJJOptimist" title="Bug reports">🐛</a></td>
19451950
</tr>
19461951
</tbody>
19471952
</table>

app/[locale]/[...slug]/page.tsx

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
import pick from "lodash.pick"
2+
import { notFound } from "next/navigation"
3+
import { getMessages, setRequestLocale } from "next-intl/server"
4+
5+
import I18nProvider from "@/components/I18nProvider"
6+
import mdComponents from "@/components/MdComponents"
7+
8+
import { dataLoader } from "@/lib/utils/data/dataLoader"
9+
import { getPostSlugs } from "@/lib/utils/md"
10+
import { getRequiredNamespacesForPage } from "@/lib/utils/translations"
11+
12+
import { LOCALES_CODES } from "@/lib/constants"
13+
14+
import { componentsMapping, layoutMapping } from "@/layouts"
15+
import { fetchGFIs } from "@/lib/api/fetchGFIs"
16+
import { getPageData } from "@/lib/md/data"
17+
import { getMdMetadata } from "@/lib/md/metadata"
18+
19+
const loadData = dataLoader([["gfissues", fetchGFIs]])
20+
21+
export default async function Page({
22+
params,
23+
}: {
24+
params: Promise<{ locale: string; slug: string[] }>
25+
}) {
26+
const { locale, slug: slugArray } = await params
27+
28+
// Check if this specific path is in our valid paths
29+
const validPaths = await generateStaticParams()
30+
const isValidPath = validPaths.some(
31+
(path) =>
32+
path.locale === locale && path.slug.join("/") === slugArray.join("/")
33+
)
34+
35+
if (!isValidPath) {
36+
notFound()
37+
}
38+
39+
// Enable static rendering
40+
setRequestLocale(locale)
41+
42+
const [gfissues] = await loadData()
43+
44+
const slug = slugArray.join("/")
45+
46+
const {
47+
content,
48+
frontmatter,
49+
tocItems,
50+
lastEditLocaleTimestamp,
51+
isTranslated,
52+
} = await getPageData({
53+
locale,
54+
slug,
55+
// TODO: Address component typing error here (flip `FC` types to prop object types)
56+
// @ts-expect-error Incompatible component function signatures
57+
components: { ...mdComponents, ...componentsMapping },
58+
scope: {
59+
gfissues,
60+
},
61+
})
62+
63+
// Determine the actual layout after we have the frontmatter
64+
const layout = frontmatter.template || "static"
65+
const Layout = layoutMapping[layout]
66+
67+
// Get i18n messages
68+
const allMessages = await getMessages({ locale })
69+
const requiredNamespaces = getRequiredNamespacesForPage(slug, layout)
70+
const messages = pick(allMessages, requiredNamespaces)
71+
72+
return (
73+
<I18nProvider locale={locale} messages={messages}>
74+
<Layout
75+
slug={slug}
76+
frontmatter={frontmatter}
77+
tocItems={tocItems}
78+
lastEditLocaleTimestamp={lastEditLocaleTimestamp}
79+
contentNotTranslated={!isTranslated}
80+
>
81+
{content}
82+
</Layout>
83+
</I18nProvider>
84+
)
85+
}
86+
87+
export async function generateStaticParams() {
88+
const slugs = await getPostSlugs("/", /\/developers/)
89+
90+
return LOCALES_CODES.flatMap((locale) =>
91+
slugs.map((slug) => ({
92+
slug: slug.split("/").slice(1),
93+
locale,
94+
}))
95+
)
96+
}
97+
98+
export async function generateMetadata({
99+
params,
100+
}: {
101+
params: Promise<{ locale: string; slug: string[] }>
102+
}) {
103+
const { locale, slug } = await params
104+
105+
return await getMdMetadata({
106+
locale,
107+
slug,
108+
})
109+
}
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
import { join } from "path"
2+
3+
import pick from "lodash.pick"
4+
import { getMessages, setRequestLocale } from "next-intl/server"
5+
6+
import I18nProvider from "@/components/I18nProvider"
7+
import mdComponents from "@/components/MdComponents"
8+
9+
import { getPostSlugs } from "@/lib/utils/md"
10+
import { getRequiredNamespacesForPage } from "@/lib/utils/translations"
11+
12+
import { LOCALES_CODES } from "@/lib/constants"
13+
14+
import { docsComponents, DocsLayout } from "@/layouts"
15+
import { getPageData } from "@/lib/md/data"
16+
import { getMdMetadata } from "@/lib/md/metadata"
17+
18+
export default async function Page({
19+
params,
20+
}: {
21+
params: Promise<{ locale: string; doc?: string[] }>
22+
}) {
23+
const { locale, doc: docArray } = await params
24+
25+
// Enable static rendering
26+
setRequestLocale(locale)
27+
28+
const slug = join("developers/docs", ...(docArray || []))
29+
30+
const layout = "docs"
31+
32+
const {
33+
content,
34+
frontmatter,
35+
tocItems,
36+
lastEditLocaleTimestamp,
37+
contributors,
38+
isTranslated,
39+
} = await getPageData({
40+
locale,
41+
slug,
42+
// TODO: Address component typing error here (flip `FC` types to prop object types)
43+
// @ts-expect-error Incompatible component function signatures
44+
components: { ...mdComponents, ...docsComponents },
45+
layout,
46+
})
47+
48+
// Get i18n messages
49+
const allMessages = await getMessages({ locale })
50+
const requiredNamespaces = getRequiredNamespacesForPage(slug, layout)
51+
const messages = pick(allMessages, requiredNamespaces)
52+
53+
return (
54+
<I18nProvider locale={locale} messages={messages}>
55+
<DocsLayout
56+
slug={slug}
57+
frontmatter={frontmatter}
58+
tocItems={tocItems}
59+
lastEditLocaleTimestamp={lastEditLocaleTimestamp}
60+
contributors={contributors}
61+
contentNotTranslated={!isTranslated}
62+
>
63+
{content}
64+
</DocsLayout>
65+
</I18nProvider>
66+
)
67+
}
68+
69+
export async function generateStaticParams() {
70+
const slugs = await getPostSlugs("/developers/docs")
71+
72+
// Generate page paths for each supported locale
73+
return LOCALES_CODES.flatMap((locale) =>
74+
slugs.map((slug) => {
75+
return {
76+
// Splitting nested paths to generate proper slug
77+
doc: slug.replace("/developers/docs", "").split("/").slice(1),
78+
locale,
79+
}
80+
})
81+
)
82+
}
83+
84+
export async function generateMetadata({
85+
params,
86+
}: {
87+
params: Promise<{ locale: string; doc: string[] }>
88+
}) {
89+
const { locale, doc } = await params
90+
const slug = ["developers/docs", ...(doc || [])]
91+
92+
return await getMdMetadata({
93+
locale,
94+
slug,
95+
})
96+
}
97+
98+
export const dynamicParams = false

0 commit comments

Comments
 (0)