-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathindex.tsx
284 lines (269 loc) · 9.34 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
import fs from 'fs'
import { Box, Code, Flex, Text, useBreakpointValue } from '@chakra-ui/react'
import type { GetStaticProps } from 'next'
import {
BlogSectionPreview,
ButtonLink,
CompilerPlayground,
ContributingCards,
EventCard,
EventPreview,
Hero,
Link,
PageMetadata,
PragmaWatermark,
Section,
ShowcaseContent,
ShowcaseSection,
ShowcaseVisual,
Triangles,
} from '@/components'
import {
BLOG_PATH,
BLOG_POSTS_DIR,
CONTRIBUTE_PATH,
DOCS_URL,
MAIN_CONTENT_ID,
MAX_POSTS_TO_PREVIEW,
} from '@/constants'
import {
fetchLatestVersion,
fetchStargazersCount,
getAllEvents,
getPostsDataForRange,
} from '@/utils'
import type { BlogPostProps, EventPost } from '@/interfaces'
export const getStaticProps: GetStaticProps = async () => {
// get list of all files from our posts directory
const postFiles = fs.readdirSync(BLOG_POSTS_DIR)
const sortedPostFiles = postFiles.sort().reverse()
const previewBlogPosts = getPostsDataForRange(
sortedPostFiles,
{ from: 0, to: MAX_POSTS_TO_PREVIEW },
fs
)
const allEvents = getAllEvents(fs)
const { versionNumber } = await fetchLatestVersion()
const { stargazersCount } = await fetchStargazersCount()
return {
props: { previewBlogPosts, allEvents, versionNumber, stargazersCount },
}
}
interface HomeProps {
previewBlogPosts: BlogPostProps[]
allEvents: EventPost[]
versionNumber: string
stargazersCount: number
}
export default function Home({
previewBlogPosts,
allEvents,
versionNumber,
stargazersCount,
}: HomeProps) {
const futureEvents = allEvents.filter(
({ frontmatter: { endDate } }) => new Date(endDate) >= new Date()
)
const nextEvent = futureEvents.length ? futureEvents[0] : null
const sectionPaddingY = useBreakpointValue({ base: 12, md: 24 })
return (
<>
<PageMetadata
title="Home"
description="Solidity is a statically-typed curly-braces programming language designed for developing smart contracts that run on Ethereum."
/>
<Box as="main" id={MAIN_CONTENT_ID}>
{/* HERO */}
<Hero
header="Solidity"
cta={[{ name: 'Read the docs', href: DOCS_URL }]}
stargazersCount={stargazersCount}
>
A statically-typed curly-braces programming language designed for
developing smart contracts that run on{' '}
<Link href="https://ethereum.org">Ethereum</Link>.
<PragmaWatermark />
</Hero>
{/* SOLIDITY VERSION */}
<Section pt={16} pb={24} alignItems="center">
<Flex
as="aside"
direction={['column', null, 'row']}
gap={8}
p={8}
border="1px"
borderColor="border"
alignItems="start"
maxW="container.lg"
>
<Box fontSize="2xl">
<Text
fontFamily="mono"
color="primary"
lineHeight="130%"
fontSize="inherit"
maxW="8ch"
>
Solidity {versionNumber}
</Text>
</Box>
<Flex direction="column" justify="space-between" gap={6}>
<Box>
<Text lineHeight="180%" fontSize="md" mb={4}>
<Link
href="/blog/2024/12/27/solidity-developer-survey-2024-announcement/"
fontWeight="bold"
>
Solidity Developer Survey 2024
</Link>{' '}
The annual Solidity Developer Survey for the year 2024 is live! Take the survey to give us insights and feedback to help us design the Solidity compiler better.
</Text>
</Box>
</Flex>
</Flex>
</Section>
{/* Solidity is evolving rapidly > Get started */}
<ShowcaseSection py={sectionPaddingY}>
<ShowcaseContent
title="Solidity is evolving rapidly"
px={{ base: 4, md: 0 }}
>
<Text>
We aim for a regular (non-breaking) release every month, with
approximately one breaking release per year. You can follow the
implementation status of new features in the{' '}
<Link
href="https://github.com/orgs/ethereum/projects/26"
fontWeight="bold"
>
Solidity GitHub project
</Link>
.
</Text>
<ButtonLink href="https://docs.soliditylang.org/en/latest/installing-solidity.html" variant="solid" mt={8}>
Get started
</ButtonLink>
</ShowcaseContent>
<ShowcaseVisual>
<Triangles variant="evolving" />
</ShowcaseVisual>
</ShowcaseSection>
{/* Contribute to Solidity */}
<Section py={sectionPaddingY} gap={12}>
<ShowcaseSection startWithVisual px={0}>
<ShowcaseContent title="Contribute to Solidity">
<Text>
Solidity continues to improve with help from our global community.
Check out these ways to get involved and contribute to the
Solidity project.
</Text>
</ShowcaseContent>
<ShowcaseVisual>
<Triangles variant="triforce" />
</ShowcaseVisual>
</ShowcaseSection>
<ContributingCards />
<Flex justify="center">
<ButtonLink href={CONTRIBUTE_PATH} variant="solid">
Start contributing
</ButtonLink>
</Flex>
</Section>
{/* Stay updated */}
<Section py={sectionPaddingY} gap={12}>
<ShowcaseSection px={0}>
<ShowcaseContent title="Stay Updated">
<Text>
Stay always up-to-date by following the {' '}
<Link
href="https://soliditylang.org/blog/"
fontWeight="bold"
>
Solidity blog
</Link>.
</Text>
<Text>
You can see the upcoming changes for the next breaking release
by switching from the default branch (<Code>develop</Code>) to
the <Code>breaking branch</Code>. You can actively shape
Solidity by providing your input and participating in the
language design in the {' '}
<Link
href="https://forum.soliditylang.org/"
fontWeight="bold"
>
Solidity forum
</Link>
and participating in the yearly Solidity developer surveys.
</Text>
</ShowcaseContent>
<ShowcaseVisual>
<Triangles variant="slash" />
</ShowcaseVisual>
</ShowcaseSection>
{/* Latest from the blog */}
<Section px={0}>
<Text textStyle="h3" fontSize="xl">
Latest from the blog
</Text>
<BlogSectionPreview postsData={previewBlogPosts} />
</Section>
<Flex justify="center">
<ButtonLink href={BLOG_PATH} variant="solid">
All blog updates
</ButtonLink>
</Flex>
</Section>
{/* Playground section */}
<Section py={sectionPaddingY} gap={12}>
<ShowcaseSection startWithVisual>
<ShowcaseContent title="Playground">
<Text>
Try Solidity for yourself in this simple compiler. For a more fully
featured browser-based IDE, try using{' '}
<Link href="https://remix.ethereum.org">Remix</Link>.
</Text>
</ShowcaseContent>
<ShowcaseVisual>
<Triangles variant="double" />
</ShowcaseVisual>
</ShowcaseSection>
{/* Interactive Solidity code editor and compiler */}
<CompilerPlayground />
</Section>
{/* Upcoming solidity events */}
<Section py={sectionPaddingY} gap={12}>
<ShowcaseSection px={0} reverseMobile alignItems="start">
<ShowcaseContent title="Solidity Events" flex={4}>
{/* <Text>
The Solidity Summit is a free interactive forum for people
involved and interested in the Solidity language and the
ecosystem around it.
</Text>
<Text>
Its goal is to enable useful (language-design related) discussions which result
in improvement proposals and actual implementations, foster
communication between teams working on similar topics and
to identify needs for the smart contract ecosystem for Ethereum.
</Text> */}
</ShowcaseContent>
{/* <ShowcaseVisual direction="column" flex={5} w="full">
{nextEvent ? (
<EventCard frontmatter={nextEvent.frontmatter} />
) : (
<Text>No upcoming events</Text>
)}
</ShowcaseVisual> */}
</ShowcaseSection>
{/* Past events */}
<Section gap={6} px={0}>
<Text as="h3" fontSize="xl" color="primary" fontWeight="bold">
Past events
</Text>
<EventPreview events={allEvents} />
</Section>
</Section>
</Box>
</>
)
}