Files
overleaf-cep/services/web/frontend/js/features/settings/components/root.tsx
Jimmy Domagala-Tang 75734993e7 Add Notification Preferences Page To User Settings (#30116)
* changing to pug conditional format for admin page conditional render

* feat: update notifications settings page and open BE route

feat: adding new page for notification prefs on user settings, along with updating saving prefs for global preferences

adding error handling and disabling when request is inflight

formatting and adding split test for viewing notification ettings

fix: updating to levels of preferences, and removing global type for preferences as we will now share the same backing settings between global and project preferences

feat: add global mute to user settings for notifications

making params in preferences schema optional

feat: update global settings to only set mute, and remove optional settings

fix: store userId as objectId, and filter based on global mute setting
GitOrigin-RevId: 947a95dc02d12b4a2d8e3cc29bd04c23af2aef25
2026-01-08 09:05:49 +00:00

104 lines
3.2 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 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 '@/shared/components/ol/ol-row'
import OLCol from '@/shared/components/ol/ol-col'
import OLPageContentCard from '@/shared/components/ol/ol-page-content-card'
import { isSplitTestEnabled } from '@/utils/splitTestUtils'
import NotificationsSection from './notifications-section'
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')
const inNotificationsSplitTest = isSplitTestEnabled('email-notifications')
return (
<UserProvider>
<OLPageContentCard>
<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 />
<SSOProvider>
<LinkingSection />
</SSOProvider>
{isOverleaf ? (
<>
<BetaProgramSection />
<hr />
</>
) : null}
{labsEnabled ? (
<>
<LabsProgramSection />
</>
) : null}
<SessionsSection />
{isOverleaf ? (
<>
<hr />
{inNotificationsSplitTest ? (
<NotificationsSection />
) : (
<NewsletterSection />
)}
<hr />
<LeaveSection />
</>
) : null}
</div>
</OLPageContentCard>
</UserProvider>
)
}
export default SettingsPageRoot