* Remove icons folder * Create folders for badge, button, and dropdown components * Remove Bootstrap 5 from test * Rename `getBootstrap5Breakpoint` to `getBootstrapBreakpoint` * Cleanup and update BS 5 comments * Move components to the shared folder * Rename `tooltips-bs5` to `tooltip` * Remove `-bs5` suffix * Fix path * Delete BS3 version file * Rename `_form_marketing-bootstrap-5` to `_form_marketing` * Delete BS3 version file * Rename `_contact_general_modal-marketing-bootstrap-5` to `_contact_general_modal-marketing` * Delete BS3 version file * Rename `_contact_modal-marketing-bootstrap-5` to `_contact_modal-marketing` * Delete BS3 version file * Rename `thin-footer-bootstrap-5` to `thin-footer` * Delete BS3 version file * Rename `language-picker-bootstrap-5` to `language-picker` * Rename `fat-footer-react-bootstrap-5` to `fat-footer-react` * Delete BS3 version file * Rename `navbar-marketing-bootstrap-5` to `navbar-marketing` * Rename `navbar-marketing-react-bootstrap-5` to `navbar-marketing-react` * Delete BS3 version file * Rename `layout-website-redesign-cms-bootstrap-5` to `layout-website-redesign-cms` * Source format * Fix path GitOrigin-RevId: cf0f5db7c84cf545c69213dcc271d9ff17fe5db7
99 lines
3.0 KiB
TypeScript
99 lines
3.0 KiB
TypeScript
import useWaitForI18n from '@/shared/hooks/use-wait-for-i18n'
|
|
import getMeta from '@/utils/meta'
|
|
import HasIndividualRecurlySubscription from './has-individual-recurly-subscription'
|
|
import { useEffect, useState } from 'react'
|
|
import { useTranslation, Trans } from 'react-i18next'
|
|
import ManagedUserCannotJoin from './managed-user-cannot-join'
|
|
import Notification from '@/shared/components/notification'
|
|
import JoinGroup from './join-group'
|
|
import AcceptedInvite from './accepted-invite'
|
|
import OLRow from '@/shared/components/ol/ol-row'
|
|
import OLCol from '@/shared/components/ol/ol-col'
|
|
import OLPageContentCard from '@/shared/components/ol/ol-page-content-card'
|
|
|
|
export type InviteViewTypes =
|
|
| 'invite'
|
|
| 'invite-accepted'
|
|
| 'cancel-personal-subscription'
|
|
| 'managed-user-cannot-join'
|
|
| undefined
|
|
|
|
function GroupInviteViews() {
|
|
const hasIndividualPaidSubscription = getMeta(
|
|
'ol-hasIndividualPaidSubscription'
|
|
)
|
|
const cannotJoinSubscription = getMeta('ol-cannot-join-subscription')
|
|
|
|
useEffect(() => {
|
|
if (cannotJoinSubscription) {
|
|
setView('managed-user-cannot-join')
|
|
} else if (hasIndividualPaidSubscription) {
|
|
setView('cancel-personal-subscription')
|
|
} else {
|
|
setView('invite')
|
|
}
|
|
}, [cannotJoinSubscription, hasIndividualPaidSubscription])
|
|
const [view, setView] = useState<InviteViewTypes>(undefined)
|
|
|
|
if (!view) {
|
|
return null
|
|
}
|
|
|
|
if (view === 'managed-user-cannot-join') {
|
|
return <ManagedUserCannotJoin />
|
|
} else if (view === 'cancel-personal-subscription') {
|
|
return <HasIndividualRecurlySubscription setView={setView} />
|
|
} else if (view === 'invite') {
|
|
return <JoinGroup setView={setView} />
|
|
} else if (view === 'invite-accepted') {
|
|
return <AcceptedInvite />
|
|
}
|
|
|
|
return null
|
|
}
|
|
|
|
export default function GroupInvite() {
|
|
const inviterName = getMeta('ol-inviterName')
|
|
const expired = getMeta('ol-expired')
|
|
const { isReady } = useWaitForI18n()
|
|
const { t } = useTranslation()
|
|
|
|
if (!isReady) {
|
|
return null
|
|
}
|
|
|
|
return (
|
|
<div className="container" id="main-content">
|
|
{expired && (
|
|
<OLRow>
|
|
<OLCol lg={{ span: 8, offset: 2 }}>
|
|
<Notification type="error" content={t('email_link_expired')} />
|
|
</OLCol>
|
|
</OLRow>
|
|
)}
|
|
|
|
<OLRow className="row row-spaced">
|
|
<OLCol lg={{ span: 8, offset: 2 }}>
|
|
<OLPageContentCard>
|
|
<div className="page-header">
|
|
<h1 className="text-center">
|
|
<Trans
|
|
i18nKey="invited_to_group"
|
|
values={{ inviterName }}
|
|
shouldUnescape
|
|
tOptions={{ interpolation: { escapeValue: true } }}
|
|
components={
|
|
/* eslint-disable-next-line react/jsx-key */
|
|
[<span className="team-invite-name" />]
|
|
}
|
|
/>
|
|
</h1>
|
|
</div>
|
|
<GroupInviteViews />
|
|
</OLPageContentCard>
|
|
</OLCol>
|
|
</OLRow>
|
|
</div>
|
|
)
|
|
}
|