Skip to content

Commit 8fc25df

Browse files
authored
Merge pull request #15196 from ethereum/staging
Staging patches -> dev
2 parents f07d097 + 70a1ea4 commit 8fc25df

File tree

15 files changed

+63
-227
lines changed

15 files changed

+63
-227
lines changed

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

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import I18nProvider from "@/components/I18nProvider"
66
import mdComponents from "@/components/MdComponents"
77

88
import { dataLoader } from "@/lib/utils/data/dataLoader"
9+
import { dateToString } from "@/lib/utils/date"
910
import { getPostSlugs } from "@/lib/utils/md"
1011
import { getRequiredNamespacesForPage } from "@/lib/utils/translations"
1112

@@ -18,6 +19,18 @@ import { getMdMetadata } from "@/lib/md/metadata"
1819

1920
const loadData = dataLoader([["gfissues", fetchGFIs]])
2021

22+
function getLayoutFromSlug(slug: string) {
23+
if (slug.includes("developers/docs")) {
24+
return "docs"
25+
}
26+
27+
if (slug.includes("developers/tutorials")) {
28+
return "tutorial"
29+
}
30+
31+
return "static"
32+
}
33+
2134
export default async function Page({
2235
params,
2336
}: {
@@ -49,6 +62,7 @@ export default async function Page({
4962
tocItems,
5063
lastEditLocaleTimestamp,
5164
isTranslated,
65+
contributors,
5266
} = await getPageData({
5367
locale,
5468
slug,
@@ -61,9 +75,14 @@ export default async function Page({
6175
})
6276

6377
// Determine the actual layout after we have the frontmatter
64-
const layout = frontmatter.template || "static"
78+
const layout = frontmatter.template || getLayoutFromSlug(slug)
6579
const Layout = layoutMapping[layout]
6680

81+
// If the page has a published date, format it
82+
if ("published" in frontmatter) {
83+
frontmatter.published = dateToString(frontmatter.published)
84+
}
85+
6786
// Get i18n messages
6887
const allMessages = await getMessages({ locale })
6988
const requiredNamespaces = getRequiredNamespacesForPage(slug, layout)
@@ -77,6 +96,9 @@ export default async function Page({
7796
tocItems={tocItems}
7897
lastEditLocaleTimestamp={lastEditLocaleTimestamp}
7998
contentNotTranslated={!isTranslated}
99+
contributors={contributors}
100+
// TODO: Remove this once we have a real timeToRead value
101+
timeToRead={2}
80102
>
81103
{content}
82104
</Layout>
@@ -85,7 +107,7 @@ export default async function Page({
85107
}
86108

87109
export async function generateStaticParams() {
88-
const slugs = await getPostSlugs("/", /\/developers/)
110+
const slugs = await getPostSlugs("/")
89111

90112
return LOCALES_CODES.flatMap((locale) =>
91113
slugs.map((slug) => ({
@@ -95,6 +117,8 @@ export async function generateStaticParams() {
95117
)
96118
}
97119

120+
export const dynamicParams = false
121+
98122
export async function generateMetadata({
99123
params,
100124
}: {

app/[locale]/developers/docs/[[...doc]]/page.tsx

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

app/[locale]/developers/tutorials/[...tutorial]/page.tsx

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

next.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ module.exports = (phase, { defaultConfig }) => {
124124
"node_modules/@swc/core-linux-x64-musl",
125125
"node_modules/@esbuild/linux-x64",
126126
"src/data",
127-
"src/intl",
128127
"public/**/*.jpg",
129128
"public/**/*.png",
130129
"public/**/*.webp",

public/content/developers/docs/evm/opcodes/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ For operations with dynamic gas costs, see [gas.md](https://github.com/wolflo/ev
1818
💡 Quick tip: To view entire lines, use `[shift] + scroll` to scroll horizontally on desktop.
1919

2020
| Stack | Name | Gas | Initial Stack | Resulting Stack | Mem / Storage | Notes |
21-
| :---: | :------------- | :---------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------- | :------------------------------ | :---------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
21+
| :---: | :------------- | :---------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------- | :------------------------------ | :---------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------- |
2222
| 00 | STOP | 0 | | | | halt execution |
2323
| 01 | ADD | 3 | `a, b` | `a + b` | | (u)int256 addition modulo 2\*\*256 |
2424
| 02 | MUL | 5 | `a, b` | `a * b` | | (u)int256 multiplication modulo 2\*\*256 |

src/components/MdComponents/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { ButtonLink } from "../ui/buttons/Button"
2626
import { Divider } from "../ui/divider"
2727
import { Flex } from "../ui/flex"
2828
import { ListItem, OrderedList, UnorderedList } from "../ui/list"
29-
import { mdxTableComponents } from "../ui/table"
29+
import { mdxTableComponents } from "../ui/mdx-table-components"
3030
import { Tag } from "../ui/tag"
3131

3232
export const commonHeadingAttributes = (className: string, id?: string) => ({
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import {
2+
Table,
3+
TableBody,
4+
TableCell,
5+
TableHead,
6+
TableHeader,
7+
TableRow,
8+
} from "./table"
9+
10+
export const mdxTableComponents = {
11+
table: Table,
12+
td: ({ align, ...rest }) => <TableCell align={align} {...rest} />,
13+
th: ({ align, ...rest }) => <TableHead align={align} {...rest} />,
14+
tr: (props) => <TableRow {...props} />,
15+
tbody: (props) => <TableBody {...props} />,
16+
thead: (props) => <TableHeader {...props} />,
17+
}

src/components/ui/table.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -180,17 +180,7 @@ const TableCaption = React.forwardRef<
180180
))
181181
TableCaption.displayName = "TableCaption"
182182

183-
const mdxTableComponents = {
184-
table: Table,
185-
td: ({ align, ...rest }) => <TableCell align={align} {...rest} />,
186-
th: ({ align, ...rest }) => <TableHead align={align} {...rest} />,
187-
tr: (props) => <TableRow {...props} />,
188-
tbody: (props) => <TableBody {...props} />,
189-
thead: (props) => <TableHeader {...props} />,
190-
}
191-
192183
export {
193-
mdxTableComponents,
194184
Table,
195185
TableBody,
196186
TableCaption,

src/data/listen-to-feature/playlist.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { normalizeSlug } from "@/lib/utils/url"
2+
13
import ethAudio from "@/data/audio/eth/eth.mp3"
24
import smartContractsAudio from "@/data/audio/smart-contracts/smart-contracts.mp3"
35
import walletsAudio from "@/data/audio/wallets/wallets.mp3"
@@ -41,7 +43,9 @@ export const getPlaylistBySlug = (
4143
index: number
4244
} => {
4345
for (const playlist of Object.values(listenToPlaylists)) {
44-
const index = playlist.findIndex((item) => item.slug === slug)
46+
const index = playlist.findIndex(
47+
(item) => normalizeSlug(item.slug) === normalizeSlug(slug)
48+
)
4549
if (index !== -1) {
4650
return { playlist, index }
4751
}

src/i18n/loadMessages.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import fs from "fs"
22
import path from "path"
33

4-
import { cache } from "react"
5-
64
function getNamespaces(localePath: string): string[] {
75
return fs
86
.readdirSync(localePath)
@@ -12,7 +10,7 @@ function getNamespaces(localePath: string): string[] {
1210

1311
const messagesCache: Record<string, Record<string, string>> = {}
1412

15-
async function loadMessages(locale: string) {
13+
export async function loadMessages(locale: string) {
1614
if (messagesCache[locale]) {
1715
return messagesCache[locale]
1816
}
@@ -32,6 +30,3 @@ async function loadMessages(locale: string) {
3230
messagesCache[locale] = messages
3331
return messages
3432
}
35-
36-
// Keep the React cache wrapper as well for RSC optimization
37-
export const getMessages = cache(loadMessages)

0 commit comments

Comments
 (0)