import { Box } from '@rocket.chat/fuselage'; import { useStableCallback } from '@rocket.chat/fuselage-hooks'; import { GenericModal } from '@rocket.chat/ui-client'; import type { ComponentPropsWithoutRef } from 'react'; import { Trans } from 'react-i18next'; export type ConfirmOwnerChangeModalProps = { shouldChangeOwner: string[]; shouldBeRemoved: string[]; contentTitle?: string; } & Pick, 'onConfirm' | 'onCancel' | 'confirmText'>; const ConfirmOwnerChangeModal = ({ shouldChangeOwner, shouldBeRemoved, contentTitle, confirmText, onConfirm, onCancel, }: ConfirmOwnerChangeModalProps) => { const getChangeOwnerRooms = useStableCallback(() => { if (shouldChangeOwner.length === 0) { return ''; } if (shouldChangeOwner.length === 1) { return ( }} /> ); } if (shouldChangeOwner.length <= 5) { return ( , bold: }} /> ); } return ( }} /> ); }); const getRemovedRooms = useStableCallback(() => { if (shouldBeRemoved.length === 0) { return ''; } if (shouldBeRemoved.length === 1) { return ( }} /> ); } if (shouldBeRemoved.length <= 5) { return ( , bold: }} /> ); } return ; }); return ( {contentTitle} {shouldChangeOwner && {getChangeOwnerRooms()}} {shouldBeRemoved && {getRemovedRooms()}} ); }; export default ConfirmOwnerChangeModal;