chore: migrate the event-types page to the app directory (#12390)

Co-authored-by: Omar López <[email protected]>
This commit is contained in:
Greg PabianandOmar López authored and GitHub committed 2023-11-22 19:17:33 +00:00
1 parent 53d7e2ec3f
commit 1de05ebf3d
24 files changed
+640 -99

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
"use client";
import type { ComponentProps } from "react";
import React from "react";
import Shell from "@calcom/features/shell/Shell";
export default function MainLayout({
children,
...rest
}: { children: React.ReactNode } & ComponentProps<typeof Shell>) {
return (
<Shell withoutMain={true} {...rest}>
{children}
</Shell>
);
}
export const getLayout = (page: React.ReactElement) => <MainLayout>{page}</MainLayout>;
+12 -3
View File
@@ -2,9 +2,11 @@ import { parse } from "accept-language-parser";
import { lookup } from "bcp-47-match";
import type { GetTokenParams } from "next-auth/jwt";
import { getToken } from "next-auth/jwt";
import { type ReadonlyHeaders } from "next/dist/server/web/spec-extension/adapters/headers";
import { type ReadonlyRequestCookies } from "next/dist/server/web/spec-extension/adapters/request-cookies";
//@ts-expect-error no type definitions
import { i18n } from "@calcom/web/next-i18next.config";
import { i18n } from "@calcom/config/next-i18next.config";
/**
* This is a slimmed down version of the `getServerSession` function from
@@ -17,9 +19,16 @@ import { i18n } from "@calcom/web/next-i18next.config";
* token has expired (30 days). This should be fine as we call `/auth/session`
* frequently enough on the client-side to keep the session alive.
*/
export const getLocale = async (req: GetTokenParams["req"]): Promise<string> => {
export const getLocale = async (
req:
| GetTokenParams["req"]
| {
cookies: ReadonlyRequestCookies;
headers: ReadonlyHeaders;
}
): Promise<string> => {
const token = await getToken({
req,
req: req as GetTokenParams["req"],
});
const tokenLocale = token?.["locale"];