Skip to content

Commit

Permalink
manual: move files to correct route groups and add metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
hbjORbj committed Dec 6, 2023
1 parent 9616351 commit 73b23d9
Show file tree
Hide file tree
Showing 18 changed files with 199 additions and 60 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import OldPage from "@pages/settings/organizations/[id]/about";
import { _generateMetadata } from "app/_utils";
import { headers } from "next/headers";

import { WizardLayout } from "@calcom/ui";

import PageWrapper from "@components/PageWrapperAppDir";

export const generateMetadata = async () =>
await _generateMetadata(
(t) => t("about_your_organization"),
(t) => t("about_your_organization_description")
);

const LayoutWrapper = (page: React.ReactElement) => {
return (
<WizardLayout currentStep={3} maxSteps={5}>
{page}
</WizardLayout>
);
};

const Page = () => {
const h = headers();
const nonce = h.get("x-nonce") ?? undefined;

return (
<PageWrapper getLayout={LayoutWrapper} requiresLicense={false} nonce={nonce} themeBasis={null}>
<OldPage />
</PageWrapper>
);
};

export default Page;
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import OldPage from "@pages/settings/organizations/[id]/add-teams";
import { _generateMetadata } from "app/_utils";
import { headers } from "next/headers";
import { redirect } from "next/navigation";

import { WizardLayout } from "@calcom/ui";

import PageWrapper from "@components/PageWrapperAppDir";

export const generateMetadata = async () =>
await _generateMetadata(
(t) => t("create_your_teams"),
(t) => t("create_your_teams_description")
);

const LayoutWrapper = (page: React.ReactElement) => (
<WizardLayout
currentStep={5}
maxSteps={5}
isOptionalCallback={() => {
redirect(`/event-types`);
}}>
{page}
</WizardLayout>
);

const Page = () => {
const h = headers();
const nonce = h.get("x-nonce") ?? undefined;

return (
<PageWrapper getLayout={LayoutWrapper} requiresLicense={false} nonce={nonce} themeBasis={null}>
<OldPage />
</PageWrapper>
);
};

export default Page;
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import OldPage from "@pages/settings/organizations/[id]/onboard-admins";
import { type Params } from "app/_types";
import { _generateMetadata } from "app/_utils";
import { headers } from "next/headers";
import { redirect } from "next/navigation";

import { WizardLayout } from "@calcom/ui";

import PageWrapper from "@components/PageWrapperAppDir";

type PageProps = Readonly<{
params: Params;
}>;

export const generateMetadata = async () =>
await _generateMetadata(
(t) => t("invite_organization_admins"),
(t) => t("invite_organization_admins_description")
);

const Page = ({ params }: PageProps) => {
const h = headers();
const nonce = h.get("x-nonce") ?? undefined;

return (
<PageWrapper
getLayout={(page: React.ReactElement) => (
<WizardLayout
currentStep={4}
maxSteps={5}
isOptionalCallback={() => {
redirect(`/settings/organizations/${params.id}/add-teams`);
}}>
{page}
</WizardLayout>
)}
requiresLicense={false}
nonce={nonce}
themeBasis={null}>
<OldPage />
</PageWrapper>
);
};

export default Page;
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import OldPage from "@pages/settings/organizations/[id]/set-password";
import { _generateMetadata } from "app/_utils";
import { headers } from "next/headers";

import { WizardLayout } from "@calcom/ui";

import PageWrapper from "@components/PageWrapperAppDir";

export const generateMetadata = async () =>
await _generateMetadata(
(t) => t("set_a_password"),
(t) => t("set_a_password_description")
);

const LayoutWrapper = (page: React.ReactElement) => {
return (
<WizardLayout currentStep={2} maxSteps={5}>
{page}
</WizardLayout>
);
};

const Page = () => {
const h = headers();
const nonce = h.get("x-nonce") ?? undefined;

return (
<PageWrapper getLayout={LayoutWrapper} requiresLicense={false} nonce={nonce} themeBasis={null}>
<OldPage />
</PageWrapper>
);
};

