import { Button, Modal, Grid } from 'react-bootstrap' import { useTranslation } from 'react-i18next' import Icon from '../../../shared/components/icon' import AccessibleModal from '../../../shared/components/accessible-modal' import { useEditorContext } from '../../../shared/context/editor-context' import { lazy, Suspense } from 'react' import { FullSizeLoadingSpinner } from '@/shared/components/loading-spinner' const ReadOnlyTokenLink = lazy(() => import('./link-sharing').then(({ ReadOnlyTokenLink }) => ({ // re-export as default -- lazy can only handle default exports. default: ReadOnlyTokenLink, })) ) const ShareModalBody = lazy(() => import('./share-modal-body')) type ShareProjectModalContentProps = { cancel: () => void show: boolean animation: boolean inFlight: boolean error: string | undefined } export default function ShareProjectModalContent({ show, cancel, animation, inFlight, error, }: ShareProjectModalContentProps) { const { t } = useTranslation() const { isRestrictedTokenMember } = useEditorContext() return ( {t('share_project')} }> {isRestrictedTokenMember ? ( ) : ( )} {inFlight && } {error && ( )} {t('close')} ) } function ErrorMessage({ error }: Pick) { const { t } = useTranslation() switch (error) { case 'cannot_invite_non_user': return <>{t('cannot_invite_non_user')}> case 'cannot_verify_user_not_robot': return <>{t('cannot_verify_user_not_robot')}> case 'cannot_invite_self': return <>{t('cannot_invite_self')}> case 'invalid_email': return <>{t('invalid_email')}> case 'too_many_requests': return <>{t('too_many_requests')}> default: return <>{t('generic_something_went_wrong')}> } }