chore: App router migration - /attributes, /privacy, /dsync, /license-key under /settings route group (#16406)

* migrate license-key/new

* migrate settings/org/dsync

* migrate settings/org/privacy

* migrate org attributes

* remove res in getServerSideProps

* Fix SettingsLayoutAppDir

* fix attributes pages

* fix

* fix
This commit is contained in:
Benny Joo authored and GitHub committed 2024-09-09 17:19:12 -07:00
1 parent 706d7dff42
commit 5dff1c6df0
21 files changed
+225 -65

No files matched your search

@@ -0,0 +1,11 @@
import { _generateMetadata } from "app/_utils";
import Page from "@calcom/ee/organizations/pages/settings/attributes/attributes-edit-view";
export const generateMetadata = async () =>
await _generateMetadata(
() => "Attribute",
(t) => t("edit_attribute_description")
);
export default Page;
@@ -0,0 +1,11 @@
import { _generateMetadata } from "app/_utils";
import Page from "@calcom/ee/organizations/pages/settings/attributes/attributes-create-view";
export const generateMetadata = async () =>
await _generateMetadata(
() => "Attribute",
() => "Create an attribute for your team members"
);
export default Page;
@@ -0,0 +1,11 @@
import { _generateMetadata } from "app/_utils";
import Page from "@calcom/ee/organizations/pages/settings/attributes/attributes-list-view";
export const generateMetadata = async () =>
await _generateMetadata(
(t) => t("attributes"),
(t) => t("attribute_meta_description")
);
export default Page;
@@ -0,0 +1,25 @@
import { _generateMetadata, getFixedT } from "app/_utils";
import { getServerSession } from "next-auth";
import { AUTH_OPTIONS } from "@calcom/features/auth/lib/next-auth-options";
import DirectorySyncTeamView from "@calcom/features/ee/dsync/page/team-dsync-view";
import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader";
export const generateMetadata = async () =>
await _generateMetadata(
(t) => t("directory_sync"),
(t) => t("directory_sync_description")
);
const Page = async () => {
const session = await getServerSession(AUTH_OPTIONS);
const t = await getFixedT(session?.user.locale || "en");
return (
<SettingsHeader title={t("directory_sync")} description={t("directory_sync_description")}>
<DirectorySyncTeamView />
</SettingsHeader>
);
};
export default Page;
@@ -0,0 +1,25 @@
import { _generateMetadata, getFixedT } from "app/_utils";
import { getServerSession } from "next-auth";
import { AUTH_OPTIONS } from "@calcom/features/auth/lib/next-auth-options";
import PrivacyView from "@calcom/features/ee/organizations/pages/settings/privacy";
import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader";
export const generateMetadata = async () =>
await _generateMetadata(
(t) => t("privacy"),
(t) => t("privacy_organization_description")
);
const Page = async () => {
const session = await getServerSession(AUTH_OPTIONS);
const t = await getFixedT(session?.user.locale || "en");
return (
<SettingsHeader title={t("privacy")} description={t("privacy_organization_description")}>
<PrivacyView />
</SettingsHeader>
);
};
export default Page;
@@ -0,0 +1,21 @@
import { withAppDirSsr } from "app/WithAppDirSsr";
import { _generateMetadata } from "app/_utils";
import { WithLayout } from "app/layoutHOC";
import type { inferSSRProps } from "@calcom/types/inferSSRProps";
import { getServerSideProps } from "@lib/settings/license-key/new/getServerSideProps";
import CreateANewLicenseKeyForm, { LayoutWrapper } from "~/settings/license-key/new/new-view";
export const generateMetadata = async () =>
await _generateMetadata(
(t) => t("set_up_your_organization"),
(t) => t("organizations_description")
);
export default WithLayout({
Page: CreateANewLicenseKeyForm,
getLayout: LayoutWrapper,
getData: withAppDirSsr<inferSSRProps<typeof getServerSideProps>>(getServerSideProps),
});
@@ -6,7 +6,6 @@ import { AUTH_OPTIONS } from "@calcom/feature-auth/lib/next-auth-options";
export const getServerSideProps = async (context: GetServerSidePropsContext) => {
const session = await getServerSession({
req: context.req,
res: context.res,
authOptions: AUTH_OPTIONS,
});
// Disable this check if we ever make this self serve.
@@ -0,0 +1,14 @@
"use client";
import { CreateANewLicenseKeyForm } from "@calcom/features/ee/deployment/licensekey/CreateLicenseKeyForm";
import { WizardLayout } from "@calcom/ui";
export const LayoutWrapper = (page: React.ReactElement) => {
return (
<WizardLayout currentStep={1} maxSteps={2}>
{page}
</WizardLayout>
);
};
export default CreateANewLicenseKeyForm;
@@ -1,13 +1,14 @@
"use client";
import { CreateANewLicenseKeyForm } from "@calcom/features/ee/deployment/licensekey/CreateLicenseKeyForm";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { WizardLayout, Meta } from "@calcom/ui";
import { Meta } from "@calcom/ui";
import { getServerSideProps } from "@lib/settings/license-keys/new/getServerSideProps";
import { getServerSideProps } from "@lib/settings/license-key/new/getServerSideProps";
import PageWrapper from "@components/PageWrapper";
import CreateANewLicenseKeyForm, { LayoutWrapper } from "~/settings/license-key/new/new-view";
const CreateNewLicenseKeyPage = () => {
const { t } = useLocale();
return (
@@ -17,13 +18,6 @@ const CreateNewLicenseKeyPage = () => {
</>
);
};
const LayoutWrapper = (page: React.ReactElement) => {
return (
<WizardLayout currentStep={1} maxSteps={2}>
{page}
</WizardLayout>
);
};
CreateNewLicenseKeyPage.getLayout = LayoutWrapper;
CreateNewLicenseKeyPage.PageWrapper = PageWrapper;
@@ -1,9 +1,24 @@
import OrgAttributesEditPage from "@calcom/ee/organizations/pages/settings/attributes/attributes-edit-view";
"use client";
import OrgAttributesEditPage, {
getLayout,
} from "@calcom/ee/organizations/pages/settings/attributes/attributes-edit-view";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Meta } from "@calcom/ui";
import type { CalPageWrapper } from "@components/PageWrapper";
import PageWrapper from "@components/PageWrapper";
const Page = OrgAttributesEditPage as CalPageWrapper;
const Page = () => {
const { t } = useLocale();
return (
<>
<Meta title="Attribute" description={t("edit_attribute_description")} />
<OrgAttributesEditPage />
</>
);
};
Page.getLayout = getLayout;
Page.PageWrapper = PageWrapper;
export default Page;
@@ -1,9 +1,20 @@
import OrgAttributesCreatePage from "@calcom/ee/organizations/pages/settings/attributes/attributes-create-view";
import OrgAttributesCreatePage, {
getLayout,
} from "@calcom/ee/organizations/pages/settings/attributes/attributes-create-view";
import { Meta } from "@calcom/ui";
import type { CalPageWrapper } from "@components/PageWrapper";
import PageWrapper from "@components/PageWrapper";
const Page = OrgAttributesCreatePage as CalPageWrapper;
const Page = () => {
return (
<>
<Meta title="Attribute" description="Create an attribute for your team members" />
<OrgAttributesCreatePage />
</>
);
};
Page.getLayout = getLayout;
Page.PageWrapper = PageWrapper;
export default Page;
@@ -1,9 +1,21 @@
import OrgSettingsAttributesPage from "@calcom/ee/organizations/pages/settings/attributes/attributes-list-view";
import OrgSettingsAttributesPage, {
getLayout,
} from "@calcom/ee/organizations/pages/settings/attributes/attributes-list-view";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Meta } from "@calcom/ui";
import type { CalPageWrapper } from "@components/PageWrapper";
import PageWrapper from "@components/PageWrapper";
const Page = OrgSettingsAttributesPage as CalPageWrapper;
const Page = () => {
const { t } = useLocale();
return (
<>
<Meta title={t("attributes")} description={t("attribute_meta_description")} />
<OrgSettingsAttributesPage />
</>
);
};
Page.getLayout = getLayout;
Page.PageWrapper = PageWrapper;
export default Page;
@@ -1,9 +1,22 @@
"use client";
import DirectorySyncTeamView from "@calcom/features/ee/dsync/page/team-dsync-view";
import { getLayout } from "@calcom/features/settings/layouts/SettingsLayout";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Meta } from "@calcom/ui";
import type { CalPageWrapper } from "@components/PageWrapper";
import PageWrapper from "@components/PageWrapper";
const Page = DirectorySyncTeamView as CalPageWrapper;
const Page = () => {
const { t } = useLocale();
return (
<>
<Meta title={t("directory_sync")} description={t("directory_sync_description")} />
<DirectorySyncTeamView />
</>
);
};
Page.getLayout = getLayout;
Page.PageWrapper = PageWrapper;
export default Page;
@@ -1,9 +1,27 @@
"use client";
import PrivacyView from "@calcom/features/ee/organizations/pages/settings/privacy";
import { getLayout } from "@calcom/features/settings/layouts/SettingsLayout";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Meta } from "@calcom/ui";
import type { CalPageWrapper } from "@components/PageWrapper";
import PageWrapper from "@components/PageWrapper";
const Page = PrivacyView as CalPageWrapper;
const Page = () => {
const { t } = useLocale();
return (
<>
<Meta
borderInShellHeader={false}
title={t("privacy")}
description={t("privacy_organization_description")}
/>
<PrivacyView />
</>
);
};
Page.getLayout = getLayout;
Page.PageWrapper = PageWrapper;
export default Page;