Skip to content

Commit 968824d

Browse files
committed
Merge branch 'dev' into string-finalization
2 parents 7757088 + 22d1f7e commit 968824d

Some content is hidden

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

43 files changed

+1051
-2301
lines changed

.env.example

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,5 @@ BUILD_LOCALES=
3535
# fixed number of CPUs (e.g. 2) to limit the demand during build time
3636
LIMIT_CPUS=
3737

38-
# Sentry auth token required for error tracking
39-
SENTRY_AUTH_TOKEN=
40-
NEXT_PUBLIC_SENTRY_DSN=
41-
4238
# Enables the bundle analyzer
4339
ANALYZE=false

instrumentation.ts

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

next.config.js

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/* eslint-disable @typescript-eslint/no-var-requires */
22
const { PHASE_DEVELOPMENT_SERVER } = require("next/constants")
3-
const { withSentryConfig } = require("@sentry/nextjs")
43

54
const withBundleAnalyzer = require("@next/bundle-analyzer")({
65
enabled: process.env.ANALYZE === "true",
@@ -27,7 +26,7 @@ module.exports = (phase, { defaultConfig }) => {
2726
let nextConfig = {
2827
...defaultConfig,
2928
reactStrictMode: true,
30-
webpack: (config, { webpack }) => {
29+
webpack: (config) => {
3130
config.module.rules.push({
3231
test: /\.ya?ml$/,
3332
use: "yaml-loader",
@@ -58,30 +57,13 @@ module.exports = (phase, { defaultConfig }) => {
5857
// Modify the file loader rule to ignore *.svg, since we have it handled now.
5958
fileLoaderRule.exclude = /\.svg$/i
6059

61-
// Tree shake Sentry debug code
62-
// ref. https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/tree-shaking/#tree-shaking-with-nextjs
63-
config.plugins.push(
64-
new webpack.DefinePlugin({
65-
__SENTRY_DEBUG__: false,
66-
__RRWEB_EXCLUDE_IFRAME__: true,
67-
__RRWEB_EXCLUDE_SHADOW_DOM__: true,
68-
__SENTRY_EXCLUDE_REPLAY_WORKER__: true,
69-
})
70-
)
71-
7260
return config
7361
},
7462
i18n,
7563
trailingSlash: true,
7664
images: {
7765
deviceSizes: [640, 750, 828, 1080, 1200, 1504, 1920],
7866
},
79-
env: {
80-
NEXT_PUBLIC_CONTEXT: process.env.CONTEXT,
81-
},
82-
experimental: {
83-
instrumentationHook: true,
84-
},
8567
}
8668

8769
if (phase !== PHASE_DEVELOPMENT_SERVER) {
@@ -110,15 +92,5 @@ module.exports = (phase, { defaultConfig }) => {
11092
}
11193
}
11294

113-
return withBundleAnalyzer(
114-
withSentryConfig(nextConfig, {
115-
// TODO: temp config, update this to the correct org & project
116-
org: "ethereumorg-ow",
117-
project: "javascript-nextjs",
118-
authToken: process.env.SENTRY_AUTH_TOKEN,
119-
release: `${process.env.BUILD_ID}_${process.env.REVIEW_ID}`,
120-
disableLogger: true,
121-
silent: true,
122-
})
123-
)
95+
return withBundleAnalyzer(nextConfig)
12496
}

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
"@radix-ui/react-switch": "^1.1.0",
4949
"@radix-ui/react-tooltip": "^1.1.2",
5050
"@radix-ui/react-visually-hidden": "^1.1.0",
51-
"@sentry/nextjs": "^8.19.0",
5251
"@socialgouv/matomo-next": "^1.8.0",
5352
"chart.js": "^4.4.2",
5453
"chartjs-plugin-datalabels": "^2.2.0",

public/content/developers/docs/gas/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Ethereum gas and fees: technical overview
2+
title: "Ethereum gas and fees: technical overview"
33
description:
44
lang: en
55
---

public/content/roadmap/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ image: /images/heroes/roadmap-hub-hero.jpg
77
alt: "Ethereum roadmap"
88
summaryPoints:
99
buttons:
10-
- label: Further upgrades
10+
- content: Further upgrades
1111
toId: what-changes-are-coming
12-
- label: Past upgrades
12+
- content: Past upgrades
1313
href: /history/
1414
variant: outline
1515
---

public/content/smart-contracts/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Smart contracts: What are they and benefits
2+
title: "Smart contracts: What are they and benefits"
33
description: A non-technical introduction to smart contracts
44
lang: en
55
---

sentry.client.config.ts

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

src/components/CodeModal.tsx

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,36 @@
1-
import type { ReactNode } from "react"
2-
import {
3-
Modal,
4-
ModalBody,
5-
ModalCloseButton,
6-
ModalContent,
7-
ModalHeader,
8-
ModalOverlay,
9-
useColorModeValue,
10-
} from "@chakra-ui/react"
1+
import { Children, type ReactElement } from "react"
2+
import { useTranslation } from "next-i18next"
3+
import { IoMdCopy } from "react-icons/io"
4+
import { MdCheck } from "react-icons/md"
5+
import { Modal, ModalBody, ModalContent, ModalOverlay } from "@chakra-ui/react"
6+
7+
import { Button } from "./ui/buttons/Button"
8+
9+
import { useClipboard } from "@/hooks/useClipboard"
1110

1211
type CodeModalProps = {
1312
title: string
14-
children: ReactNode
13+
children?: ReactElement
1514
isOpen: boolean
1615
setIsOpen: (isOpen: boolean) => void
1716
}
1817

1918
const CodeModal = ({ children, isOpen, setIsOpen, title }: CodeModalProps) => {
20-
const bgColor = useColorModeValue("rgb(247, 247, 247)", "rgb(25, 25, 25)")
21-
const borderColor = useColorModeValue("rgb(51, 51, 51)", "rgb(242, 242, 242)")
19+
const { t } = useTranslation()
20+
const codeSnippet = (Children.toArray(children)[0] as ReactElement).props
21+
.children.props.children
22+
23+
const { onCopy, hasCopied } = useClipboard()
2224

2325
return (
2426
<Modal
2527
isOpen={isOpen}
2628
scrollBehavior="inside"
2729
onClose={() => setIsOpen(false)}
2830
>
29-
<ModalOverlay />
31+
<ModalOverlay hideBelow="md" />
3032
<ModalContent
33+
hideBelow="md"
3134
maxW="100vw"
3235
marginTop="auto"
3336
marginBottom="0"
@@ -36,35 +39,34 @@ const CodeModal = ({ children, isOpen, setIsOpen, title }: CodeModalProps) => {
3639
p={{ base: "0", md: "0" }}
3740
gap="0"
3841
>
39-
<ModalHeader
40-
bg={bgColor}
41-
borderColor={borderColor}
42-
borderTop="1px solid"
43-
borderBottom="1px solid"
44-
textTransform="uppercase"
45-
fontWeight="normal"
46-
fontSize="md"
47-
fontFamily="monospace"
48-
px="6"
49-
py="4"
50-
me="0"
51-
>
52-
{title}
53-
</ModalHeader>
54-
<ModalCloseButton
55-
position="absolute"
56-
padding="0"
57-
width="24px"
58-
height="24px"
59-
borderRadius="0"
60-
color="rgb(178, 178, 178)"
61-
fontSize="sm"
62-
margin="0"
63-
top="4"
64-
insetInlineEnd="4"
65-
bottom="4"
66-
/>
42+
<div className="flex items-center border-y bg-background px-6 py-3 font-monospace uppercase">
43+
<h2 className="text-md font-normal">{title}</h2>
44+
<Button
45+
variant="ghost"
46+
className="ms-auto text-sm"
47+
size="sm"
48+
isSecondary
49+
onClick={() => setIsOpen(false)}
50+
>
51+
{t("close")}
52+
</Button>
53+
</div>
6754
<ModalBody p="0">{children}</ModalBody>
55+
<Button
56+
variant="outline"
57+
onClick={() => onCopy(codeSnippet)}
58+
className="absolute end-4 top-20"
59+
>
60+
{hasCopied ? (
61+
<>
62+
<MdCheck /> {t("copied")}
63+
</>
64+
) : (
65+
<>
66+
<IoMdCopy /> {t("copy")}
67+
</>
68+
)}
69+
</Button>
6870
</ModalContent>
6971
</Modal>
7072
)

src/components/Codeblock.tsx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -202,18 +202,18 @@ const getValidChildrenForCodeblock = (child) => {
202202
}
203203
}
204204

205-
export type CodeblockProps = {
205+
export type CodeblockProps = React.HTMLAttributes<HTMLDivElement> & {
206206
allowCollapse?: boolean
207207
codeLanguage: string
208208
fromHomepage?: boolean
209-
children: React.ReactNode
210209
}
211210

212211
const Codeblock = ({
213212
children,
214213
allowCollapse = true,
215214
codeLanguage,
216215
fromHomepage = false,
216+
className,
217217
}: CodeblockProps) => {
218218
const { t } = useTranslation("common")
219219
const selectedTheme = useColorModeValue(codeTheme.light, codeTheme.dark)
@@ -227,14 +227,14 @@ const Codeblock = ({
227227

228228
const [isCollapsed, setIsCollapsed] = useState(allowCollapse)
229229

230-
let className: string
230+
let langClass: string
231231
if (React.isValidElement(children)) {
232-
className = children?.props?.className
232+
langClass = children?.props?.className
233233
} else {
234-
className = codeLanguage || ""
234+
langClass = codeLanguage || ""
235235
}
236236

237-
const matches = className?.match(/language-(.*)/)
237+
const matches = langClass?.match(/language-(.*)/)
238238
const language = matches?.[1] || ""
239239

240240
const shouldShowCopyWidget = ["js", "json", "python", "solidity"].includes(
@@ -249,12 +249,9 @@ const Codeblock = ({
249249
return (
250250
/* Overwrites codeblocks inheriting RTL styling in Right-To-Left script languages (e.g. Arabic) */
251251
/* Context: https://github.com/ethereum/ethereum-org-website/issues/6202 */
252-
<div className="relative" dir="ltr">
252+
<div className={cn("relative", className)} dir="ltr">
253253
<div
254-
className={cn(
255-
"mb-4 overflow-scroll rounded",
256-
fromHomepage && "mb-0 border"
257-
)}
254+
className="overflow-scroll rounded"
258255
style={{
259256
maxHeight: isCollapsed
260257
? `calc((1.2rem * ${LINES_BEFORE_COLLAPSABLE}) + 4.185rem)`

0 commit comments

Comments
 (0)