overleaf/services/web/frontend/js/features/settings/components/root.tsx
Jimmy Domagala-Tang e5aa917f54 Merge pull request #18682 from overleaf/jdt-ai-labs
Re-Release Labs Page for AI Error-Correction

GitOrigin-RevId: 2eef85dd3b5f86bedcf3339559a5fbbae2d4da87
2024-06-24 12:04:08 +00:00

100 lines
3 KiB
TypeScript

import SecuritySection from '@/features/settings/components/security-section'
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'
import ManagedAccountAlert from './managed-account-alert'
import PasswordSection from './password-section'
import LinkingSection from './linking-section'
import BetaProgramSection from './beta-program-section'
import LabsProgramSection from './labs-program-section'
import SessionsSection from './sessions-section'
import NewsletterSection from './newsletter-section'
import LeaveSection from './leave-section'
import * as eventTracking from '../../../infrastructure/event-tracking'
import { UserProvider } from '../../../shared/context/user-context'
import { SSOProvider } from '../context/sso-context'
import { SplitTestProvider } from '@/shared/context/split-test-context'
import useWaitForI18n from '../../../shared/hooks/use-wait-for-i18n'
import useScrollToIdOnLoad from '../../../shared/hooks/use-scroll-to-id-on-load'
import { SSOAlert } from './emails/sso-alert'
import OLRow from '@/features/ui/components/ol/ol-row'
import OLCol from '@/features/ui/components/ol/ol-col'
import OLCard from '@/features/ui/components/ol/ol-card'
function SettingsPageRoot() {
const { isReady } = useWaitForI18n()
useScrollToIdOnLoad()
useEffect(() => {
eventTracking.sendMB('settings-view')
}, [])
return (
<div className="container">
<OLRow>
<OLCol xl={{ span: 10, offset: 1 }}>
{isReady ? <SettingsPageContent /> : null}
</OLCol>
</OLRow>
</div>
)
}
function SettingsPageContent() {
const { t } = useTranslation()
const { isOverleaf, labsEnabled } = getMeta('ol-ExposedSettings')
return (
<UserProvider>
<OLCard>
<div className="page-header">
<h1>{t('account_settings')}</h1>
</div>
<div>
<ManagedAccountAlert />
<EmailsSection />
<SSOAlert />
<OLRow>
<OLCol lg={5}>
<AccountInfoSection />
</OLCol>
<OLCol lg={{ span: 5, offset: 1 }}>
<PasswordSection />
</OLCol>
</OLRow>
<hr />
<SecuritySection />
<SplitTestProvider>
<SSOProvider>
<LinkingSection />
</SSOProvider>
</SplitTestProvider>
{isOverleaf ? (
<>
<BetaProgramSection />
<hr />
</>
) : null}
{labsEnabled ? (
<>
<LabsProgramSection />
</>
) : null}
<SessionsSection />
{isOverleaf ? (
<>
<hr />
<NewsletterSection />
<hr />
<LeaveSection />
</>
) : null}
</div>
</OLCard>
</UserProvider>
)
}
export default SettingsPageRoot