2022-04-22 09:49:26 -04:00
|
|
|
import { useEffect } from 'react'
|
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
import getMeta from '../../../utils/meta'
|
|
|
|
import EmailsSection from './emails-section'
|
|
|
|
import AccountInfoSection from './account-info-section'
|
2023-07-10 05:21:49 -04:00
|
|
|
import ManagedAccountAlert from './managed-account-alert'
|
2022-04-22 09:49:26 -04:00
|
|
|
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'
|
2022-09-21 06:02:37 -04:00
|
|
|
import LabsProgramSection from './labs-program-section'
|
2022-04-26 11:35:35 -04:00
|
|
|
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-05-11 05:19:27 -04:00
|
|
|
import useScrollToIdOnLoad from '../../../shared/hooks/use-scroll-to-id-on-load'
|
2022-04-26 11:35:35 -04:00
|
|
|
import { ExposedSettings } from '../../../../../types/exposed-settings'
|
2022-05-18 09:46:26 -04:00
|
|
|
import { SSOAlert } from './emails/sso-alert'
|
2022-04-22 09:49:26 -04:00
|
|
|
|
|
|
|
function SettingsPageRoot() {
|
2022-04-26 11:20:00 -04:00
|
|
|
const { isReady } = useWaitForI18n()
|
2022-05-11 05:19:27 -04:00
|
|
|
useScrollToIdOnLoad()
|
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()
|
2022-09-21 06:02:37 -04:00
|
|
|
const { isOverleaf, labsEnabled } = 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
|
|
|
<div className="card">
|
|
|
|
<div className="page-header">
|
|
|
|
<h1>{t('account_settings')}</h1>
|
|
|
|
</div>
|
|
|
|
<div>
|
2023-07-10 05:21:49 -04:00
|
|
|
<ManagedAccountAlert />
|
2022-04-26 11:20:00 -04:00
|
|
|
<EmailsSection />
|
2022-05-18 09:46:26 -04:00
|
|
|
<SSOAlert />
|
2022-04-26 11:20:00 -04:00
|
|
|
<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-09-21 06:02:37 -04:00
|
|
|
{labsEnabled ? (
|
|
|
|
<>
|
|
|
|
<LabsProgramSection />
|
|
|
|
<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
|