feat: marketplace add-on components (#33483)
Co-authored-by: Douglas Gubert <1810309+d-gubert@users.noreply.github.com> Co-authored-by: Tasso Evangelista <2263066+tassoevan@users.noreply.github.com>pull/33673/head
parent
42143e27db
commit
e3dac4aab6
@ -0,0 +1,6 @@ |
||||
--- |
||||
"@rocket.chat/meteor": feat |
||||
"@rocket.chat/i18n": feat |
||||
--- |
||||
|
||||
Introduces new visual components into marketplace pages to inform an add-on necessity into the workspace. |
||||
@ -0,0 +1,24 @@ |
||||
import type { App } from '@rocket.chat/core-typings'; |
||||
import { Tag } from '@rocket.chat/fuselage'; |
||||
import React from 'react'; |
||||
import { useTranslation } from 'react-i18next'; |
||||
|
||||
type AddonChipProps = { |
||||
app: App; |
||||
}; |
||||
|
||||
const AddonChip = ({ app }: AddonChipProps) => { |
||||
const { t } = useTranslation(); |
||||
|
||||
if (!app.addon) { |
||||
return null; |
||||
} |
||||
|
||||
return ( |
||||
<Tag variant='secondary' title={t('Requires_subscription_add-on')}> |
||||
{t('Add-on')} |
||||
</Tag> |
||||
); |
||||
}; |
||||
|
||||
export default AddonChip; |
||||
@ -0,0 +1,42 @@ |
||||
import { Button, Modal } from '@rocket.chat/fuselage'; |
||||
import React from 'react'; |
||||
import { useTranslation } from 'react-i18next'; |
||||
|
||||
import { useExternalLink } from '../../../hooks/useExternalLink'; |
||||
import { GET_ADDONS_LINK } from '../../admin/subscription/utils/links'; |
||||
|
||||
export type AddonActionType = 'install' | 'enable'; |
||||
|
||||
type AddonRequiredModalProps = { |
||||
actionType: AddonActionType; |
||||
onDismiss: () => void; |
||||
onInstallAnyway: () => void; |
||||
}; |
||||
|
||||
const AddonRequiredModal = ({ actionType, onDismiss, onInstallAnyway }: AddonRequiredModalProps) => { |
||||
const { t } = useTranslation(); |
||||
|
||||
const handleOpenLink = useExternalLink(); |
||||
|
||||
return ( |
||||
<Modal> |
||||
<Modal.Header> |
||||
<Modal.HeaderText> |
||||
<Modal.Title>{t('Add-on_required')}</Modal.Title> |
||||
</Modal.HeaderText> |
||||
<Modal.Close onClick={onDismiss} /> |
||||
</Modal.Header> |
||||
<Modal.Content>{t('Add-on_required_modal_enable_content')}</Modal.Content> |
||||
<Modal.Footer> |
||||
<Modal.FooterControllers> |
||||
{actionType === 'install' && <Button onClick={onInstallAnyway}>{t('Install_anyway')}</Button>} |
||||
<Button primary onClick={() => handleOpenLink(GET_ADDONS_LINK)}> |
||||
{t('Contact_sales')} |
||||
</Button> |
||||
</Modal.FooterControllers> |
||||
</Modal.Footer> |
||||
</Modal> |
||||
); |
||||
}; |
||||
|
||||
export default AddonRequiredModal; |
||||
Loading…
Reference in new issue