feat: standalone page config to use in companion (#27018)
* feat: hide navigation when ?standalone=true URL parameter is present Co-Authored-By: peer@cal.com <peer@cal.com> * feat: standalone page config to use in companion --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: peer@cal.com <peer@cal.com>
This commit is contained in:
co-authored by
peer@cal.com <peer@cal.com>
Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
peer@cal.com <peer@cal.com>
parent
adc198b37b
commit
da91152365
@@ -8,6 +8,7 @@ import { getBookerBaseUrlSync } from "@calcom/features/ee/organizations/lib/getB
|
||||
import { useFlagMap } from "@calcom/features/flags/context/provider";
|
||||
import { IS_VISUAL_REGRESSION_TESTING, ENABLE_PROFILE_SWITCHER } from "@calcom/lib/constants";
|
||||
import { getPlaceholderAvatar } from "@calcom/lib/defaultAvatarImage";
|
||||
import { useIsStandalone } from "@calcom/lib/hooks/useIsStandalone";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { UserPermissionRole } from "@calcom/prisma/enums";
|
||||
import classNames from "@calcom/ui/classNames";
|
||||
@@ -43,11 +44,13 @@ export type SideBarProps = {
|
||||
|
||||
export function SideBarContainer({ bannersHeight, isPlatformUser = false }: SideBarContainerProps) {
|
||||
const { status, data } = useSession();
|
||||
const isStandalone = useIsStandalone();
|
||||
|
||||
// Make sure that Sidebar is rendered optimistically so that a refresh of pages when logged in have SideBar from the beginning.
|
||||
// This improves the experience of refresh on app store pages(when logged in) which are SSG.
|
||||
// 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} />;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useSession } from "next-auth/react";
|
||||
import Link from "next/link";
|
||||
|
||||
import { useIsEmbed } from "@calcom/embed-core/embed-iframe";
|
||||
import { useIsStandalone } from "@calcom/lib/hooks/useIsStandalone";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { Icon } from "@calcom/ui/components/icon";
|
||||
import { Logo } from "@calcom/ui/components/logo";
|
||||
@@ -11,7 +12,8 @@ import { UserDropdown } from "./user-dropdown/UserDropdown";
|
||||
|
||||
export function TopNavContainer() {
|
||||
const { status } = useSession();
|
||||
if (status !== "authenticated") return null;
|
||||
const isStandalone = useIsStandalone();
|
||||
if (status !== "authenticated" || isStandalone) return null;
|
||||
return <TopNav />;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
useOrgBranding,
|
||||
type OrganizationBranding,
|
||||
} from "@calcom/features/ee/organizations/context/provider";
|
||||
import { useIsStandalone } from "@calcom/lib/hooks/useIsStandalone";
|
||||
import classNames from "@calcom/ui/classNames";
|
||||
import { useHasPaidPlan } from "@calcom/web/modules/billing/hooks/useHasPaidPlan";
|
||||
|
||||
@@ -230,7 +231,8 @@ export function MobileNavigationContainer({
|
||||
isPlatformNavigation?: boolean;
|
||||
}) {
|
||||
const { status } = useSession();
|
||||
if (status !== "authenticated") return null;
|
||||
const isStandalone = useIsStandalone();
|
||||
if (status !== "authenticated" || isStandalone) return null;
|
||||
return <MobileNavigation isPlatformNavigation={isPlatformNavigation} />;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user