export default Page;
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import OldPage from "@pages/settings/organizations/new/index";
import { type Params } from "app/_types";
import { _generateMetadata } from "app/_utils";
import type { Params } from "next/dist/shared/lib/router/utils/route-matcher";
import { type GetServerSidePropsContext } from "next";
import { headers, cookies } from "next/headers";
import { notFound } from "next/navigation";

import { getFeatureFlagMap } from "@calcom/features/flags/server/utils";
import { WizardLayout } from "@calcom/ui";

import { buildLegacyCtx } from "@lib/buildLegacyCtx";

Expand All @@ -17,6 +22,29 @@ type PageProps = Readonly<{
params: Params;
}>;

const getData = async (context: GetServerSidePropsContext) => {
const prisma = await import("@calcom/prisma").then((mod) => mod.default);
const flags = await getFeatureFlagMap(prisma);
// Check if organizations are enabled
if (flags["organizations"] !== true) {
return notFound();
}

const querySlug = context.query.slug as string;

return {
querySlug: querySlug ?? null,
};
};

const LayoutWrapper = (page: React.ReactElement) => {
return (
<WizardLayout currentStep={1} maxSteps={5}>
{page}
</WizardLayout>
);
};

const Page = async ({ params }: PageProps) => {
const h = headers();
const nonce = h.get("x-nonce") ?? undefined;
Expand All @@ -25,7 +53,7 @@ const Page = async ({ params }: PageProps) => {
const props = await getData(legacyCtx);

return (
<PageWrapper requiresLicense={false} nonce={nonce} themeBasis={null}>
<PageWrapper getLayout={LayoutWrapper} requiresLicense={false} nonce={nonce} themeBasis={null}>
<OldPage {...props} />
</PageWrapper>
);
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import Page from "@calcom/features/ee/organizations/pages/settings/appearance";

export const generateMetadata = async () =>
await _generateMetadata(
() => "",
() => ""
(t) => t("appearance"),
(t) => t("appearance_org_description")
);

export default Page;
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { _generateMetadata } from "app/_utils";

export const generateMetadata = async () =>
await _generateMetadata(
() => "",
() => ""
(t) => t("billing"),
(t) => t("manage_billing_description")
);

export default Page;
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import Page from "@calcom/features/ee/organizations/pages/settings/general";

export const generateMetadata = async () =>
await _generateMetadata(
() => "",
() => ""
(t) => t("general"),
(t) => t("general_description")
);

export default Page;
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import Page from "@calcom/features/ee/organizations/pages/settings/members";

export const generateMetadata = async () =>
await _generateMetadata(
() => "",
() => ""
(t) => t("organization_members"),
(t) => t("organization_description")
);

export default Page;
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import Page from "@calcom/features/ee/organizations/pages/settings/profile";

export const generateMetadata = async () =>
await _generateMetadata(
() => "",
() => ""
(t) => t("profile"),
(t) => t("profile_org_description")
);

export default Page;
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import Page from "@calcom/features/ee/teams/pages/team-appearance-view";

export const generateMetadata = async () =>
await _generateMetadata(
() => "",
() => ""
(t) => t("booking_appearance"),
(t) => t("appearance_team_description")
);

export default Page;
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import Page from "@calcom/features/ee/organizations/pages/settings/other-team-me

export const generateMetadata = async () =>
await _generateMetadata(
() => "",
() => ""
(t) => t("team_members"),
(t) => t("members_team_description")
);

export default Page;
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import Page from "@calcom/features/ee/organizations/pages/settings/other-team-pr

export const generateMetadata = async () =>
await _generateMetadata(
() => "",
() => ""
(t) => t("profile"),
(t) => t("profile_team_description")
);

export default Page;
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import Page from "@calcom/features/ee/organizations/pages/settings/other-team-li

export const generateMetadata = async () =>
await _generateMetadata(
() => "",
() => ""
(t) => t("org_admin_other_teams"),
(t) => t("org_admin_other_teams_description")
);

export default Page;

0 comments on commit 73b23d9

Please sign in to comment.