Skip to content

Commit

Permalink
Merge pull request ethereum#141 from ethereum/page-404
Browse files Browse the repository at this point in the history
Not found page
  • Loading branch information
pettinarip authored Nov 29, 2023
2 parents d4b7071 + 6b13545 commit 8e4bdf1
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions src/pages/404.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import React from "react"
import type { GetStaticProps, NextPage } from "next"
import type { SSRConfig } from "next-i18next"
import { serverSideTranslations } from "next-i18next/serverSideTranslations"
import { Box, Flex, Heading, Text } from "@chakra-ui/react"

import { getRequiredNamespacesForPath } from "@/lib/utils/translations"
import { getLastDeployDate } from "@/lib/utils/getLastDeployDate"

import InlineLink from "../components/Link"
import Translation from "../components/Translation"

type Props = SSRConfig

export const getStaticProps = (async (context) => {
const { locale } = context

// load i18n required namespaces for the given page
const requiredNamespaces = getRequiredNamespacesForPath("/")
const lastDeployDate = getLastDeployDate()

return {
props: {
...(await serverSideTranslations(locale!, requiredNamespaces)),
lastDeployDate,
},
}
}) satisfies GetStaticProps<Props>

const NotFoundPage = () => (
<Flex flexDir="column" align="center" w="full" mt={16} mb={0} mx="auto">
<Box py={4} px={8} w="full">
<Heading as="h1" size="2xl" my={8}>
<Translation id="we-couldnt-find-that-page" />
</Heading>
<Text mb={8}>
<Translation id="try-using-search" />{" "}
<InlineLink href="/">
<Translation id="return-home" />
</InlineLink>
.
</Text>
</Box>
</Flex>
)

export default NotFoundPage

0 comments on commit 8e4bdf1

Please sign in to comment.