2022-04-22 09:49:26 -04:00
|
|
|
import { useEffect } from 'react'
|
|
|
|
import { Alert } from 'react-bootstrap'
|
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
import getMeta from '../../../utils/meta'
|
|
|
|
import EmailsSection from './emails-section'
|
|
|
|
import AccountInfoSection from './account-info-section'
|
|
|
|
import PasswordSection from './password-section'
|
2022-04-25 07:04:44 -04:00
|
|
|
import LinkingSection from './linking-section'
|
2022-04-26 11:35:35 -04:00
|
|
|
import BetaProgramSection from './beta-program-section'
|
|
|
|
import SessionsSection from './sessions-section'
|
|
|
|
import NewsletterSection from './newsletter-section'
|
2022-04-22 09:49:26 -04:00
|
|
|
import LeaveSection from './leave-section'
|
|
|
|
import * as eventTracking from '../../../infrastructure/event-tracking'
|
|
|
|
import { UserProvider } from '../../../shared/context/user-context'
|
2022-04-25 07:04:44 -04:00
|
|
|
import { SSOProvider } from '../context/sso-context'
|
2022-04-26 11:20:00 -04:00
|
|
|
import useWaitForI18n from '../../../shared/hooks/use-wait-for-i18n'
|
2022-04-26 11:35:35 -04:00
|
|
|
import { ExposedSettings } from '../../../../../types/exposed-settings'
|
2022-04-22 09:49:26 -04:00
|
|
|
|
|
|
|
function SettingsPageRoot() {
|
2022-04-26 11:20:00 -04:00
|
|
|
const { isReady } = useWaitForI18n()
|
2022-04-22 09:49:26 -04:00
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
eventTracking.sendMB('settings-view')
|
|
|
|
}, [])
|
|
|
|
|
2022-04-26 11:20:00 -04:00
|
|
|
return (
|
|
|
|
<div className="container">
|
|
|
|
<div className="row">
|
|
|
|
<div className="col-md-12 col-lg-10 col-lg-offset-1">
|
|
|
|
{isReady ? <SettingsPageContent /> : null}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
function SettingsPageContent() {
|
|
|
|
const { t } = useTranslation()
|
|
|
|
const ssoError = getMeta('ol-ssoError') as string
|
2022-04-26 11:35:35 -04:00
|
|
|
const { isOverleaf } = getMeta('ol-ExposedSettings') as ExposedSettings
|
2022-04-26 11:20:00 -04:00
|
|
|
|
2022-04-22 09:49:26 -04:00
|
|
|
return (
|
|
|
|
<UserProvider>
|
2022-04-26 11:20:00 -04:00
|
|
|
{ssoError ? (
|
|
|
|
<Alert bsStyle="danger">
|
|
|
|
{t('sso_link_error')}: {t(ssoError)}
|
|
|
|
</Alert>
|
|
|
|
) : null}
|
|
|
|
<div className="card">
|
|
|
|
<div className="page-header">
|
|
|
|
<h1>{t('account_settings')}</h1>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<EmailsSection />
|
|
|
|
<div className="row">
|
|
|
|
<div className="col-md-5">
|
|
|
|
<AccountInfoSection />
|
|
|
|
</div>
|
|
|
|
<div className="col-md-5 col-md-offset-1">
|
|
|
|
<PasswordSection />
|
2022-04-22 09:49:26 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-04-26 11:20:00 -04:00
|
|
|
<hr />
|
|
|
|
<SSOProvider>
|
|
|
|
<LinkingSection />
|
|
|
|
</SSOProvider>
|
2022-04-27 12:13:42 -04:00
|
|
|
{isOverleaf ? (
|
|
|
|
<>
|
|
|
|
<BetaProgramSection />
|
|
|
|
<hr />
|
|
|
|
</>
|
|
|
|
) : null}
|
2022-04-26 11:35:35 -04:00
|
|
|
<SessionsSection />
|
|
|
|
{isOverleaf ? (
|
|
|
|
<>
|
2022-04-27 12:13:42 -04:00
|
|
|
<hr />
|
2022-04-26 11:35:35 -04:00
|
|
|
<NewsletterSection />
|
|
|
|
<hr />
|
|
|
|
<LeaveSection />
|
|
|
|
</>
|
|
|
|
) : null}
|
2022-04-22 09:49:26 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</UserProvider>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default SettingsPageRoot
|