1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-14 00:19:16 +01:00

fix: license banner using message type (#9209)

## About the changes
Actually uses messageType and maps from warn to warning.
This commit is contained in:
Gastón Fournier 2025-02-04 16:14:47 +01:00 committed by GitHub
parent 640db0c057
commit ae65919f92
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 2 deletions

View File

@ -32,8 +32,7 @@ export const LicenseBanner = () => {
if (!license.loading && !license.error && licenseInfo.message) {
const banner = {
message: licenseInfo.message,
variant:
licenseInfo.messageType ?? ('warning' as BannerVariant),
variant: mapToVariant(licenseInfo.messageType),
sticky: true,
};
return <Banner key={banner.message} banner={banner} />;
@ -43,3 +42,15 @@ export const LicenseBanner = () => {
return null;
};
function mapToVariant(
messageType: string | undefined,
): BannerVariant | undefined {
if (messageType) {
switch (messageType) {
case 'warn':
return 'warning';
default:
return messageType as BannerVariant;
}
}
}

View File

@ -43,6 +43,7 @@ export const useLicenseCheck = (): LicenseInfo => {
return {
isValid: data?.isValid,
message: data?.message,
messageType: data?.messageType,
loading: !error && !data,
reCheckLicense: () => mutate(),
error,