mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-04 01:36:51 -05:00
6319455e91
Strict Project Context GitOrigin-RevId: a0f7f2b3dcb29fbd0102dcb920cf5424a921d583
29 lines
872 B
JavaScript
29 lines
872 B
JavaScript
import { useMemo } from 'react'
|
|
import { Row } from 'react-bootstrap'
|
|
import AddCollaborators from './add-collaborators'
|
|
import AddCollaboratorsUpgrade from './add-collaborators-upgrade'
|
|
import { useProjectContext } from '../../../shared/context/project-context'
|
|
|
|
export default function SendInvites() {
|
|
const { members, invites, features } = useProjectContext()
|
|
|
|
// whether the project has not reached the collaborator limit
|
|
const canAddCollaborators = useMemo(() => {
|
|
if (!features) {
|
|
return false
|
|
}
|
|
|
|
if (features.collaborators === -1) {
|
|
// infinite collaborators
|
|
return true
|
|
}
|
|
|
|
return members.length + invites.length < features.collaborators
|
|
}, [members, invites, features])
|
|
|
|
return (
|
|
<Row className="invite-controls">
|
|
{canAddCollaborators ? <AddCollaborators /> : <AddCollaboratorsUpgrade />}
|
|
</Row>
|
|
)
|
|
}
|