Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo committed Oct 25, 2023
1 parent 8a617c9 commit 5ca32d5
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions apps/meteor/ee/client/sidebar/footer/SidebarFooterWatermark.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box, Skeleton } from '@rocket.chat/fuselage';
import { Box } from '@rocket.chat/fuselage';
import { useTranslation } from '@rocket.chat/ui-contexts';
import type { ReactElement } from 'react';
import React from 'react';
Expand All @@ -8,28 +8,29 @@ import { useLicense } from '../../../../client/hooks/useLicense';
export const SidebarFooterWatermark = (): ReactElement | null => {
const t = useTranslation();

const { data: { activeModules = [], trial: isTrial = false, tags } = {}, isLoading, isError } = useLicense();
const [{ name: planName }] = tags ?? [{ name: 'Community' }];
const response = useLicense();

const isWatermarkHidden = !isTrial && activeModules.includes('hide-watermark');
if (response.isLoading || response.isError) {
return null;
}

const license = response.data;

if (isWatermarkHidden) {
if (license.activeModules.includes('hide-watermark') && !license.trial) {
return null;
}

const [{ name: planName }] = license.tags ?? [{ name: 'Community' }];

return (
<Box pi={16} pbe={8}>
<Box is='a' href='https://rocket.chat/' target='_blank' rel='noopener noreferrer'>
<Box fontScale='micro' color='hint' pbe={4}>
{t('Powered_by_RocketChat')}
</Box>
{isLoading || isError ? (
<Skeleton width='5rem' height='1rem' />
) : (
<Box fontScale='micro' color='pure-white' pbe={4}>
{planName} {isTrial ? 'trial' : ''}
</Box>
)}
<Box fontScale='micro' color='pure-white' pbe={4}>
{[planName, license.trial ? 'trial' : ''].filter(Boolean).join(' ')}
</Box>
</Box>
</Box>
);
Expand Down

0 comments on commit 5ca32d5

Please sign in to comment.