From 27a13ae62926f50571644b2c409169aab778fff3 Mon Sep 17 00:00:00 2001 From: Pablo Pettinari Date: Fri, 24 Nov 2023 14:59:52 +0100 Subject: [PATCH 1/2] migrate 404 page --- src/pages/404.tsx | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/pages/404.tsx diff --git a/src/pages/404.tsx b/src/pages/404.tsx new file mode 100644 index 00000000000..e172d61f6ea --- /dev/null +++ b/src/pages/404.tsx @@ -0,0 +1,42 @@ +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 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("/") + + return { + props: await serverSideTranslations(locale!, requiredNamespaces), + } +}) satisfies GetStaticProps + +const NotFoundPage: NextPage = () => ( + + + + + + + {" "} + + + + . + + + +) + +export default NotFoundPage From 6b135455b36a12e2a8953fe22c127b2b000c520c Mon Sep 17 00:00:00 2001 From: Pablo Pettinari Date: Tue, 28 Nov 2023 11:02:38 +0100 Subject: [PATCH 2/2] add lastDeployDate to page props --- src/pages/404.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/pages/404.tsx b/src/pages/404.tsx index e172d61f6ea..21c85c96f4c 100644 --- a/src/pages/404.tsx +++ b/src/pages/404.tsx @@ -5,6 +5,7 @@ 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" @@ -16,13 +17,17 @@ export const getStaticProps = (async (context) => { // load i18n required namespaces for the given page const requiredNamespaces = getRequiredNamespacesForPath("/") + const lastDeployDate = getLastDeployDate() return { - props: await serverSideTranslations(locale!, requiredNamespaces), + props: { + ...(await serverSideTranslations(locale!, requiredNamespaces)), + lastDeployDate, + }, } }) satisfies GetStaticProps -const NotFoundPage: NextPage = () => ( +const NotFoundPage = () => (