mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-14 20:40:17 -05:00
d9576189a3
Migrate Share modal to React GitOrigin-RevId: 96a52df6ffd751cfcca2bbb68eb9e7a6dc31ff28
32 lines
870 B
JavaScript
32 lines
870 B
JavaScript
import React, { 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>
|
|
)
|
|
}
|