From d2c4e2894d2cfc4f30a22af3e4a6d26a6fea7635 Mon Sep 17 00:00:00 2001 From: Alex van Andel Date: Thu, 12 Jan 2023 22:11:15 +0000 Subject: [PATCH] Check for session in addition for isPublic prop (#6443) * Check for session in addition for isPublic prop * Cleaner, more readable version * Less code same result, no rerender Co-authored-by: Peer Richelsen Co-authored-by: zomars --- packages/features/shell/Shell.tsx | 32 ++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/packages/features/shell/Shell.tsx b/packages/features/shell/Shell.tsx index 16d03950d5..06f6b7eaf9 100644 --- a/packages/features/shell/Shell.tsx +++ b/packages/features/shell/Shell.tsx @@ -26,18 +26,18 @@ import useMeQuery from "@calcom/trpc/react/hooks/useMeQuery"; import { SVGComponent } from "@calcom/types/SVGComponent"; import { Button, + Credits, Dropdown, DropdownMenuContent, DropdownMenuItem, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuTrigger, - showToast, - Logo, ErrorBoundary, - Credits, HeadSeo, Icon, + Logo, + showToast, SkeletonText, } from "@calcom/ui"; @@ -172,22 +172,28 @@ const CustomBrandingContainer = () => { return ; }; +const KBarWrapper = ({ children, withKBar = false }: { withKBar: boolean; children: React.ReactNode }) => + withKBar ? ( + + {children} + + + ) : ( + <>{children} + ); + export default function Shell(props: LayoutProps) { + const { status } = useSession(); + // if a page is unauthed and isPublic is true, the redirect does not happen. useRedirectToLoginIfUnauthenticated(props.isPublic); useRedirectToOnboardingIfNeeded(); useTheme("light"); - // don't load KBar when unauthed - return props.isPublic ? ( - <> + + return ( + - - ) : ( - - - - - + ); }