remove-sharing-links-modal.tsx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import { useTranslation } from 'react-i18next'
  2. import {
  3. OLModal,
  4. OLModalBody,
  5. OLModalFooter,
  6. OLModalHeader,
  7. OLModalTitle,
  8. } from '@/shared/components/ol/ol-modal'
  9. import OLButton from '@/shared/components/ol/ol-button'
  10. import { PendingAccessType } from '@/features/share-project-modal/components/project-access'
  11. type RemoveSharingLinksModalProps = {
  12. pendingAccess: PendingAccessType
  13. onCancel: () => void
  14. onConfirm: () => void
  15. }
  16. function RemoveSharingLinksModal({
  17. pendingAccess,
  18. onCancel,
  19. onConfirm,
  20. }: RemoveSharingLinksModalProps) {
  21. const { t } = useTranslation()
  22. let confirmationModalBodyText = null
  23. if (pendingAccess === 'onlyInvitedPeople') {
  24. confirmationModalBodyText = t(
  25. 'this_change_will_permanently_remove_your_original_links_you_can_still_share_new_link'
  26. )
  27. } else if (
  28. pendingAccess.startsWith('anyoneInXyzWithTheLink') ||
  29. pendingAccess === 'anyoneWithTheLink'
  30. ) {
  31. confirmationModalBodyText = t(
  32. 'this_change_will_permanently_remove_your_original_links_you_need_to_share_the_new_link'
  33. )
  34. }
  35. return (
  36. <OLModal show onHide={onCancel} size="sm" backdrop={false}>
  37. <OLModalHeader>
  38. <OLModalTitle>{t('remove_original_sharing_links')}</OLModalTitle>
  39. </OLModalHeader>
  40. <OLModalBody>{confirmationModalBodyText}</OLModalBody>
  41. <OLModalFooter>
  42. <OLButton variant="secondary" onClick={onCancel}>
  43. {t('cancel')}
  44. </OLButton>
  45. <OLButton variant="danger" onClick={onConfirm}>
  46. {t('remove_original_links')}
  47. </OLButton>
  48. </OLModalFooter>
  49. </OLModal>
  50. )
  51. }
  52. export default RemoveSharingLinksModal