Skip to content

Commit

Permalink
Merge branch 'develop' into omnichannel/chats-onHold-action-consolida…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
kodiakhq[bot] authored Nov 1, 2023
2 parents 475afa1 + 1f59e40 commit a4857b1
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions apps/meteor/client/components/PlanTag.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
import { Box, Tag } from '@rocket.chat/fuselage';
import type { ReactElement } from 'react';
import React, { useEffect, useState } from 'react';
import React from 'react';

import { isTruthy } from '../../lib/isTruthy';
import { useIsEnterprise } from '../hooks/useIsEnterprise';
import { useLicense } from '../hooks/useLicense';

function PlanTag(): ReactElement {
const [plans, setPlans] = useState<string[]>([]);
const developmentTag = process.env.NODE_ENV === 'development' ? 'Development' : null;
function PlanTag() {
const license = useLicense();

const { data } = useIsEnterprise();

useEffect(() => {
const developmentTag = process.env.NODE_ENV === 'development' ? 'Development' : null;
const enterpriseTag = data?.isEnterprise ? 'Enterprise' : null;

setPlans([developmentTag, enterpriseTag].filter(isTruthy));
}, [setPlans, data?.isEnterprise]);
const tags = [
developmentTag && { name: developmentTag },
...(license.data?.tags ?? []),
!license.isLoading && !license.isError && !license.data?.license && { name: 'Community' },
].filter(isTruthy);

return (
<>
{plans.map((name) => (
{tags.map(({ name }) => (
<Box marginInline={4} display='inline-block' verticalAlign='middle' key={name}>
<Tag variant='primary'>{name}</Tag>
</Box>
Expand Down

0 comments on commit a4857b1

Please sign in to comment.