mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-04 19:24:53 -05:00
2a725b3a26
Tear down project-share-modal-paywall split test GitOrigin-RevId: b85e6cdf2243a76d071607e55a33f9909f704b76
64 lines
1.8 KiB
TypeScript
64 lines
1.8 KiB
TypeScript
import EditMember from './edit-member'
|
|
import LinkSharing from './link-sharing'
|
|
import Invite from './invite'
|
|
import SendInvites from './send-invites'
|
|
import ViewMember from './view-member'
|
|
import OwnerInfo from './owner-info'
|
|
import SendInvitesNotice from './send-invites-notice'
|
|
import { useEditorContext } from '../../../shared/context/editor-context'
|
|
import { useProjectContext } from '../../../shared/context/project-context'
|
|
import { useMemo } from 'react'
|
|
import RecaptchaConditions from '../../../shared/components/recaptcha-conditions'
|
|
|
|
export default function ShareModalBody() {
|
|
const { members, invites, features } = useProjectContext()
|
|
const { isProjectOwner } = useEditorContext()
|
|
|
|
// whether the project has not reached the collaborator limit
|
|
const canAddCollaborators = useMemo(() => {
|
|
if (!isProjectOwner || !features) {
|
|
return false
|
|
}
|
|
|
|
if (features.collaborators === -1) {
|
|
// infinite collaborators
|
|
return true
|
|
}
|
|
|
|
return members.length + invites.length < (features.collaborators ?? 1)
|
|
}, [members, invites, features, isProjectOwner])
|
|
|
|
return (
|
|
<>
|
|
{isProjectOwner && <LinkSharing />}
|
|
|
|
<OwnerInfo />
|
|
|
|
{members.map(member =>
|
|
isProjectOwner ? (
|
|
<EditMember key={member._id} member={member} />
|
|
) : (
|
|
<ViewMember key={member._id} member={member} />
|
|
)
|
|
)}
|
|
|
|
{invites.map(invite => (
|
|
<Invite
|
|
key={invite._id}
|
|
invite={invite}
|
|
isProjectOwner={isProjectOwner}
|
|
/>
|
|
))}
|
|
|
|
{isProjectOwner ? (
|
|
<SendInvites canAddCollaborators={canAddCollaborators} />
|
|
) : (
|
|
<SendInvitesNotice />
|
|
)}
|
|
|
|
{!window.ExposedSettings.recaptchaDisabled?.invite && (
|
|
<RecaptchaConditions />
|
|
)}
|
|
</>
|
|
)
|
|
}
|