forked from ethereum/ethereum-org-website
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ethereum#141 from ethereum/page-404
Not found page
- Loading branch information
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |