Scheduling infrastructure for absolutely everyone.
cleanup(workspace-platform): remove entrypoints (#29035)
Romit9cd1f34f16eb
diff --git a/apps/web/app/(use-page-wrapper)/auth/platform/authorize/page.tsx b/apps/web/app/(use-page-wrapper)/auth/platform/authorize/page.tsxdeleted file mode 100644index 695b10f569f..00000000000--- a/apps/web/app/(use-page-wrapper)/auth/platform/authorize/page.tsx+++ /dev/null@@ -1,19 +0,0 @@-import { _generateMetadata } from "app/_utils";--import Page from "~/auth/platform/authorize-view";--export const generateMetadata = async () => {- return await _generateMetadata(- (t) => t("authorize"),- () => "",- undefined,- undefined,- "/auth/platform/authorize"- );-};--const ServerPage = async () => {- return <Page />;-};--export default ServerPage;diff --git a/apps/web/modules/auth/platform/authorize-view.tsx b/apps/web/modules/auth/platform/authorize-view.tsxdeleted file mode 100644index 9e6ca0b1fdf..00000000000--- a/apps/web/modules/auth/platform/authorize-view.tsx+++ /dev/null@@ -1,126 +0,0 @@-"use client";--import { useRouter } from "next/navigation";--import { APP_NAME } from "@calcom/lib/constants";-import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";-import { useLocale } from "@calcom/lib/hooks/useLocale";-import { PERMISSIONS_GROUPED_MAP } from "@calcom/platform-constants/permissions";-import { Avatar } from "@calcom/ui/components/avatar";-import { Button } from "@calcom/ui/components/button";-import { InfoIcon, PlusIcon } from "@coss/ui/icons";--import { hasPermission } from "../../../../../packages/platform/utils/permissions";--export default function Authorize() {- const { t } = useLocale();- const router = useRouter();-- const searchParams = useCompatSearchParams();- const queryString = searchParams?.toString();-- // const { isLoading, error, data: client } = useOAuthClient(queryString);-- const client: {- name: string;- logo?: string;- redirect_uris: string[];- permissions: number;- } = {- name: "Acme.com",- redirect_uris: ["", ""],- permissions: 7,- };-- const permissions = Object.values(PERMISSIONS_GROUPED_MAP).map((value) => {- let permissionsMessage = "";- const hasReadPermission = hasPermission(client.permissions, value.read);- const hasWritePermission = hasPermission(client.permissions, value.write);-- if (hasReadPermission || hasWritePermission) {- permissionsMessage = hasReadPermission ? "Read" : "Write";- }-- if (hasReadPermission && hasWritePermission) {- permissionsMessage = "Read, write";- }-- return (- !!permissionsMessage && (- <li key={value.read} className="relative pl-5 text-sm">- <span className="absolute left-0">✓</span>- {permissionsMessage} your {`${value.label}s`.toLocaleLowerCase()}- </li>- )- );- });-- return (- <div className="flex min-h-screen items-center justify-center">- <div className="mt-2 max-w-xl rounded-md bg-white px-9 pb-3 pt-2">- <div className="flex items-center justify-center">- {/*- below is where the client logo will be displayed- first we check if the client has a logo property and display logo if present- else we take logo from user profile pic- */}- {client.logo ? (- <Avatar- alt=""- fallback={<PlusIcon className="text-subtle h-6 w-6" />}- className="items-center"- imageSrc={client.logo}- size="lg"- />- ) : (- <Avatar- alt=""- fallback={<PlusIcon className="text-subtle h-6 w-6" />}- className="items-center"- imageSrc="/cal-com-icon.svg"- size="lg"- />- )}- <div className="relative -ml-6 h-24 w-24">- <div className="absolute inset-0 flex items-center justify-center">- <div className="flex h-[70px] w-[70px] items-center justify-center rounded-full bg-white">- <img src="/cal-com-icon.svg" alt="Logo" className="h-16 w-16 rounded-full" />- </div>- </div>- </div>- </div>- <h1 className="px-5 pb-5 pt-3 text-center text-2xl font-bold tracking-tight text-black">- {t("access_cal_account", { clientName: client.name, appName: APP_NAME })}- </h1>- <div className="mb-4 mt-5 font-medium text-black">- {t("allow_client_to", { clientName: client.name })}- </div>- <ul className="stack-y-4 text-sm text-black">{permissions}</ul>- <div className="bg-subtle mb-8 mt-8 flex rounded-md p-3">- <div>- <InfoIcon className="mr-1 mt-0.5 h-4 w-4" />- </div>- <div className="ml-1 ">- <div className="mb-1 text-sm font-medium">- {t("allow_client_to_do", { clientName: client.name })}- </div>- <div className="text-sm">{t("oauth_access_information", { appName: APP_NAME })}</div>{" "}- </div>- </div>- <div className="border-subtle border- -mx-9 mb-4 border-b" />- <div className="flex justify-end">- <Button- className="bg-primary-default mr-2 text-black"- onClick={() => {- router.back();- }}>- {t("go_back")}- </Button>- <Button data-testid="allow-button" className="bg-black text-white">- {t("allow")}- </Button>- </div>- </div>- </div>- );-}diff --git a/apps/web/modules/shell/Shell.tsx b/apps/web/modules/shell/Shell.tsxindex 9b8ed482b03..5aab0461dfa 100644--- a/apps/web/modules/shell/Shell.tsx+++ b/apps/web/modules/shell/Shell.tsx@@ -42,13 +42,13 @@ const Layout = (props: LayoutProps) => {<DynamicModals /><div className="flex min-h-screen flex-col">- {banners && !props.isPlatformUser && <BannerContainer banners={banners} />}+ {banners && <BannerContainer banners={banners} />}<div className="flex flex-1" data-testid="dashboard-shell">{props.SidebarContainer ? (cloneElement(props.SidebarContainer, { bannersHeight })) : (- <SideBarContainer isPlatformUser={props.isPlatformUser} bannersHeight={bannersHeight} />+ <SideBarContainer bannersHeight={bannersHeight} />)}<div className="flex w-0 flex-1 flex-col"><MainContainer {...props} />@@ -86,7 +86,6 @@ export type LayoutProps = {beforeCTAactions?: JSX.Element;afterHeading?: ReactNode;smallHeading?: boolean;- isPlatformUser?: boolean;disableSticky?: boolean;};@@ -198,7 +197,6 @@ export function ShellMain(props: LayoutProps) {}function MainContainer({- isPlatformUser,MobileNavigationContainer: MobileNavigationContainerProp = <MobileNavigationContainer />,TopNavContainer: TopNavContainerProp = <TopNavContainer />,...propsdiff --git a/apps/web/modules/shell/SideBar.tsx b/apps/web/modules/shell/SideBar.tsxindex 0805998c3d3..9f06e73603b 100644--- a/apps/web/modules/shell/SideBar.tsx+++ b/apps/web/modules/shell/SideBar.tsx@@ -12,7 +12,6 @@ import { SkeletonText } from "@calcom/ui/components/skeleton";import { Tooltip } from "@calcom/ui/components/tooltip";import { ArrowLeftIcon, ArrowRightIcon } from "@coss/ui/icons";import Link from "next/link";-import { usePathname } from "next/navigation";import type { User as UserAuth } from "next-auth";import { useSession } from "next-auth/react";import { KBarTrigger } from "./Kbar";@@ -23,16 +22,14 @@ import { UserDropdown } from "./user-dropdown/UserDropdown";export type SideBarContainerProps = {bannersHeight: number;- isPlatformUser?: boolean;};export type SideBarProps = {bannersHeight: number;user?: UserAuth | null;- isPlatformUser?: boolean;};-export function SideBarContainer({ bannersHeight, isPlatformUser = false }: SideBarContainerProps) {+export function SideBarContainer({ bannersHeight }: SideBarContainerProps) {const { status, data } = useSession();const isStandalone = useIsStandalone();@@ -41,13 +38,11 @@ export function SideBarContainer({ bannersHeight, isPlatformUser = false }: Side// Though when logged out, app store pages would temporarily show SideBar until session status is confirmed.if (status !== "loading" && status !== "authenticated") return null;if (isStandalone) return null;- return <SideBar isPlatformUser={isPlatformUser} bannersHeight={bannersHeight} user={data?.user} />;+ return <SideBar bannersHeight={bannersHeight} user={data?.user} />;}export function SideBar({ bannersHeight, user }: SideBarProps) {const { t, isLocaleReady } = useLocale();- const pathname = usePathname();- const isPlatformPages = pathname?.startsWith("/settings/platform");const publicPageUrl = `${WEBAPP_URL}/${user?.orgAwareUsername}`;@@ -63,10 +58,10 @@ export function SideBar({ bannersHeight, user }: SideBarProps) {return (<div className="relative"><aside- style={!isPlatformPages ? sidebarStylingAttributes : {}}+ style={sidebarStylingAttributes}className={classNames("fixed left-0 hidden h-full w-14 flex-col overflow-y-auto overflow-x-hidden border-muted border-r bg-cal-muted md:sticky md:flex lg:w-56 lg:px-3",- !isPlatformPages && "max-h-screen"+ "max-h-screen")}><div className="flex h-full flex-col justify-between py-3 lg:pt-4"><header className="todesktop:-mt-3 todesktop:flex-col-reverse items-center justify-between todesktop:[-webkit-app-region:drag] md:hidden lg:flex">@@ -125,47 +120,45 @@ export function SideBar({ bannersHeight, user }: SideBarProps) {<Navigation /></div>- {!isPlatformPages && (- <div className="md:px-2 md:pb-4 lg:p-0">- {bottomNavItems.map((item, index) => (- <Tooltip side="right" content={t(item.name)} className="lg:hidden" key={item.name}>- <ButtonOrLink- id={item.name}- href={item.href || undefined}- aria-label={t(item.name)}- target={item.target}- className={classNames(- "text-left",- "justify-right group flex items-center rounded-md px-2 py-1.5 font-medium text-default text-sm transition [&[aria-current='page']]:bg-emphasis",- "mt-0.5 w-full text-sm [&[aria-current='page']]:text-emphasis",- isLocaleReady ? "hover:bg-subtle hover:text-emphasis" : "",- index === 0 && "mt-3"- )}- onClick={item.onClick}>- {!!item.icon && (- <Icon- name={item.isLoading ? "rotate-cw" : item.icon}- className={classNames(- "h-4 w-4 shrink-0 aria-[aria-current='page']:text-inherit",- "ml-3 md:mx-auto lg:ltr:mr-2 lg:rtl:ml-2",- item.isLoading && "animate-spin"- )}- aria-hidden="true"- />- )}- {isLocaleReady ? (- <span className="hidden w-full justify-between lg:flex">- <div className="flex">{t(item.name)}</div>- </span>- ) : (- <SkeletonText className="h-[20px] w-full" />- )}- </ButtonOrLink>- </Tooltip>- ))}- {!IS_VISUAL_REGRESSION_TESTING && <Credits />}- </div>- )}+ <div className="md:px-2 md:pb-4 lg:p-0">+ {bottomNavItems.map((item, index) => (+ <Tooltip side="right" content={t(item.name)} className="lg:hidden" key={item.name}>+ <ButtonOrLink+ id={item.name}+ href={item.href || undefined}+ aria-label={t(item.name)}+ target={item.target}+ className={classNames(+ "text-left",+ "justify-right group flex items-center rounded-md px-2 py-1.5 font-medium text-default text-sm transition [&[aria-current='page']]:bg-emphasis",+ "mt-0.5 w-full text-sm [&[aria-current='page']]:text-emphasis",+ isLocaleReady ? "hover:bg-subtle hover:text-emphasis" : "",+ index === 0 && "mt-3"+ )}+ onClick={item.onClick}>+ {!!item.icon && (+ <Icon+ name={item.isLoading ? "rotate-cw" : item.icon}+ className={classNames(+ "h-4 w-4 shrink-0 aria-[aria-current='page']:text-inherit",+ "ml-3 md:mx-auto lg:ltr:mr-2 lg:rtl:ml-2",+ item.isLoading && "animate-spin"+ )}+ aria-hidden="true"+ />+ )}+ {isLocaleReady ? (+ <span className="hidden w-full justify-between lg:flex">+ <div className="flex">{t(item.name)}</div>+ </span>+ ) : (+ <SkeletonText className="h-[20px] w-full" />+ )}+ </ButtonOrLink>+ </Tooltip>+ ))}+ {!IS_VISUAL_REGRESSION_TESTING && <Credits />}+ </div></aside></div>);diff --git a/apps/web/modules/shell/user-dropdown/UserDropdown.test.tsx b/apps/web/modules/shell/user-dropdown/UserDropdown.test.tsxindex b01c99f98f6..d66af69975a 100644--- a/apps/web/modules/shell/user-dropdown/UserDropdown.test.tsx+++ b/apps/web/modules/shell/user-dropdown/UserDropdown.test.tsx@@ -6,10 +6,6 @@ vi.mock("next-auth/react", () => ({signOut: vi.fn(),}));-vi.mock("next/navigation", () => ({- usePathname: () => "/settings",-}));-vi.mock("@calcom/lib/hooks/useLocale", () => ({useLocale: () => ({t: (key: string) => key,@@ -29,12 +25,6 @@ vi.mock("@calcom/trpc/react/hooks/useMeQuery", () => ({default: () => mockUseMeQuery(),}));-vi.mock("@calcom/web/components/settings/platform/hooks/useGetUserAttributes", () => ({- useGetUserAttributes: () => ({- isPlatformUser: false,- }),-}));-vi.mock("@calcom/web/modules/api-keys/support/lib/freshchat/FreshChatProvider", () => ({default: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,}));diff --git a/apps/web/modules/shell/user-dropdown/UserDropdown.tsx b/apps/web/modules/shell/user-dropdown/UserDropdown.tsxindex a29b219e377..8ebfdd6f921 100644--- a/apps/web/modules/shell/user-dropdown/UserDropdown.tsx+++ b/apps/web/modules/shell/user-dropdown/UserDropdown.tsx@@ -14,7 +14,6 @@ import {MenuTrigger,} from "@coss/ui/components/menu";import {- BlocksIcon,ChevronDownIcon,ChevronUpIcon,CircleHelpIcon,@@ -25,7 +24,6 @@ import {UserIcon,} from "@coss/ui/icons";import Link from "next/link";-import { usePathname } from "next/navigation";import { signOut } from "next-auth/react";import type { MouseEvent } from "react";import { useEffect, useState } from "react";@@ -51,11 +49,8 @@ interface UserDropdownProps {}export function UserDropdown({ small }: UserDropdownProps) {- const isPlatformUser = false;const { t } = useLocale();const { data: user, isPending } = useMeQuery();- const pathname = usePathname();- const isPlatformPages = pathname?.startsWith("/settings/platform");useEffect(() => {if (typeof window === "undefined") return;@@ -166,23 +161,21 @@ export function UserDropdown({ small }: UserDropdownProps) {<><MenuPopup align="start">- {!isPlatformPages && (- <>- <MenuItem render={<Link href="/settings/my-account/profile" />}>- <UserIcon />- {t("my_profile")}- </MenuItem>- <MenuItem render={<Link href="/settings/my-account/general" />}>- <SettingsIcon />- {t("my_settings")}- </MenuItem>- <MenuItem render={<Link href="/settings/my-account/out-of-office" />}>- <MoonIcon />- {t("out_of_office")}- </MenuItem>- <MenuSeparator />- </>- )}+ <>+ <MenuItem render={<Link href="/settings/my-account/profile" />}>+ <UserIcon />+ {t("my_profile")}+ </MenuItem>+ <MenuItem render={<Link href="/settings/my-account/general" />}>+ <SettingsIcon />+ {t("my_settings")}+ </MenuItem>+ <MenuItem render={<Link href="/settings/my-account/out-of-office" />}>+ <MoonIcon />+ {t("out_of_office")}+ </MenuItem>+ <MenuSeparator />+ </><MenuItem render={<a href={ROADMAP} target="_blank" rel="noreferrer" />}><MapIcon />@@ -192,12 +185,6 @@ export function UserDropdown({ small }: UserDropdownProps) {<CircleHelpIcon />{t("help")}</MenuItem>- {!isPlatformPages && isPlatformUser && (- <MenuItem render={<Link href="/settings/platform" />} className="todesktop:hidden hidden lg:flex">- <BlocksIcon />- {t("platform")}- </MenuItem>- )}<MenuSeparator /><MenuItemdiff --git a/apps/web/modules/signup-view.tsx b/apps/web/modules/signup-view.tsxindex f76ab0b13a6..20e17e03e93 100644--- a/apps/web/modules/signup-view.tsx+++ b/apps/web/modules/signup-view.tsx@@ -237,8 +237,6 @@ export default function Signup({const loadingSubmitState = isSubmitSuccessful || isSubmitting;const displayBackButton = token ? false : displayEmailForm;- const isPlatformUser = redirectUrl?.includes("platform") && redirectUrl?.includes("new");-const signUp: SubmitHandler<FormValues> = async (_data) => {const { cfToken, ...data } = _data;@@ -295,8 +293,6 @@ export default function Signup({const gettingStartedPath = onboardingV3Enabled ? "onboarding/getting-started" : "getting-started";const verifyOrGettingStarted = emailVerificationEnabled ? "auth/verify-email" : gettingStartedPath;- const gettingStartedWithPlatform = "settings/platform/new";-const constructCallBackIfUrlPresent = () => {if (isOrgInviteByLink) {return `${WEBAPP_URL}/${searchParams.get("callbackUrl")}`;@@ -305,9 +301,6 @@ export default function Signup({};const constructCallBackIfUrlNotPresent = () => {- if (isPlatformUser) {- return `${WEBAPP_URL}/${gettingStartedWithPlatform}?from=signup`;- }return `${WEBAPP_URL}/${verifyOrGettingStarted}?from=signup`;};diff --git a/apps/web/next.config.ts b/apps/web/next.config.tsindex d82e9d99ca1..124b88b6c02 100644--- a/apps/web/next.config.ts+++ b/apps/web/next.config.ts@@ -614,11 +614,6 @@ const nextConfig = (phase: string): NextConfig => {destination: "/apps/installed/calendar",permanent: true,},- {- source: "/settings/organizations/platform/:path*",- destination: "/settings/platform",- permanent: true,- },{source: "/settings/organizations/members",destination: "/members",