diff --git a/apps/web/pages/403.tsx b/apps/web/app/403/page.tsx similarity index 55% rename from apps/web/pages/403.tsx rename to apps/web/app/403/page.tsx index 32e8ac8c6e..3547f67c38 100644 --- a/apps/web/pages/403.tsx +++ b/apps/web/app/403/page.tsx @@ -1,22 +1,24 @@ -import Head from "next/head"; +import { _generateMetadata, getTranslate } from "app/_utils"; +import { WithLayout } from "app/layoutHOC"; import { APP_NAME, WEBAPP_URL } from "@calcom/lib/constants"; -import { useLocale } from "@calcom/lib/hooks/useLocale"; import { Button } from "@calcom/ui"; -import PageWrapper from "@components/PageWrapper"; +export const generateMetadata = () => + _generateMetadata( + (t) => `${t("access_denied")} | ${APP_NAME}`, + () => "" + ); -export default function AccessDenied() { - const { t } = useLocale(); +async function Error403() { + const t = await getTranslate(); return (
- - {`${t("access_denied")} | ${APP_NAME}`} - -
-

403

+

+ 403 +

{t("dont_have_access_this_page")}

{t("you_need_admin_or_owner_privileges_to_access")} @@ -27,4 +29,4 @@ export default function AccessDenied() { ); } -AccessDenied.PageWrapper = PageWrapper; +export default WithLayout({ ServerPage: Error403 }); diff --git a/apps/web/app/500/copy-button.tsx b/apps/web/app/500/copy-button.tsx new file mode 100644 index 0000000000..b99d30bd94 --- /dev/null +++ b/apps/web/app/500/copy-button.tsx @@ -0,0 +1,21 @@ +"use client"; + +import { useLocale } from "@calcom/lib/hooks/useLocale"; +import { Button, showToast } from "@calcom/ui"; + +export default function CopyButton({ error }: { error: string }) { + const { t } = useLocale(); + + return ( + + ); +} diff --git a/apps/web/app/500/page.tsx b/apps/web/app/500/page.tsx new file mode 100644 index 0000000000..3decc4a818 --- /dev/null +++ b/apps/web/app/500/page.tsx @@ -0,0 +1,49 @@ +import { _generateMetadata, getTranslate } from "app/_utils"; +import { WithLayout } from "app/layoutHOC"; + +import { APP_NAME } from "@calcom/lib/constants"; +import { Button } from "@calcom/ui"; + +import CopyButton from "./copy-button"; + +export const generateMetadata = () => + _generateMetadata( + (t) => `${t("something_unexpected_occurred")} | ${APP_NAME}`, + () => "" + ); + +async function Error500({ searchParams }: { searchParams: { error?: string } }) { + const t = await getTranslate(); + + return ( +

+
+

+ 500 +

+

{t("500_error_message")}

+

{t("something_went_wrong_on_our_end")}

+ {searchParams?.error && ( +
+

+ {t("please_provide_following_text_to_suppport")}: +

+
+              {searchParams.error}
+              
+ +
+
+ )} + + +
+
+ ); +} + +export default WithLayout({ + ServerPage: Error500, +}); diff --git a/apps/web/middleware.ts b/apps/web/middleware.ts index 8d847abca6..65886551ca 100644 --- a/apps/web/middleware.ts +++ b/apps/web/middleware.ts @@ -153,6 +153,8 @@ export const config = { // Next.js Doesn't support spread operator in config matcher, so, we must list all paths explicitly here. // https://github.com/vercel/next.js/discussions/42458 matcher: [ + "/403", + "/500", "/d/:path*", "/more/:path*", "/maintenance/:path*", diff --git a/apps/web/pages/500.tsx b/apps/web/pages/500.tsx deleted file mode 100644 index 2bb6a20609..0000000000 --- a/apps/web/pages/500.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import Head from "next/head"; - -import { APP_NAME } from "@calcom/lib/constants"; -import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams"; -import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { Button, showToast } from "@calcom/ui"; - -import PageWrapper from "@components/PageWrapper"; - -export default function Error500() { - const searchParams = useCompatSearchParams(); - const { t } = useLocale(); - - return ( -
- - Something unexpected occurred | {APP_NAME} - - -
-

500

-

It's not you, it's us.

-

{t("something_went_wrong_on_our_end")}

- {searchParams?.get("error") && ( -
-

- {t("please_provide_following_text_to_suppport")}: -

-
-              {searchParams?.get("error")}
-              
- -
-
- )} - - -
-
- ); -} - -Error500.PageWrapper = PageWrapper; diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.json index 482b6153da..328e6b18a3 100644 --- a/apps/web/public/static/locales/en/common.json +++ b/apps/web/public/static/locales/en/common.json @@ -2903,5 +2903,7 @@ "calibration": "Calibration", "shortfall": "Shortfall", "routing_form": "Routing Form", + "something_unexpected_occurred": "Something unexpected occurred", + "500_error_message": "It's not you, it's us.", "ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Add your new strings above here ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑" }