diff --git a/apps/web/pages/403.tsx b/apps/web/app/403/page.tsx similarity index 62% rename from apps/web/pages/403.tsx rename to apps/web/app/403/page.tsx index 32e8ac8c6e2ebd..51f3b2c2818f61 100644 --- a/apps/web/pages/403.tsx +++ b/apps/web/app/403/page.tsx @@ -1,20 +1,20 @@ -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

{t("dont_have_access_this_page")}

@@ -27,4 +27,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 00000000000000..b99d30bd941c5d --- /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 00000000000000..867b60d51c41a8 --- /dev/null +++ b/apps/web/app/500/page.tsx @@ -0,0 +1,47 @@ +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/app/WithEmbedSSR.test.ts b/apps/web/app/WithEmbedSSR.test.ts index b760097fd325b9..975555d1bed78b 100644 --- a/apps/web/app/WithEmbedSSR.test.ts +++ b/apps/web/app/WithEmbedSSR.test.ts @@ -13,6 +13,9 @@ export function createMockNextJsRequest(...args: Parameters) return createMocks(...args); } +// eslint-disable-next-line @typescript-eslint/no-empty-function +const noop = () => {}; + vi.mock("next/navigation", () => ({ redirect: vi.fn(), notFound: vi.fn(), @@ -86,7 +89,7 @@ describe("withEmbedSsrAppDir", () => { embed: "namespace1", }, }) - ).catch(() => {}); + ).catch(noop); expect(redirect).toHaveBeenCalledWith("/reschedule/embed?layout=week_view&embed=namespace1"); }); @@ -105,7 +108,7 @@ describe("withEmbedSsrAppDir", () => { embed: "namespace1", }, }) - ).catch(() => {}); + ).catch(noop); expect(redirect).toHaveBeenCalledWith( "/reschedule/embed?redirectParam=1&layout=week_view&embed=namespace1" @@ -126,7 +129,7 @@ describe("withEmbedSsrAppDir", () => { embed: "", }, }) - ).catch(() => {}); + ).catch(noop); expect(redirect).toHaveBeenCalledWith("/reschedule/embed?redirectParam=1&layout=week_view&embed="); }); @@ -147,7 +150,7 @@ describe("withEmbedSsrAppDir", () => { embed: "namespace1", }, }) - ).catch(() => {}); + ).catch(noop); expect(redirect).toHaveBeenCalledWith( "https://calcom.cal.local/owner/embed?layout=week_view&embed=namespace1" @@ -168,7 +171,7 @@ describe("withEmbedSsrAppDir", () => { embed: "namespace1", }, }) - ).catch(() => {}); + ).catch(noop); expect(redirect).toHaveBeenCalledWith( "http://calcom.cal.local/owner/embed?layout=week_view&embed=namespace1" @@ -189,7 +192,7 @@ describe("withEmbedSsrAppDir", () => { embed: "namespace1", }, }) - ).catch(() => {}); + ).catch(noop); expect(redirect).toHaveBeenCalledWith( "/calcom.cal.local/owner/embed?layout=week_view&embed=namespace1" @@ -239,7 +242,7 @@ describe("withEmbedSsrAppDir", () => { embed: "", }, }) - ).catch(() => {}); + ).catch(noop); expect(notFound).toHaveBeenCalled(); }); diff --git a/apps/web/app/_utils.tsx b/apps/web/app/_utils.tsx index 015e1c1e6a174a..a487888800f42c 100644 --- a/apps/web/app/_utils.tsx +++ b/apps/web/app/_utils.tsx @@ -33,7 +33,7 @@ const createI18nInstance = async (locale: string, ns: string) => { return _i18n; }; -const getTranslationWithCache = async (locale: string, ns: string = "common") => { +const getTranslationWithCache = async (locale: string, ns = "common") => { const localeWithFallback = locale ?? "en"; const i18n = await createI18nInstance(localeWithFallback, ns); return i18n.getFixedT(localeWithFallback, ns); diff --git a/apps/web/app/api/customer-card/route.ts b/apps/web/app/api/customer-card/route.ts index 1ddce87154da9d..0d89278cea6aca 100644 --- a/apps/web/app/api/customer-card/route.ts +++ b/apps/web/app/api/customer-card/route.ts @@ -20,7 +20,7 @@ const inputSchema = z.object({ cardKeys: z.array(z.string()), }); -export async function handler(request: Request) { +async function handler(request: Request) { const headersList = headers(); const requestBody = await request.json(); diff --git a/apps/web/app/bookings/[status]/page.tsx b/apps/web/app/bookings/[status]/page.tsx index b8a21f79bf58d1..6e859d38ca3431 100644 --- a/apps/web/app/bookings/[status]/page.tsx +++ b/apps/web/app/bookings/[status]/page.tsx @@ -1,4 +1,4 @@ -import { PageProps } from "app/_types"; +import type { PageProps } from "app/_types"; import { _generateMetadata } from "app/_utils"; import { WithLayout } from "app/layoutHOC"; import { redirect } from "next/navigation"; diff --git a/apps/web/app/future/org/[orgSlug]/embed/page.tsx b/apps/web/app/future/org/[orgSlug]/embed/page.tsx index 0f378c48cb0003..3a592b9af762f3 100644 --- a/apps/web/app/future/org/[orgSlug]/embed/page.tsx +++ b/apps/web/app/future/org/[orgSlug]/embed/page.tsx @@ -1,6 +1,4 @@ import withEmbedSsrAppDir from "app/WithEmbedSSR"; -import type { PageProps as _PageProps } from "app/_types"; -import { _generateMetadata } from "app/_utils"; import { WithLayout } from "app/layoutHOC"; import { getServerSideProps } from "@lib/team/[slug]/getServerSideProps"; diff --git a/apps/web/app/future/team/[slug]/[type]/embed/page.tsx b/apps/web/app/future/team/[slug]/[type]/embed/page.tsx index 4c15acd8776f72..3430e611a7c0f9 100644 --- a/apps/web/app/future/team/[slug]/[type]/embed/page.tsx +++ b/apps/web/app/future/team/[slug]/[type]/embed/page.tsx @@ -1,6 +1,4 @@ import withEmbedSsrAppDir from "app/WithEmbedSSR"; -import type { PageProps as _PageProps } from "app/_types"; -import { _generateMetadata } from "app/_utils"; import { WithLayout } from "app/layoutHOC"; import { getServerSideProps } from "@lib/team/[slug]/[type]/getServerSideProps"; diff --git a/apps/web/app/future/team/[slug]/embed/page.tsx b/apps/web/app/future/team/[slug]/embed/page.tsx index 9978957cb9a677..5145f0ed0f4de8 100644 --- a/apps/web/app/future/team/[slug]/embed/page.tsx +++ b/apps/web/app/future/team/[slug]/embed/page.tsx @@ -1,7 +1,4 @@ -import { withAppDirSsr } from "app/WithAppDirSsr"; import withEmbedSsrAppDir from "app/WithEmbedSSR"; -import type { PageProps as _PageProps } from "app/_types"; -import { _generateMetadata } from "app/_utils"; import { WithLayout } from "app/layoutHOC"; import { getServerSideProps } from "@lib/team/[slug]/getServerSideProps"; diff --git a/apps/web/app/icons/IconGrid.tsx b/apps/web/app/icons/IconGrid.tsx new file mode 100644 index 00000000000000..da6ea588058f6e --- /dev/null +++ b/apps/web/app/icons/IconGrid.tsx @@ -0,0 +1,25 @@ +"use client"; + +import { Icon } from "@calcom/ui"; +import type { IconName } from "@calcom/ui"; + +export const IconGrid = (props: { + title: string; + icons: IconName[]; + rootClassName?: string; + iconClassName?: string; +}) => ( +
+

