import React from 'react' import { Button, Modal, Grid } from 'react-bootstrap' import { Trans } from 'react-i18next' import ShareModalBody from './share-modal-body' import Icon from '../../../shared/components/icon' import AccessibleModal from '../../../shared/components/accessible-modal' import PropTypes from 'prop-types' import { ReadOnlyTokenLink } from './link-sharing' import { useEditorContext } from '../../../shared/context/editor-context' export default function ShareProjectModalContent({ show, cancel, animation, inFlight, error, }) { const { isRestrictedTokenMember } = useEditorContext({ isRestrictedTokenMember: PropTypes.bool, }) return ( {isRestrictedTokenMember ? : } {inFlight && } {error && ( )} ) } ShareProjectModalContent.propTypes = { cancel: PropTypes.func.isRequired, show: PropTypes.bool, animation: PropTypes.bool, inFlight: PropTypes.bool, error: PropTypes.string, } function ErrorMessage({ error }) { switch (error) { case 'cannot_invite_non_user': return case 'cannot_verify_user_not_robot': return case 'cannot_invite_self': return case 'invalid_email': return case 'too_many_requests': return default: return } } ErrorMessage.propTypes = { error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]).isRequired, }