cleanup(workspace-platform): remove entrypoints (#29035)

* refactor: remove workspace platform entrypoints

* cleanup
This commit is contained in:
Romit authored and GitHub committed 2026-05-01 02:46:18 +00:00
1 parent 91341cbba4
commit 9cd1f34f16
8 files changed
+60 -249

No files matched your search

+2 -4
View File
@@ -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 />,
...props
+43 -50
View File
@@ -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>
);
@@ -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>,
}));
@@ -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 />
<MenuItem