Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regression: missing link in AppsUsageCard info #33571

Merged
merged 8 commits into from
Oct 17, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import React from 'react';

import { PRICING_LINK } from '../../../utils/links';
import AppsUsageCard from './AppsUsageCard';

const appRoot = mockAppRoot().withTranslations('en', 'core', {
Expand Down Expand Up @@ -36,9 +37,7 @@ it('should render data as progress bars', async () => {

await userEvent.click(screen.getByRole('button', { name: 'Click_here_for_more_info' }));

expect(
screen.getByText('Community workspaces can enable up to 5 marketplace apps. Private apps can only be enabled in premium plans.'),
).toBeInTheDocument();
expect(screen.getByRole('link', { name: 'premium plans' })).toHaveAttribute('href', PRICING_LINK);
});

it('should render an upgrade button if marketplace apps reached 80% of the limit', async () => {
Expand All @@ -54,9 +53,7 @@ it('should render an upgrade button if marketplace apps reached 80% of the limit

await userEvent.click(screen.getByRole('button', { name: 'Click_here_for_more_info' }));

expect(
screen.getByText('Community workspaces can enable up to 5 marketplace apps. Private apps can only be enabled in premium plans.'),
).toBeInTheDocument();
expect(screen.getByRole('link', { name: 'premium plans' })).toHaveAttribute('href', PRICING_LINK);
});

it('should render a full progress bar with private apps disabled', async () => {
Expand All @@ -78,7 +75,5 @@ it('should render a full progress bar with private apps disabled', async () => {

await userEvent.click(screen.getByRole('button', { name: 'Click_here_for_more_info' }));

expect(
screen.getByText('Community workspaces can enable up to 5 marketplace apps. Private apps can only be enabled in premium plans.'),
).toBeInTheDocument();
expect(screen.getByRole('link', { name: 'premium plans' })).toHaveAttribute('href', PRICING_LINK);
});
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { Box, Skeleton } from '@rocket.chat/fuselage';
import { Skeleton } from '@rocket.chat/fuselage';
import { ExternalLink } from '@rocket.chat/ui-client';
import type { ReactElement } from 'react';
import React from 'react';
import { Trans, useTranslation } from 'react-i18next';

import { PRICING_LINK } from '../../../utils/links';
import type { CardProps } from '../../FeatureUsageCard';
import FeatureUsageCard from '../../FeatureUsageCard';
import UpgradeButton from '../../UpgradeButton';
Expand Down Expand Up @@ -41,13 +43,11 @@ const AppsUsageCard = ({ privateAppsLimit, marketplaceAppsLimit }: AppsUsageCard
const card: CardProps = {
title: t('Apps'),
infoText: (
<Trans i18nKey='Apps_InfoText_limited' tOptions={{ marketplaceAppsMaxCount }}>
Community workspaces can enable up to {{ marketplaceAppsMaxCount }} marketplace apps. Private apps can only be enabled in{' '}
<Box is='a' href='https://www.rocket.chat/pricing' target='_blank' color='info'>
premium plans
</Box>
.
</Trans>
<Trans
i18nKey='Apps_InfoText_limited'
values={{ marketplaceAppsMaxCount }}
components={{ 1: <ExternalLink to={PRICING_LINK}>premium plans</ExternalLink> }}
/>
),

...(marketplaceAppsAboveWarning && {
Expand Down
Loading