From fe14839f1bc1bad605bb452ce47e34a9dcb38689 Mon Sep 17 00:00:00 2001 From: Peer Richelsen Date: Mon, 2 Jan 2023 11:13:27 +0100 Subject: [PATCH] fixed sidebar position, added toHide to (#6228) * fixed sidebar position * fixed sidebar position * fixed sidebar position * removed gradient overlay from user dropdown * added toHide prop to license check to hide a component if a license is available * show children if toHide is true --- .../ee/common/components/v2/LicenseRequired.tsx | 7 ++++++- packages/features/tips/Tips.tsx | 2 +- packages/ui/v2/core/Shell.tsx | 10 ++++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/packages/features/ee/common/components/v2/LicenseRequired.tsx b/packages/features/ee/common/components/v2/LicenseRequired.tsx index 4bf783f25f..12339b700d 100644 --- a/packages/features/ee/common/components/v2/LicenseRequired.tsx +++ b/packages/features/ee/common/components/v2/LicenseRequired.tsx @@ -11,20 +11,25 @@ type LicenseRequiredProps = { className?: string; role?: AriaRole | undefined; children: React.ReactNode; + toHide?: boolean; // if true, the component will be hidden instead of showing the empty screen }; /** * This component will only render it's children if the installation has a valid * license. + * @param toHide - will hide the component with a license instead of showing the empty screen */ -const LicenseRequired = ({ children, as = "", ...rest }: LicenseRequiredProps) => { +const LicenseRequired = ({ children, as = "", toHide = false, ...rest }: LicenseRequiredProps) => { const session = useSession(); const { t } = useLocale(); const Component = as || Fragment; const hasValidLicense = session.data ? session.data.hasValidLicense : null; + return ( {hasValidLicense === null || hasValidLicense ? ( + !toHide && children + ) : toHide ? ( children ) : (