diff --git a/apps/meteor/client/components/GenericCard/GenericCard.tsx b/apps/meteor/client/components/GenericCard/GenericCard.tsx index 007c7da9f15e8..335b8e6be959c 100644 --- a/apps/meteor/client/components/GenericCard/GenericCard.tsx +++ b/apps/meteor/client/components/GenericCard/GenericCard.tsx @@ -1,6 +1,5 @@ -import { Card, CardTitle, CardBody, CardControls, CardHeader } from '@rocket.chat/fuselage'; +import { Card, CardTitle, CardBody, CardControls, CardHeader, FramedIcon } from '@rocket.chat/fuselage'; import { useUniqueId } from '@rocket.chat/fuselage-hooks'; -import { FramedIcon } from '@rocket.chat/ui-client'; import type { ComponentProps, ReactElement } from 'react'; import React from 'react'; @@ -11,17 +10,21 @@ type GenericCardProps = { body: string; buttons?: ReactElement[]; icon?: ComponentProps['icon']; - type?: ComponentProps['type']; + type?: 'info' | 'success' | 'warning' | 'danger' | 'neutral'; } & ComponentProps; export const GenericCard: React.FC = ({ title, body, buttons, icon, type, ...props }) => { const cardId = useUniqueId(); const descriptionId = useUniqueId(); + const iconType = type && { + [type]: true, + }; + return ( - {icon && } + {icon && } {title} {body} diff --git a/apps/meteor/client/views/admin/subscription/components/cards/FeaturesCard.tsx b/apps/meteor/client/views/admin/subscription/components/cards/FeaturesCard.tsx index fbd70a844bdd3..8af99de7d38cc 100644 --- a/apps/meteor/client/views/admin/subscription/components/cards/FeaturesCard.tsx +++ b/apps/meteor/client/views/admin/subscription/components/cards/FeaturesCard.tsx @@ -1,6 +1,5 @@ -import { Box, Card, CardBody, CardControls, CardTitle } from '@rocket.chat/fuselage'; +import { Box, Card, CardBody, CardControls, CardTitle, FramedIcon } from '@rocket.chat/fuselage'; import { useMediaQuery } from '@rocket.chat/fuselage-hooks'; -import { FramedIcon } from '@rocket.chat/ui-client'; import type { ReactElement } from 'react'; import React from 'react'; import { useTranslation } from 'react-i18next'; @@ -9,7 +8,8 @@ import { PRICING_LINK } from '../../utils/links'; import InfoTextIconModal from '../InfoTextIconModal'; type FeatureSet = { - type: 'neutral' | 'success'; + success?: boolean; + neutral?: boolean; title: string; infoText?: string; }; @@ -19,68 +19,59 @@ type FeaturesCardProps = { isEnterprise: boolean; }; +const getFeatureSet = (modules: string[], isEnterprise: boolean): FeatureSet[] => { + const featureSet: FeatureSet[] = [ + { + success: isEnterprise, + title: 'Premium_and_unlimited_apps', + }, + { + success: isEnterprise, + title: 'Premium_omnichannel_capabilities', + }, + { + success: isEnterprise, + title: 'Unlimited_push_notifications', + }, + { + success: modules.includes('videoconference-enterprise'), + title: 'Video_call_manager', + }, + { + success: modules.includes('hide-watermark'), + title: 'Remove_RocketChat_Watermark', + infoText: 'Remove_RocketChat_Watermark_InfoText', + }, + { + success: modules.includes('scalability'), + title: 'High_scalabaility', + }, + { + success: modules.includes('custom-roles'), + title: 'Custom_roles', + }, + { + success: modules.includes('auditing'), + title: 'Message_audit', + }, + ]; + + // eslint-disable-next-line no-nested-ternary + return featureSet.sort(({ success: a }, { success: b }) => (a === b ? 0 : a ? -1 : 1)); +}; + const FeaturesCard = ({ activeModules, isEnterprise }: FeaturesCardProps): ReactElement => { const { t } = useTranslation(); const isSmall = useMediaQuery('(min-width: 1180px)'); - const getFeatureSet = (modules: string[], isEnterprise: boolean): FeatureSet[] => { - const featureSet: FeatureSet[] = [ - { - type: isEnterprise ? 'success' : 'neutral', - title: 'Premium_and_unlimited_apps', - }, - { - type: isEnterprise ? 'success' : 'neutral', - title: 'Premium_omnichannel_capabilities', - }, - { - type: isEnterprise ? 'success' : 'neutral', - title: 'Unlimited_push_notifications', - }, - { - type: modules.includes('videoconference-enterprise') ? 'success' : 'neutral', - title: 'Video_call_manager', - }, - { - type: modules.includes('hide-watermark') ? 'success' : 'neutral', - title: 'Remove_RocketChat_Watermark', - infoText: 'Remove_RocketChat_Watermark_InfoText', - }, - { - type: modules.includes('scalability') ? 'success' : 'neutral', - title: 'High_scalabaility', - }, - { - type: modules.includes('custom-roles') ? 'success' : 'neutral', - title: 'Custom_roles', - }, - { - type: modules.includes('auditing') ? 'success' : 'neutral', - title: 'Message_audit', - }, - ]; - - const sortedFeatureSet = featureSet.sort((a, b) => { - if (a.type === 'success' && b.type !== 'success') { - return -1; - } - if (a.type !== 'success' && b.type === 'success') { - return 1; - } - return featureSet.indexOf(a) - featureSet.indexOf(b); - }); - - return sortedFeatureSet; - }; - return ( {!isEnterprise ? t('Unlock_premium_capabilities') : t('Includes')} - {getFeatureSet(activeModules, isEnterprise).map(({ type, title, infoText }, index) => ( + {getFeatureSet(activeModules, isEnterprise).map(({ success, title, infoText }, index) => ( - + {t(title)} diff --git a/apps/meteor/client/views/admin/workspace/UsersUploadsCard/UsersUploadsCard.tsx b/apps/meteor/client/views/admin/workspace/UsersUploadsCard/UsersUploadsCard.tsx index c3e239c22b8e0..3298f38b0f114 100644 --- a/apps/meteor/client/views/admin/workspace/UsersUploadsCard/UsersUploadsCard.tsx +++ b/apps/meteor/client/views/admin/workspace/UsersUploadsCard/UsersUploadsCard.tsx @@ -1,5 +1,5 @@ import type { IStats } from '@rocket.chat/core-typings'; -import { Button, Card, CardControls } from '@rocket.chat/fuselage'; +import { Button, Card, CardBody, CardControls } from '@rocket.chat/fuselage'; import { useMutableCallback } from '@rocket.chat/fuselage-hooks'; import { useRouter, useTranslation } from '@rocket.chat/ui-contexts'; import type { ReactElement } from 'react'; @@ -28,41 +28,43 @@ const UsersUploadsCard = ({ statistics }: UsersUploadsCardProps): ReactElement = return ( - - - - - - - - } - /> + + + + + + + + + } + /> - - - - - - - - } - /> + + + + + + + + } + /> - - - - - } - /> + + + + + } + /> +