Skip to content

Commit

Permalink
feat: adapted watermark to support new licenses
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandernsilva committed Sep 22, 2023
1 parent 8753a2d commit 6ad0bc8
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions apps/meteor/ee/client/sidebar/footer/SidebarFooterWatermark.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,26 @@ import { useTranslation } from '@rocket.chat/ui-contexts';
import type { ReactElement } from 'react';
import React from 'react';

import { useIsEnterprise } from '../../../../client/hooks/useIsEnterprise';
import { useLicenseV2 } from '../../../../client/hooks/useLicenseV2';

export const SidebarFooterWatermark = (): ReactElement | null => {
const t = useTranslation();

const { isLoading, isError, data } = useIsEnterprise();
const { isLoading, isError, license } = useLicenseV2();

if (isError || isLoading || data?.isEnterprise) {
if (isError || isLoading) {
return null;
}

const {
grantedModules,
information: {
tags: [firstTag],
},
} = license;
const isWatermarkVisible = grantedModules.find(({ module }) => module === 'rocketchat-watermark'); // TODO: Possibly change to useHasLicenseModule

if (!isWatermarkVisible) {
return null;
}

Expand All @@ -21,7 +33,7 @@ export const SidebarFooterWatermark = (): ReactElement | null => {
{t('Powered_by_RocketChat')}
</Box>
<Box fontScale='micro' color='pure-white' pbe={4}>
{t('Free_Edition')}
{firstTag.name}
</Box>
</Box>
</Box>
Expand Down

0 comments on commit 6ad0bc8

Please sign in to comment.