mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-14 15:26:00 +08:00
fix: cloud header button is hidden when is license is not active (#2756)
This commit is contained in:
parent
818a984af3
commit
5a81f5f90b
@ -8,6 +8,7 @@ import { Logout } from 'api/utils';
|
||||
import ROUTES from 'constants/routes';
|
||||
import Config from 'container/ConfigDropdown';
|
||||
import { useIsDarkMode, useThemeMode } from 'hooks/useDarkMode';
|
||||
import useLicense, { LICENSE_PLAN_STATUS } from 'hooks/useLicense';
|
||||
import {
|
||||
Dispatch,
|
||||
KeyboardEvent,
|
||||
@ -95,6 +96,11 @@ function HeaderContainer(): JSX.Element {
|
||||
);
|
||||
};
|
||||
|
||||
const { data } = useLicense();
|
||||
|
||||
const isLicenseActive =
|
||||
data?.payload?.find((e) => e.isCurrent)?.status === LICENSE_PLAN_STATUS.VALID;
|
||||
|
||||
return (
|
||||
<Header>
|
||||
<Container>
|
||||
@ -111,9 +117,11 @@ function HeaderContainer(): JSX.Element {
|
||||
</NavLink>
|
||||
|
||||
<Space size="middle" align="center">
|
||||
<Button onClick={onClickSignozCloud} type="primary">
|
||||
Try Signoz Cloud
|
||||
</Button>
|
||||
{!isLicenseActive && (
|
||||
<Button onClick={onClickSignozCloud} type="primary">
|
||||
Try Signoz Cloud
|
||||
</Button>
|
||||
)}
|
||||
|
||||
<Config frontendId="tooltip" />
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
export const LICENSE_PLAN_KEY = {
|
||||
ENTERPRISE_PLAN: 'ENTERPRISE_PLAN',
|
||||
};
|
||||
|
||||
export const LICENSE_PLAN_STATUS = {
|
||||
VALID: 'VALID',
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { LICENSE_PLAN_KEY } from './constant';
|
||||
import { LICENSE_PLAN_KEY, LICENSE_PLAN_STATUS } from './constant';
|
||||
import useLicense from './useLicense';
|
||||
|
||||
export default useLicense;
|
||||
|
||||
export { LICENSE_PLAN_KEY };
|
||||
export { LICENSE_PLAN_KEY, LICENSE_PLAN_STATUS };
|
||||
|
Loading…
x
Reference in New Issue
Block a user