Skip to content

Commit 8e4bdf1

Browse files
authored
Merge pull request #141 from ethereum/page-404
Not found page
2 parents d4b7071 + 6b13545 commit 8e4bdf1

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

src/pages/404.tsx

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import React from "react"
2+
import type { GetStaticProps, NextPage } from "next"
3+
import type { SSRConfig } from "next-i18next"
4+
import { serverSideTranslations } from "next-i18next/serverSideTranslations"
5+
import { Box, Flex, Heading, Text } from "@chakra-ui/react"
6+
7+
import { getRequiredNamespacesForPath } from "@/lib/utils/translations"
8+
import { getLastDeployDate } from "@/lib/utils/getLastDeployDate"
9+
10+
import InlineLink from "../components/Link"
11+
import Translation from "../components/Translation"
12+
13+
type Props = SSRConfig
14+
15+
export const getStaticProps = (async (context) => {
16+
const { locale } = context
17+
18+
// load i18n required namespaces for the given page
19+
const requiredNamespaces = getRequiredNamespacesForPath("/")
20+
const lastDeployDate = getLastDeployDate()
21+
22+
return {
23+
props: {
24+
...(await serverSideTranslations(locale!, requiredNamespaces)),
25+
lastDeployDate,
26+
},
27+
}
28+
}) satisfies GetStaticProps<Props>
29+
30+
const NotFoundPage = () => (
31+
<Flex flexDir="column" align="center" w="full" mt={16} mb={0} mx="auto">
32+
<Box py={4} px={8} w="full">
33+
<Heading as="h1" size="2xl" my={8}>
34+
<Translation id="we-couldnt-find-that-page" />
35+
</Heading>
36+
<Text mb={8}>
37+
<Translation id="try-using-search" />{" "}
38+
<InlineLink href="/">
39+
<Translation id="return-home" />
40+
</InlineLink>
41+
.
42+
</Text>
43+
</Box>
44+
</Flex>
45+
)
46+
47+
export default NotFoundPage

0 commit comments

Comments
 (0)