import { Trans, useTranslation } from 'react-i18next' import { MemberGroupSubscription } from '../../../../../../types/subscription/dashboard/subscription' import { useSubscriptionDashboardContext } from '../../context/subscription-dashboard-context' import { LEAVE_GROUP_MODAL_ID } from './leave-group-modal' import getMeta from '../../../../utils/meta' import OLButton from '@/features/ui/components/ol/ol-button' type GroupSubscriptionMembershipProps = { subscription: MemberGroupSubscription } export default function GroupSubscriptionMembership({ subscription, }: GroupSubscriptionMembershipProps) { const { t } = useTranslation() const { handleOpenModal, setLeavingGroupId } = useSubscriptionDashboardContext() const leaveGroup = () => { handleOpenModal(LEAVE_GROUP_MODAL_ID) setLeavingGroupId(subscription._id) } // Hide leave group button for managed users const hideLeaveButton = getMeta('ol-cannot-leave-group-subscription') return (

, ]} // eslint-disable-line react/jsx-key, jsx-a11y/anchor-has-content values={{ planName: subscription.planLevelName, groupName: subscription.teamName || '', adminEmail: subscription.admin_id.email, }} shouldUnescape tOptions={{ interpolation: { escapeValue: true } }} />

{subscription.teamNotice && (

{/* Team notice is sanitized in SubscriptionViewModelBuilder */} {subscription.teamNotice}

)} {hideLeaveButton ? ( {' '} {t('need_to_leave')} {t('contact_group_admin')}{' '} ) : ( {t('leave_group')} )}
) }