-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Premium settings using wrong
Tag
variant in Omnichannel (#34060)
- Loading branch information
1 parent
7855bc3
commit e49c987
Showing
3 changed files
with
52 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@rocket.chat/meteor': patch | ||
--- | ||
|
||
Fixes an issue where premium settings were using the wrong `Tag` variant in Omnichannel Appearance configuration |
18 changes: 9 additions & 9 deletions
18
apps/meteor/client/views/omnichannel/appearance/AppearanceFieldLabel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
import { FieldLabel as BaseFieldLabel, Box, Tag } from '@rocket.chat/fuselage'; | ||
import { FieldLabel, Box, Tag } from '@rocket.chat/fuselage'; | ||
import type { ComponentProps } from 'react'; | ||
import React from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import { useHasLicenseModule } from '../../../hooks/useHasLicenseModule'; | ||
|
||
type FieldLabelProps = ComponentProps<typeof BaseFieldLabel> & { | ||
type AppearanceFieldLabelProps = ComponentProps<typeof FieldLabel> & { | ||
premium?: boolean; | ||
children: string; | ||
}; | ||
|
||
const FieldLabel = ({ children: label, premium = false }: FieldLabelProps) => { | ||
const AppearanceFieldLabel = ({ children, premium = false }: AppearanceFieldLabelProps) => { | ||
const { t } = useTranslation(); | ||
const hasLicense = useHasLicenseModule('livechat-enterprise'); | ||
const shouldDisableEnterprise = premium && !hasLicense; | ||
|
||
if (!shouldDisableEnterprise) { | ||
return <BaseFieldLabel>{label}</BaseFieldLabel>; | ||
return <FieldLabel>{children}</FieldLabel>; | ||
} | ||
|
||
return ( | ||
<BaseFieldLabel> | ||
<FieldLabel> | ||
<Box is='span' mie={4}> | ||
{label} | ||
{children} | ||
</Box> | ||
<Tag variant='primary'>{t('Premium')}</Tag> | ||
</BaseFieldLabel> | ||
<Tag variant='featured'>{t('Premium')}</Tag> | ||
</FieldLabel> | ||
); | ||
}; | ||
|
||
export default FieldLabel; | ||
export default AppearanceFieldLabel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters