overleaf/services/web/frontend/js/features/share-project-modal/components/send-invites.js
Alf Eaton 7c97f8ab6e Switch to new JSX runtime (#4225)
* Use new JSX runtime and update Babel Node target
* Update .eslintrc
* Remove React imports

GitOrigin-RevId: 559de0267f8f2934c56a860ea8701bb522aa861a
2021-06-24 02:06:59 +00:00

32 lines
863 B
JavaScript

import { useMemo } from 'react'
import { Row } from 'react-bootstrap'
import { useProjectContext } from './share-project-modal'
import AddCollaborators from './add-collaborators'
import AddCollaboratorsUpgrade from './add-collaborators-upgrade'
export default function SendInvites() {
const project = useProjectContext()
// whether the project has not reached the collaborator limit
const canAddCollaborators = useMemo(() => {
if (!project) {
return false
}
if (project.features.collaborators === -1) {
// infinite collaborators
return true
}
return (
project.members.length + project.invites.length <
project.features.collaborators
)
}, [project])
return (
<Row className="invite-controls">
{canAddCollaborators ? <AddCollaborators /> : <AddCollaboratorsUpgrade />}
</Row>
)
}