diff --git a/packages/features/shell/SideBar.tsx b/packages/features/shell/SideBar.tsx index 961b0bbff7..7d81a10939 100644 --- a/packages/features/shell/SideBar.tsx +++ b/packages/features/shell/SideBar.tsx @@ -4,13 +4,12 @@ import dynamic from "next/dynamic"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { useRouter } from "next/navigation"; -import { useState, useMemo } from "react"; +import { useState } from "react"; -import { useOrgBranding } from "@calcom/features/ee/organizations/context/provider"; -import { getOrgFullOrigin } from "@calcom/features/ee/organizations/lib/orgDomains"; import { classNames } from "@calcom/lib"; import { IS_CALCOM, IS_VISUAL_REGRESSION_TESTING, ENABLE_PROFILE_SWITCHER } from "@calcom/lib/constants"; import { getPlaceholderAvatar } from "@calcom/lib/defaultAvatarImage"; +import { getBookerBaseUrlSync } from "@calcom/lib/getBookerUrl/client"; import { useCopy } from "@calcom/lib/hooks/useCopy"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { useNotifications, ButtonState } from "@calcom/lib/hooks/useNotifications"; @@ -62,16 +61,11 @@ export function SideBarContainer({ bannersHeight, isPlatformUser = false }: Side export function SideBar({ bannersHeight, user }: SideBarProps) { const { fetchAndCopyToClipboard } = useCopy(); const { t, isLocaleReady } = useLocale(); - const orgBranding = useOrgBranding(); const pathname = usePathname(); const isPlatformPages = pathname?.startsWith("/settings/platform"); const [isReferalLoading, setIsReferalLoading] = useState(false); - const publicPageUrl = useMemo(() => { - if (!user?.org?.id) return `${process.env.NEXT_PUBLIC_WEBSITE_URL}/${user?.username}`; - const publicPageUrl = orgBranding?.slug ? getOrgFullOrigin(orgBranding.slug) : ""; - return publicPageUrl; - }, [orgBranding?.slug, user?.username, user?.org?.id]); + const publicPageUrl = `${getBookerBaseUrlSync(user?.org?.slug ?? null)}/${user?.username}`; const sidebarStylingAttributes = { maxHeight: `calc(100vh - ${bannersHeight}px)`, @@ -140,17 +134,17 @@ export function SideBar({ bannersHeight, user }: SideBarProps) { )}>
- {orgBranding ? ( + {user?.org ? ( !ENABLE_PROFILE_SWITCHER ? (

- {orgBranding.name} + {user.org.name}

@@ -186,7 +180,7 @@ export function SideBar({ bannersHeight, user }: SideBarProps) { className="group-hover:text-emphasis text-subtle h-4 w-4 flex-shrink-0" /> - {!!orgBranding && ( + {!!user?.org && (