Skip to content

Commit 9cd1f34

Browse files
authored
cleanup(workspace-platform): remove entrypoints (calcom#29035)
* refactor: remove workspace platform entrypoints * cleanup
1 parent 91341cb commit 9cd1f34

8 files changed

Lines changed: 60 additions & 249 deletions

File tree

apps/web/app/(use-page-wrapper)/auth/platform/authorize/page.tsx

Lines changed: 0 additions & 19 deletions
This file was deleted.

apps/web/modules/auth/platform/authorize-view.tsx

Lines changed: 0 additions & 126 deletions
This file was deleted.

apps/web/modules/shell/Shell.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ const Layout = (props: LayoutProps) => {
4242
<DynamicModals />
4343

4444
<div className="flex min-h-screen flex-col">
45-
{banners && !props.isPlatformUser && <BannerContainer banners={banners} />}
45+
{banners && <BannerContainer banners={banners} />}
4646

4747
<div className="flex flex-1" data-testid="dashboard-shell">
4848
{props.SidebarContainer ? (
4949
cloneElement(props.SidebarContainer, { bannersHeight })
5050
) : (
51-
<SideBarContainer isPlatformUser={props.isPlatformUser} bannersHeight={bannersHeight} />
51+
<SideBarContainer bannersHeight={bannersHeight} />
5252
)}
5353
<div className="flex w-0 flex-1 flex-col">
5454
<MainContainer {...props} />
@@ -86,7 +86,6 @@ export type LayoutProps = {
8686
beforeCTAactions?: JSX.Element;
8787
afterHeading?: ReactNode;
8888
smallHeading?: boolean;
89-
isPlatformUser?: boolean;
9089
disableSticky?: boolean;
9190
};
9291

@@ -198,7 +197,6 @@ export function ShellMain(props: LayoutProps) {
198197
}
199198

200199
function MainContainer({
201-
isPlatformUser,
202200
MobileNavigationContainer: MobileNavigationContainerProp = <MobileNavigationContainer />,
203201
TopNavContainer: TopNavContainerProp = <TopNavContainer />,
204202
...props

apps/web/modules/shell/SideBar.tsx

Lines changed: 43 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { SkeletonText } from "@calcom/ui/components/skeleton";
1212
import { Tooltip } from "@calcom/ui/components/tooltip";
1313
import { ArrowLeftIcon, ArrowRightIcon } from "@coss/ui/icons";
1414
import Link from "next/link";
15-
import { usePathname } from "next/navigation";
1615
import type { User as UserAuth } from "next-auth";
1716
import { useSession } from "next-auth/react";
1817
import { KBarTrigger } from "./Kbar";
@@ -23,16 +22,14 @@ import { UserDropdown } from "./user-dropdown/UserDropdown";
2322

2423
export type SideBarContainerProps = {
2524
bannersHeight: number;
26-
isPlatformUser?: boolean;
2725
};
2826

2927
export type SideBarProps = {
3028
bannersHeight: number;
3129
user?: UserAuth | null;
32-
isPlatformUser?: boolean;
3330
};
3431

35-
export function SideBarContainer({ bannersHeight, isPlatformUser = false }: SideBarContainerProps) {
32+
export function SideBarContainer({ bannersHeight }: SideBarContainerProps) {
3633
const { status, data } = useSession();
3734
const isStandalone = useIsStandalone();
3835

@@ -41,13 +38,11 @@ export function SideBarContainer({ bannersHeight, isPlatformUser = false }: Side
4138
// Though when logged out, app store pages would temporarily show SideBar until session status is confirmed.
4239
if (status !== "loading" && status !== "authenticated") return null;
4340
if (isStandalone) return null;
44-
return <SideBar isPlatformUser={isPlatformUser} bannersHeight={bannersHeight} user={data?.user} />;
41+
return <SideBar bannersHeight={bannersHeight} user={data?.user} />;
4542
}
4643

4744
export function SideBar({ bannersHeight, user }: SideBarProps) {
4845
const { t, isLocaleReady } = useLocale();
49-
const pathname = usePathname();
50-
const isPlatformPages = pathname?.startsWith("/settings/platform");
5146

5247
const publicPageUrl = `${WEBAPP_URL}/${user?.orgAwareUsername}`;
5348

@@ -63,10 +58,10 @@ export function SideBar({ bannersHeight, user }: SideBarProps) {
6358
return (
6459
<div className="relative">
6560
<aside
66-
style={!isPlatformPages ? sidebarStylingAttributes : {}}
61+
style={sidebarStylingAttributes}
6762
className={classNames(
6863
"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",
69-
!isPlatformPages && "max-h-screen"
64+
"max-h-screen"
7065
)}>
7166
<div className="flex h-full flex-col justify-between py-3 lg:pt-4">
7267
<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) {
125120
<Navigation />
126121
</div>
127122

128-
{!isPlatformPages && (
129-
<div className="md:px-2 md:pb-4 lg:p-0">
130-
{bottomNavItems.map((item, index) => (
131-
<Tooltip side="right" content={t(item.name)} className="lg:hidden" key={item.name}>
132-
<ButtonOrLink
133-
id={item.name}
134-
href={item.href || undefined}
135-
aria-label={t(item.name)}
136-
target={item.target}
137-
className={classNames(
138-
"text-left",
139-
"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",
140-
"mt-0.5 w-full text-sm [&[aria-current='page']]:text-emphasis",
141-
isLocaleReady ? "hover:bg-subtle hover:text-emphasis" : "",
142-
index === 0 && "mt-3"
143-
)}
144-
onClick={item.onClick}>
145-
{!!item.icon && (
146-
<Icon
147-
name={item.isLoading ? "rotate-cw" : item.icon}
148-
className={classNames(
149-
"h-4 w-4 shrink-0 aria-[aria-current='page']:text-inherit",
150-
"ml-3 md:mx-auto lg:ltr:mr-2 lg:rtl:ml-2",
151-
item.isLoading && "animate-spin"
152-
)}
153-
aria-hidden="true"
154-
/>
155-
)}
156-
{isLocaleReady ? (
157-
<span className="hidden w-full justify-between lg:flex">
158-
<div className="flex">{t(item.name)}</div>
159-
</span>
160-
) : (
161-
<SkeletonText className="h-[20px] w-full" />
162-
)}
163-
</ButtonOrLink>
164-
</Tooltip>
165-
))}
166-
{!IS_VISUAL_REGRESSION_TESTING && <Credits />}
167-
</div>
168-
)}
123+
<div className="md:px-2 md:pb-4 lg:p-0">
124+
{bottomNavItems.map((item, index) => (
125+
<Tooltip side="right" content={t(item.name)} className="lg:hidden" key={item.name}>
126+
<ButtonOrLink
127+
id={item.name}
128+
href={item.href || undefined}
129+
aria-label={t(item.name)}
130+
target={item.target}
131+
className={classNames(
132+
"text-left",
133+
"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",
134+
"mt-0.5 w-full text-sm [&[aria-current='page']]:text-emphasis",
135+
isLocaleReady ? "hover:bg-subtle hover:text-emphasis" : "",
136+
index === 0 && "mt-3"
137+
)}
138+
onClick={item.onClick}>
139+
{!!item.icon && (
140+
<Icon
141+
name={item.isLoading ? "rotate-cw" : item.icon}
142+
className={classNames(
143+
"h-4 w-4 shrink-0 aria-[aria-current='page']:text-inherit",
144+
"ml-3 md:mx-auto lg:ltr:mr-2 lg:rtl:ml-2",
145+
item.isLoading && "animate-spin"
146+
)}
147+
aria-hidden="true"
148+
/>
149+
)}
150+
{isLocaleReady ? (
151+
<span className="hidden w-full justify-between lg:flex">
152+
<div className="flex">{t(item.name)}</div>
153+
</span>
154+
) : (
155+
<SkeletonText className="h-[20px] w-full" />
156+
)}
157+
</ButtonOrLink>
158+
</Tooltip>
159+
))}
160+
{!IS_VISUAL_REGRESSION_TESTING && <Credits />}
161+
</div>
169162
</aside>
170163
</div>
171164
);

apps/web/modules/shell/user-dropdown/UserDropdown.test.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ vi.mock("next-auth/react", () => ({
66
signOut: vi.fn(),
77
}));
88

9-
vi.mock("next/navigation", () => ({
10-
usePathname: () => "/settings",
11-
}));
12-
139
vi.mock("@calcom/lib/hooks/useLocale", () => ({
1410
useLocale: () => ({
1511
t: (key: string) => key,
@@ -29,12 +25,6 @@ vi.mock("@calcom/trpc/react/hooks/useMeQuery", () => ({
2925
default: () => mockUseMeQuery(),
3026
}));
3127

32-
vi.mock("@calcom/web/components/settings/platform/hooks/useGetUserAttributes", () => ({
33-
useGetUserAttributes: () => ({
34-
isPlatformUser: false,
35-
}),
36-
}));
37-
3828
vi.mock("@calcom/web/modules/api-keys/support/lib/freshchat/FreshChatProvider", () => ({
3929
default: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
4030
}));

0 commit comments

Comments
 (0)