"use client"; import { DOCS_URL, IS_CALCOM, WEBSITE_URL } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { Icon } from "@calcom/ui/components/icon"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { useLayoutEffect } from "react"; enum PageType { USER = "USER", OTHER = "OTHER", } function getPageInfo(pathname: string) { const [routerUsername] = pathname?.replace("%20", "-").split(/[?#]/) ?? []; return { username: routerUsername ?? "", pageType: PageType.USER, url: `${WEBSITE_URL}/signup?username=${(routerUsername ?? "").replace("/", "")}`, }; } export function NotFound({ host }: { host: string }) { const { t } = useLocale(); const pathname = usePathname() ?? ""; const { username, pageType, url } = getPageInfo(pathname); const isBookingSuccessPage = pathname?.startsWith("/booking"); const isSubpage = pathname?.includes("/", 2) || isBookingSuccessPage; useLayoutEffect(() => { if (typeof window !== "undefined") { window.CalComPageStatus = "404"; } }, []); const links = [ { title: t("documentation"), description: t("documentation_description"), icon: "file-text" as const, href: DOCS_URL, }, { title: t("blog"), description: t("blog_description"), icon: "book-open" as const, href: `${WEBSITE_URL}/blog`, }, ]; return (

{t("error_404")}

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

{isSubpage ? ( {t("check_spelling_mistakes_or_go_back")} ) : IS_CALCOM ? ( {t(`404_the_${pageType.toLowerCase()}`)}{" "} {username ? ( <> {username} {` ${t("is_still_available")} `} {t("register_now")}. ) : null} ) : ( {t(`404_the_${pageType.toLowerCase()}`)}{" "} {username ? ( <> {username}{" "} {t("is_still_available")} ) : null} )}
{!isSubpage && IS_CALCOM && ( )}

{t("popular_pages")}

{t("or_go_back_home")}
); }