{props.title}

+
+ {props.icons.map((icon) => { + return ( +
+ +
{icon}
+
+ ); + })} +
+
+); diff --git a/apps/web/app/icons/page.tsx b/apps/web/app/icons/page.tsx new file mode 100644 index 00000000000000..a2ebf86a70478a --- /dev/null +++ b/apps/web/app/icons/page.tsx @@ -0,0 +1,46 @@ +import { _generateMetadata, getTranslate } from "app/_utils"; +import { Inter } from "next/font/google"; +import localFont from "next/font/local"; + +import { type IconName, IconSprites } from "@calcom/ui"; + +import { lucideIconList } from "../../../../packages/ui/components/icon/icon-list.mjs"; +import { IconGrid } from "./IconGrid"; + +const interFont = Inter({ subsets: ["latin"], variable: "--font-inter", preload: true, display: "swap" }); +const calFont = localFont({ + src: "../../fonts/CalSans-SemiBold.woff2", + variable: "--font-cal", + preload: true, + display: "swap", + weight: "600", +}); +export const generateMetadata = async () => { + return await _generateMetadata( + (t) => t("icon_showcase"), + () => "" + ); +}; +export default async function IconsPage() { + const icons = Array.from(lucideIconList).sort() as IconName[]; + const t = await getTranslate(); + + return ( +
+
+ +
+

{t("icons_showcase")}

+ + +
+
+
+ ); +} +export const dynamic = "force-static"; diff --git a/apps/web/app/layout.tsx b/apps/web/app/layout.tsx index ab000ce5d06f52..68b3325222792e 100644 --- a/apps/web/app/layout.tsx +++ b/apps/web/app/layout.tsx @@ -76,6 +76,7 @@ export default async function RootLayout({ children }: { children: React.ReactNo