🐛 Link to support page on 404

This commit is contained in:
Luke Vella 2023-03-23 12:56:36 +00:00
parent afdbd1f3a1
commit 149e5bbe5e
2 changed files with 17 additions and 13 deletions

View file

@ -3,12 +3,8 @@ import Link from "next/link";
import { useTranslation } from "next-i18next";
import * as React from "react";
import { Button } from "@/components/button";
import Chat from "@/components/icons/chat.svg";
import EmojiSad from "@/components/icons/emoji-sad.svg";
import { showCrispChat } from "./crisp-chat";
export interface ComponentProps {
icon?: React.ComponentType<{ className?: string }>;
title: string;
@ -20,7 +16,7 @@ const ErrorPage: React.FunctionComponent<ComponentProps> = ({
title,
description,
}) => {
const { t } = useTranslation("errors");
const { t } = useTranslation(["common", "errors"]);
return (
<div className="flex h-[calc(100vh-100px)] w-full items-center justify-center">
<Head>
@ -35,12 +31,16 @@ const ErrorPage: React.FunctionComponent<ComponentProps> = ({
</div>
<p>{description}</p>
<div className="flex justify-center space-x-3">
<Link href="/" passHref={true} className="btn-default">
{t("goToHome")}
<Link href="/" className="btn-primary">
{t("errors:goToHome")}
</Link>
<Link
href="https://support.rallly.co"
passHref={true}
className="btn-default"
>
{t("support")}
</Link>
<Button icon={<Chat />} onClick={showCrispChat}>
{t("startChat")}
</Button>
</div>
</div>
</div>

View file

@ -1,12 +1,14 @@
import { GetStaticProps, NextPage } from "next";
import { GetStaticProps } from "next";
import { useTranslation } from "next-i18next";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import React from "react";
import ErrorPage from "@/components/error-page";
import DocumentSearch from "@/components/icons/document-search.svg";
import { getStandardLayout } from "@/components/layouts/standard-layout";
import { NextPageWithLayout } from "@/types";
const Custom404: NextPage = () => {
const Custom404: NextPageWithLayout = () => {
const { t } = useTranslation("errors");
return (
<ErrorPage
@ -17,10 +19,12 @@ const Custom404: NextPage = () => {
);
};
Custom404.getLayout = getStandardLayout;
export const getStaticProps: GetStaticProps = async ({ locale = "en" }) => {
return {
props: {
...(await serverSideTranslations(locale, ["errors"])),
...(await serverSideTranslations(locale, ["common", "errors"])),
},
};
};