1
- import { pick } from "lodash"
2
- import {
3
- getMessages ,
4
- getTranslations ,
5
- setRequestLocale ,
6
- } from "next-intl/server"
1
+ import { getTranslations } from "next-intl/server"
7
2
import { FaGithub } from "react-icons/fa6"
8
3
9
4
import { Lang } from "@/lib/types"
10
5
11
6
import BannerNotification from "@/components/Banners/BannerNotification"
12
7
import { HubHero } from "@/components/Hero"
13
- import I18nProvider from "@/components/I18nProvider"
14
8
import StackIcon from "@/components/icons/stack.svg"
15
9
import MainArticle from "@/components/MainArticle"
16
10
import Translation from "@/components/Translation"
@@ -22,7 +16,6 @@ import { Section } from "@/components/ui/section"
22
16
import { cn } from "@/lib/utils/cn"
23
17
import { dataLoader } from "@/lib/utils/data/dataLoader"
24
18
import { getMetadata } from "@/lib/utils/metadata"
25
- import { getRequiredNamespacesForPage } from "@/lib/utils/translations"
26
19
27
20
import { GITHUB_REPO_URL } from "@/lib/constants"
28
21
import { BASE_TIME_UNIT } from "@/lib/constants"
@@ -48,171 +41,160 @@ const Page = async ({ params }: { params: Promise<{ locale: Lang }> }) => {
48
41
49
42
const t = await getTranslations ( { locale, namespace : "page-resources" } )
50
43
51
- setRequestLocale ( locale )
52
-
53
- // Get i18n messages
54
- const allMessages = await getMessages ( { locale } )
55
- const requiredNamespaces = getRequiredNamespacesForPage ( "/resources" )
56
- const messages = pick ( allMessages , requiredNamespaces )
57
-
58
44
// Load data
59
45
const [ growThePieData ] = await loadData ( )
60
46
const { txCostsMedianUsd } = growThePieData
61
47
62
48
const resourceSections = await getResources ( { txCostsMedianUsd } )
63
49
64
50
return (
65
- < I18nProvider locale = { locale } messages = { messages } >
66
- < MainArticle className = "relative flex flex-col" >
67
- < BannerNotification shouldShow className = "text-center max-md:flex-col" >
68
- { t ( "page-resources-banner-notification-message" ) } { " " }
69
- < Link
70
- href = { new URL (
71
- "issues/new?title=Resource%20dashboard%20feedback" ,
72
- GITHUB_REPO_URL
73
- ) . toString ( ) }
74
- className = "visited:text-white"
51
+ < MainArticle className = "relative flex flex-col" >
52
+ < BannerNotification shouldShow className = "text-center max-md:flex-col" >
53
+ { t ( "page-resources-banner-notification-message" ) } { " " }
54
+ < Link
55
+ href = { new URL (
56
+ "issues/new?title=Resource%20dashboard%20feedback" ,
57
+ GITHUB_REPO_URL
58
+ ) . toString ( ) }
59
+ className = "visited:text-white"
60
+ customEventOptions = { {
61
+ eventCategory : EVENT_CATEGORY ,
62
+ eventAction : "links" ,
63
+ eventName : "Ethereum.org Github Page Feedback" ,
64
+ } }
65
+ >
66
+ { t ( "page-resources-share-feedback" ) }
67
+ </ Link >
68
+ </ BannerNotification >
69
+
70
+ < HubHero
71
+ title = { t ( "page-resources-hero-title" ) }
72
+ header = { t ( "page-resources-hero-header" ) }
73
+ description = { t ( "page-resources-hero-description" ) }
74
+ heroImg = { heroImg }
75
+ />
76
+
77
+ < Stack className = "gap-4 px-2 py-6 md:gap-8 md:px-4 lg:px-8 xl:gap-11" >
78
+ < div className = "sticky top-5 flex flex-col items-center gap-3 text-center md:top-6 md:px-2" >
79
+ < div className = "my-2 text-body-medium" >
80
+ { t ( "page-resources-whats-on-this-page" ) }
81
+ </ div >
82
+ < ResourcesNav
83
+ resourceSections = { resourceSections }
84
+ eventCategory = { EVENT_CATEGORY }
85
+ />
86
+ </ div >
87
+ < Stack className = "gap-11 pt-12 md:gap-16 lg:gap-24" >
88
+ { resourceSections . map ( ( { key, icon, title : sectionTitle , boxes } ) => (
89
+ < Stack key = { key } asChild >
90
+ < section id = { key } className = "scroll-mt-40 gap-8 md:gap-6" >
91
+ < div className = "group flex w-full items-center gap-4 border-b bg-transparent px-2 py-4" >
92
+ < div className = "grid size-12 place-items-center rounded-lg border border-border-low-contrast text-2xl [&_svg]:shrink-0" >
93
+ { icon || < StackIcon /> }
94
+ </ div >
95
+ < h2 className = "flex-1 text-start font-black" >
96
+ { sectionTitle }
97
+ </ h2 >
98
+ </ div >
99
+ < div className = "grid grid-cols-1 gap-8 lg:grid-cols-2 lg:gap-y-6" >
100
+ { boxes . map ( ( { title, metric, items, className } ) => (
101
+ < div
102
+ className = { cn (
103
+ "overflow-hidden rounded-2xl border shadow-lg" ,
104
+ className
105
+ ) }
106
+ key = { title }
107
+ >
108
+ < div className = "border-b bg-[#ffffff] px-6 py-4 font-bold dark:bg-[#171717]" >
109
+ { title }
110
+ </ div >
111
+ < div className = "h-full bg-background bg-gradient-to-br from-white to-primary/10 px-2 py-6 dark:from-transparent dark:to-primary/10" >
112
+ { metric && metric }
113
+ < ResourcesContainer >
114
+ { items . map ( ( { className, ...item } ) => (
115
+ < ResourceItem
116
+ item = { item }
117
+ key = { item . title }
118
+ className = { className }
119
+ />
120
+ ) ) }
121
+ </ ResourcesContainer >
122
+ </ div >
123
+ </ div >
124
+ ) ) }
125
+ </ div >
126
+ </ section >
127
+ </ Stack >
128
+ ) ) }
129
+ </ Stack >
130
+
131
+ < VStack className = "gap-4 py-16" >
132
+ < div className = "text-center font-bold" >
133
+ < Translation id = "page-resources:page-resources-find-more" />
134
+ </ div >
135
+ < ButtonLink
136
+ href = "https://ethereumdashboards.com"
137
+ size = "lg"
75
138
customEventOptions = { {
76
139
eventCategory : EVENT_CATEGORY ,
77
140
eventAction : "links" ,
78
- eventName : "Ethereum.org Github Page Feedback " ,
141
+ eventName : "ethereumdashboards.com " ,
79
142
} }
80
143
>
81
- { t ( "page-resources-share-feedback" ) }
82
- </ Link >
83
- </ BannerNotification >
84
-
85
- < HubHero
86
- title = { t ( "page-resources-hero-title" ) }
87
- header = { t ( "page-resources-hero-header" ) }
88
- description = { t ( "page-resources-hero-description" ) }
89
- heroImg = { heroImg }
90
- />
91
-
92
- < Stack className = "gap-4 px-2 py-6 md:gap-8 md:px-4 lg:px-8 xl:gap-11" >
93
- < div className = "sticky top-5 flex flex-col items-center gap-3 text-center md:top-6 md:px-2" >
94
- < div className = "my-2 text-body-medium" >
95
- { t ( "page-resources-whats-on-this-page" ) }
96
- </ div >
97
- < ResourcesNav
98
- resourceSections = { resourceSections }
99
- eventCategory = { EVENT_CATEGORY }
100
- />
101
- </ div >
102
- < Stack className = "gap-11 pt-12 md:gap-16 lg:gap-24" >
103
- { resourceSections . map (
104
- ( { key, icon, title : sectionTitle , boxes } ) => (
105
- < Stack key = { key } asChild >
106
- < section id = { key } className = "scroll-mt-40 gap-8 md:gap-6" >
107
- < div className = "group flex w-full items-center gap-4 border-b bg-transparent px-2 py-4" >
108
- < div className = "grid size-12 place-items-center rounded-lg border border-border-low-contrast text-2xl [&_svg]:shrink-0" >
109
- { icon || < StackIcon /> }
110
- </ div >
111
- < h2 className = "flex-1 text-start font-black" >
112
- { sectionTitle }
113
- </ h2 >
114
- </ div >
115
- < div className = "grid grid-cols-1 gap-8 lg:grid-cols-2 lg:gap-y-6" >
116
- { boxes . map ( ( { title, metric, items, className } ) => (
117
- < div
118
- className = { cn (
119
- "overflow-hidden rounded-2xl border shadow-lg" ,
120
- className
121
- ) }
122
- key = { title }
123
- >
124
- < div className = "border-b bg-[#ffffff] px-6 py-4 font-bold dark:bg-[#171717]" >
125
- { title }
126
- </ div >
127
- < div className = "h-full bg-background bg-gradient-to-br from-white to-primary/10 px-2 py-6 dark:from-transparent dark:to-primary/10" >
128
- { metric && metric }
129
- < ResourcesContainer >
130
- { items . map ( ( { className, ...item } ) => (
131
- < ResourceItem
132
- item = { item }
133
- key = { item . title }
134
- className = { className }
135
- />
136
- ) ) }
137
- </ ResourcesContainer >
138
- </ div >
139
- </ div >
140
- ) ) }
141
- </ div >
142
- </ section >
143
- </ Stack >
144
- )
145
- ) }
146
- </ Stack >
147
-
148
- < VStack className = "gap-4 py-16" >
149
- < div className = "text-center font-bold" >
150
- < Translation id = "page-resources:page-resources-find-more" />
151
- </ div >
152
- < ButtonLink
153
- href = "https://ethereumdashboards.com"
154
- size = "lg"
155
- customEventOptions = { {
156
- eventCategory : EVENT_CATEGORY ,
157
- eventAction : "links" ,
158
- eventName : "ethereumdashboards.com" ,
159
- } }
160
- >
161
- ethereumdashboards.com
162
- </ ButtonLink >
144
+ ethereumdashboards.com
145
+ </ ButtonLink >
146
+ </ VStack >
147
+
148
+ < Section
149
+ id = "contribute"
150
+ className = "relative rounded-4xl border border-body/5 bg-background"
151
+ >
152
+ < VStack className = "rounded-4xl bg-radial-a px-4 py-6 md:py-12" >
153
+ < Stack className = "max-w-xl gap-y-10 py-6 lg:max-w-[700px]" >
154
+ < div className = "flex flex-col gap-y-4 text-center" >
155
+ < h2 > { t ( "page-resources-contribute-title" ) } </ h2 >
156
+ < p className = "text-lg" >
157
+ { t ( "page-resources-contribute-description" ) }
158
+ </ p >
159
+ </ div >
160
+ < div className = "mx-auto grid grid-cols-1 gap-x-3 gap-y-4 md:grid-cols-2" >
161
+ { /* TODO: Add issue template for resource listing and redirect to new template */ }
162
+ < ButtonLink
163
+ href = { new URL (
164
+ "issues/new?template=feature_request.yaml" ,
165
+ GITHUB_REPO_URL
166
+ ) . toString ( ) }
167
+ variant = "outline"
168
+ isSecondary
169
+ customEventOptions = { {
170
+ eventCategory : EVENT_CATEGORY ,
171
+ eventAction : "links" ,
172
+ eventName : "Ethereum.org Github Feature Request" ,
173
+ } }
174
+ >
175
+ { t ( "page-resources-suggest-resource" ) }
176
+ </ ButtonLink >
177
+ < ButtonLink
178
+ href = { new URL (
179
+ "issues/new?template=bug_report.yaml" ,
180
+ GITHUB_REPO_URL
181
+ ) . toString ( ) }
182
+ variant = "outline"
183
+ isSecondary
184
+ customEventOptions = { {
185
+ eventCategory : EVENT_CATEGORY ,
186
+ eventAction : "links" ,
187
+ eventName : "Ethereum.org Github Bug Report" ,
188
+ } }
189
+ >
190
+ < FaGithub /> { t ( "page-resources-found-bug" ) }
191
+ </ ButtonLink >
192
+ </ div >
193
+ </ Stack >
163
194
</ VStack >
164
-
165
- < Section
166
- id = "contribute"
167
- className = "relative rounded-4xl border border-body/5 bg-background"
168
- >
169
- < VStack className = "rounded-4xl bg-radial-a px-4 py-6 md:py-12" >
170
- < Stack className = "max-w-xl gap-y-10 py-6 lg:max-w-[700px]" >
171
- < div className = "flex flex-col gap-y-4 text-center" >
172
- < h2 > { t ( "page-resources-contribute-title" ) } </ h2 >
173
- < p className = "text-lg" >
174
- { t ( "page-resources-contribute-description" ) }
175
- </ p >
176
- </ div >
177
- < div className = "mx-auto grid grid-cols-1 gap-x-3 gap-y-4 md:grid-cols-2" >
178
- { /* TODO: Add issue template for resource listing and redirect to new template */ }
179
- < ButtonLink
180
- href = { new URL (
181
- "issues/new?template=feature_request.yaml" ,
182
- GITHUB_REPO_URL
183
- ) . toString ( ) }
184
- variant = "outline"
185
- isSecondary
186
- customEventOptions = { {
187
- eventCategory : EVENT_CATEGORY ,
188
- eventAction : "links" ,
189
- eventName : "Ethereum.org Github Feature Request" ,
190
- } }
191
- >
192
- { t ( "page-resources-suggest-resource" ) }
193
- </ ButtonLink >
194
- < ButtonLink
195
- href = { new URL (
196
- "issues/new?template=bug_report.yaml" ,
197
- GITHUB_REPO_URL
198
- ) . toString ( ) }
199
- variant = "outline"
200
- isSecondary
201
- customEventOptions = { {
202
- eventCategory : EVENT_CATEGORY ,
203
- eventAction : "links" ,
204
- eventName : "Ethereum.org Github Bug Report" ,
205
- } }
206
- >
207
- < FaGithub /> { t ( "page-resources-found-bug" ) }
208
- </ ButtonLink >
209
- </ div >
210
- </ Stack >
211
- </ VStack >
212
- </ Section >
213
- </ Stack >
214
- </ MainArticle >
215
- </ I18nProvider >
195
+ </ Section >
196
+ </ Stack >
197
+ </ MainArticle >
216
198
)
217
199
}
218
200
0 commit comments