diff --git a/apps/web/pages/settings/platform/new/index.tsx b/apps/web/pages/settings/platform/new/index.tsx index 459f4f7009..dfffff7d29 100644 --- a/apps/web/pages/settings/platform/new/index.tsx +++ b/apps/web/pages/settings/platform/new/index.tsx @@ -1,15 +1,50 @@ +import { useRouter } from "next/navigation"; + import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { Meta } from "@calcom/ui"; +import { SkeletonContainer, SkeletonText } from "@calcom/ui"; import { getServerSideProps } from "@lib/settings/organizations/new/getServerSideProps"; import PageWrapper from "@components/PageWrapper"; +import usePlatformMe from "@components/settings/platform/hooks/usePlatformMe"; import CreateNewOrganizationPage, { LayoutWrapper } from "~/settings/platform/new/create-new-view"; +const SkeletonLoader = () => { + return ( + +
+ + + +
+
+ ); +}; + const Page = () => { const { t } = useLocale(); + const { isFetching, data: platformMe } = usePlatformMe(); + const router = useRouter(); + + if (isFetching) { + return ; + } + + if (platformMe?.organization?.id) { + // if user has a platform org redirect to platform dashboard + if (platformMe?.organization?.isPlatform) { + router.push("/settings/platform"); + // user has a regular org redirect to organization settings + } else { + router.push("/settings/organizations/profile"); + } + // display loader while redirection is happening + return ; + } + return (