|
@@ -2,7 +2,6 @@ import { Button, Modal, Grid } from 'react-bootstrap'
|
|
|
import { useTranslation } from 'react-i18next'
|
|
import { useTranslation } from 'react-i18next'
|
|
|
import Icon from '../../../shared/components/icon'
|
|
import Icon from '../../../shared/components/icon'
|
|
|
import AccessibleModal from '../../../shared/components/accessible-modal'
|
|
import AccessibleModal from '../../../shared/components/accessible-modal'
|
|
|
-import PropTypes from 'prop-types'
|
|
|
|
|
import { useEditorContext } from '../../../shared/context/editor-context'
|
|
import { useEditorContext } from '../../../shared/context/editor-context'
|
|
|
import { lazy, Suspense } from 'react'
|
|
import { lazy, Suspense } from 'react'
|
|
|
import { FullSizeLoadingSpinner } from '@/shared/components/loading-spinner'
|
|
import { FullSizeLoadingSpinner } from '@/shared/components/loading-spinner'
|
|
@@ -16,18 +15,24 @@ const ReadOnlyTokenLink = lazy(() =>
|
|
|
|
|
|
|
|
const ShareModalBody = lazy(() => import('./share-modal-body'))
|
|
const ShareModalBody = lazy(() => import('./share-modal-body'))
|
|
|
|
|
|
|
|
|
|
+type ShareProjectModalContentProps = {
|
|
|
|
|
+ cancel: () => void
|
|
|
|
|
+ show: boolean
|
|
|
|
|
+ animation: boolean
|
|
|
|
|
+ inFlight: boolean
|
|
|
|
|
+ error: string | undefined
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
export default function ShareProjectModalContent({
|
|
export default function ShareProjectModalContent({
|
|
|
show,
|
|
show,
|
|
|
cancel,
|
|
cancel,
|
|
|
animation,
|
|
animation,
|
|
|
inFlight,
|
|
inFlight,
|
|
|
error,
|
|
error,
|
|
|
-}) {
|
|
|
|
|
|
|
+}: ShareProjectModalContentProps) {
|
|
|
const { t } = useTranslation()
|
|
const { t } = useTranslation()
|
|
|
|
|
|
|
|
- const { isRestrictedTokenMember } = useEditorContext({
|
|
|
|
|
- isRestrictedTokenMember: PropTypes.bool,
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ const { isRestrictedTokenMember } = useEditorContext()
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<AccessibleModal show={show} onHide={cancel} animation={animation}>
|
|
<AccessibleModal show={show} onHide={cancel} animation={animation}>
|
|
@@ -72,37 +77,26 @@ export default function ShareProjectModalContent({
|
|
|
</AccessibleModal>
|
|
</AccessibleModal>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
-ShareProjectModalContent.propTypes = {
|
|
|
|
|
- cancel: PropTypes.func.isRequired,
|
|
|
|
|
- show: PropTypes.bool,
|
|
|
|
|
- animation: PropTypes.bool,
|
|
|
|
|
- inFlight: PropTypes.bool,
|
|
|
|
|
- error: PropTypes.string,
|
|
|
|
|
-}
|
|
|
|
|
|
|
|
|
|
-function ErrorMessage({ error }) {
|
|
|
|
|
|
|
+function ErrorMessage({ error }: Pick<ShareProjectModalContentProps, 'error'>) {
|
|
|
const { t } = useTranslation()
|
|
const { t } = useTranslation()
|
|
|
-
|
|
|
|
|
switch (error) {
|
|
switch (error) {
|
|
|
case 'cannot_invite_non_user':
|
|
case 'cannot_invite_non_user':
|
|
|
- return t('cannot_invite_non_user')
|
|
|
|
|
|
|
+ return <>{t('cannot_invite_non_user')}</>
|
|
|
|
|
|
|
|
case 'cannot_verify_user_not_robot':
|
|
case 'cannot_verify_user_not_robot':
|
|
|
- return t('cannot_verify_user_not_robot')
|
|
|
|
|
|
|
+ return <>{t('cannot_verify_user_not_robot')}</>
|
|
|
|
|
|
|
|
case 'cannot_invite_self':
|
|
case 'cannot_invite_self':
|
|
|
- return t('cannot_invite_self')
|
|
|
|
|
|
|
+ return <>{t('cannot_invite_self')}</>
|
|
|
|
|
|
|
|
case 'invalid_email':
|
|
case 'invalid_email':
|
|
|
- return t('invalid_email')
|
|
|
|
|
|
|
+ return <>{t('invalid_email')}</>
|
|
|
|
|
|
|
|
case 'too_many_requests':
|
|
case 'too_many_requests':
|
|
|
- return t('too_many_requests')
|
|
|
|
|
|
|
+ return <>{t('too_many_requests')}</>
|
|
|
|
|
|
|
|
default:
|
|
default:
|
|
|
- return t('generic_something_went_wrong')
|
|
|
|
|
|
|
+ return <>{t('generic_something_went_wrong')}</>
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-ErrorMessage.propTypes = {
|
|
|
|
|
- error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]).isRequired,
|
|
|
|
|
-}
|
|
|