overleaf/services/web/frontend/js/features/share-project-modal/components/share-modal-body.js
Alexandre Bourdin f9873619ad Merge pull request #5769 from overleaf/ab-null-split-tests
Setup null split tests

GitOrigin-RevId: 4cba55e123d0a4add19cdace7434506e9d20c7a9
2021-11-23 09:02:46 +00:00

127 lines
3.4 KiB
JavaScript

import { useShareProjectContext } from './share-project-modal'
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 { useProjectContext } from '../../../shared/context/project-context'
import { useSplitTestContext } from '../../../shared/context/split-test-context'
import { Row } from 'react-bootstrap'
import PropTypes from 'prop-types'
import RecaptchaConditions from '../../../shared/components/recaptcha-conditions'
import * as eventTracking from '../../../infrastructure/event-tracking'
export default function ShareModalBody() {
const { isAdmin } = useShareProjectContext()
const { splitTestVariants } = useSplitTestContext({
splitTestVariants: PropTypes.object,
})
eventTracking.sendMB('share-modal-opened', {
splitTestVariant: splitTestVariants['null-test-share-modal'],
})
const project = useProjectContext()
switch (splitTestVariants['project-share-modal-paywall']) {
case 'new-copy-top':
return (
<>
{isAdmin ? (
<>
<SendInvites />
<Row className="public-access-level" />
</>
) : (
<SendInvitesNotice />
)}
<OwnerInfo />
{project.members.map(member =>
isAdmin ? (
<EditMember key={member._id} member={member} />
) : (
<ViewMember key={member._id} member={member} />
)
)}
{project.invites.map(invite => (
<Invite key={invite._id} invite={invite} isAdmin={isAdmin} />
))}
{isAdmin && (
<>
<br />
<LinkSharing />
</>
)}
{!window.ExposedSettings.recaptchaDisabled?.invite && (
<RecaptchaConditions />
)}
</>
)
case 'new-copy-middle':
return (
<>
<OwnerInfo />
{project.members.map(member =>
isAdmin ? (
<EditMember key={member._id} member={member} />
) : (
<ViewMember key={member._id} member={member} />
)
)}
{project.invites.map(invite => (
<Invite key={invite._id} invite={invite} isAdmin={isAdmin} />
))}
{isAdmin ? <SendInvites /> : <SendInvitesNotice />}
{isAdmin && (
<>
<br />
<LinkSharing />
</>
)}
{!window.ExposedSettings.recaptchaDisabled?.invite && (
<RecaptchaConditions />
)}
</>
)
case 'new-copy-bottom':
case 'default':
default:
return (
<>
{isAdmin && <LinkSharing />}
<OwnerInfo />
{project.members.map(member =>
isAdmin ? (
<EditMember key={member._id} member={member} />
) : (
<ViewMember key={member._id} member={member} />
)
)}
{project.invites.map(invite => (
<Invite key={invite._id} invite={invite} isAdmin={isAdmin} />
))}
{isAdmin ? <SendInvites /> : <SendInvitesNotice />}
{!window.ExposedSettings.recaptchaDisabled?.invite && (
<RecaptchaConditions />
)}
</>
)
}
}