From 9cd1f34f16eb4c2a8f47ee6e42a51132becc5ac7 Mon Sep 17 00:00:00 2001 From: Romit <85230081+romitg2@users.noreply.github.com> Date: Fri, 1 May 2026 08:16:18 +0530 Subject: [PATCH] cleanup(workspace-platform): remove entrypoints (#29035) * refactor: remove workspace platform entrypoints * cleanup --- .../auth/platform/authorize/page.tsx | 19 --- .../modules/auth/platform/authorize-view.tsx | 126 ------------------ apps/web/modules/shell/Shell.tsx | 6 +- apps/web/modules/shell/SideBar.tsx | 93 ++++++------- .../shell/user-dropdown/UserDropdown.test.tsx | 10 -- .../shell/user-dropdown/UserDropdown.tsx | 43 +++--- apps/web/modules/signup-view.tsx | 7 - apps/web/next.config.ts | 5 - 8 files changed, 60 insertions(+), 249 deletions(-) delete mode 100644 apps/web/app/(use-page-wrapper)/auth/platform/authorize/page.tsx delete mode 100644 apps/web/modules/auth/platform/authorize-view.tsx 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.tsx deleted file mode 100644 index 695b10f569..0000000000 --- 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 ; -}; - -export default ServerPage; diff --git a/apps/web/modules/auth/platform/authorize-view.tsx b/apps/web/modules/auth/platform/authorize-view.tsx deleted file mode 100644 index 9e6ca0b1fd..0000000000 --- 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 && ( -
  • - - {permissionsMessage} your {`${value.label}s`.toLocaleLowerCase()} -
  • - ) - ); - }); - - return ( -
    -
    -
    - {/* - 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 ? ( - } - className="items-center" - imageSrc={client.logo} - size="lg" - /> - ) : ( - } - className="items-center" - imageSrc="/cal-com-icon.svg" - size="lg" - /> - )} -
    -
    -
    - Logo -
    -
    -
    -
    -

    - {t("access_cal_account", { clientName: client.name, appName: APP_NAME })} -

    -
    - {t("allow_client_to", { clientName: client.name })} -
    -
      {permissions}
    -
    -
    - -
    -
    -
    - {t("allow_client_to_do", { clientName: client.name })} -
    -
    {t("oauth_access_information", { appName: APP_NAME })}
    {" "} -
    -
    -
    -
    - - -
    -
    -
    - ); -} diff --git a/apps/web/modules/shell/Shell.tsx b/apps/web/modules/shell/Shell.tsx index 9b8ed482b0..5aab0461df 100644 --- a/apps/web/modules/shell/Shell.tsx +++ b/apps/web/modules/shell/Shell.tsx @@ -42,13 +42,13 @@ const Layout = (props: LayoutProps) => {
    - {banners && !props.isPlatformUser && } + {banners && }
    {props.SidebarContainer ? ( cloneElement(props.SidebarContainer, { bannersHeight }) ) : ( - + )}
    @@ -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 = , TopNavContainer: TopNavContainerProp = , ...props diff --git a/apps/web/modules/shell/SideBar.tsx b/apps/web/modules/shell/SideBar.tsx index 0805998c3d..9f06e73603 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 ; + return ; } 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 (
    ); diff --git a/apps/web/modules/shell/user-dropdown/UserDropdown.test.tsx b/apps/web/modules/shell/user-dropdown/UserDropdown.test.tsx index b01c99f98f..d66af69975 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 }) =>
    {children}
    , })); diff --git a/apps/web/modules/shell/user-dropdown/UserDropdown.tsx b/apps/web/modules/shell/user-dropdown/UserDropdown.tsx index a29b219e37..8ebfdd6f92 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) { <> - {!isPlatformPages && ( - <> - }> - - {t("my_profile")} - - }> - - {t("my_settings")} - - }> - - {t("out_of_office")} - - - - )} + <> + }> + + {t("my_profile")} + + }> + + {t("my_settings")} + + }> + + {t("out_of_office")} + + + }> @@ -192,12 +185,6 @@ export function UserDropdown({ small }: UserDropdownProps) { {t("help")} - {!isPlatformPages && isPlatformUser && ( - } className="todesktop:hidden hidden lg:flex"> - - {t("platform")} - - )} = 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.ts index d82e9d99ca..124b88b6c0 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",