mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-24 17:51:14 +02:00
Show banner for enterprise self-hosted if they violate their license. --------- Co-authored-by: Nuno Góis <github@nunogois.com>
29 lines
863 B
TypeScript
29 lines
863 B
TypeScript
import { Banner } from 'component/banners/Banner/Banner';
|
|
import { useLicenseCheck } from 'hooks/api/getters/useLicense/useLicense';
|
|
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
|
import { BannerVariant } from 'interfaces/banner';
|
|
|
|
export const LicenseBanner = () => {
|
|
const { isEnterprise } = useUiConfig();
|
|
const licenseInfo = useLicenseCheck();
|
|
|
|
// Only for enterprise
|
|
if (
|
|
isEnterprise() &&
|
|
licenseInfo &&
|
|
!licenseInfo.isValid &&
|
|
!licenseInfo.loading &&
|
|
!licenseInfo.error
|
|
) {
|
|
const banner = {
|
|
message:
|
|
licenseInfo.message || 'You have an invalid Unleash license.',
|
|
variant: 'error' as BannerVariant,
|
|
sticky: true,
|
|
};
|
|
|
|
return <Banner key={banner.message} banner={banner} />;
|
|
}
|
|
return null;
|
|
};
|