import { BookOpenIcon, CheckIcon, DocumentTextIcon } from "@heroicons/react/outline"; import { ChevronRightIcon } from "@heroicons/react/solid"; import { GetStaticPropsContext } from "next"; import Link from "next/link"; import { useRouter } from "next/router"; import React, { useEffect, useState } from "react"; import { useLocale } from "@lib/hooks/useLocale"; import { HeadSeo } from "@components/seo/head-seo"; import { ssgInit } from "@server/lib/ssg"; export default function Custom404() { const { t } = useLocale(); const router = useRouter(); const [username] = router.asPath.replace("%20", "-").split(/[?#]/); const links = [ { title: t("documentation"), description: t("documentation_description"), icon: DocumentTextIcon, href: "https://docs.cal.com", }, { title: t("blog"), description: t("blog_description"), icon: BookOpenIcon, href: "https://cal.com/blog", }, ]; const [url, setUrl] = useState("https://cal.com/signup?username="); useEffect(() => { setUrl(`https://cal.com/signup?username=${username.replace("/", "")}`); }, [username]); const isSuccessPage = router.asPath.startsWith("/success"); const isSubpage = router.asPath.includes("/", 2) || isSuccessPage; const isSignup = router.asPath.startsWith("/signup"); const isCalcom = process.env.NEXT_PUBLIC_WEBAPP_URL === "https://app.cal.com"; return ( <>
{isSignup && process.env.NEXT_PUBLIC_WEBAPP_URL !== "https://app.cal.com" ? (

{t("missing_license")}

{t("signup_requires")}

{t("signup_requires_description")}

{t("next_steps")}

) : ( <>

{t("error_404")}

{isSuccessPage ? "Booking not found" : t("page_doesnt_exist")}

{isSubpage ? ( {t("check_spelling_mistakes_or_go_back")} ) : isCalcom ? ( {t("the_username")} cal.com{username}{" "} {t("is_still_available")} {t("register_now")}. ) : ( {t("the_username")}{" "} {username}{" "} {t("is_still_available")} )}

{t("popular_pages")}

{!isSubpage && isCalcom && ( )}
{t("or_go_back_home")}
)}
); } export const getStaticProps = async (context: GetStaticPropsContext) => { const ssr = await ssgInit(context); return { props: { trpcState: ssr.dehydrate(), }, }; };