overleaf/services/web/frontend/js/features/editor-left-menu/components/settings-menu.tsx
Rebeka Dekany f8efc3e2ae Merge pull request #20740 from overleaf/rd-ide-offcanvas
[web] Implement the editor's left menu in Offcanvas

GitOrigin-RevId: 999e995d664b1dc958f56643f05e95b8aa2d6290
2024-10-14 11:09:31 +00:00

64 lines
2.5 KiB
TypeScript

import { useTranslation } from 'react-i18next'
import getMeta from '../../../utils/meta'
import SettingsAutoCloseBrackets from './settings/settings-auto-close-brackets'
import SettingsAutoComplete from './settings/settings-auto-complete'
import SettingsCompiler from './settings/settings-compiler'
import SettingsDictionary from './settings/settings-dictionary'
import SettingsDocument from './settings/settings-document'
import SettingsEditorTheme from './settings/settings-editor-theme'
import SettingsFontFamily from './settings/settings-font-family'
import SettingsFontSize from './settings/settings-font-size'
import SettingsImageName from './settings/settings-image-name'
import SettingsKeybindings from './settings/settings-keybindings'
import SettingsLineHeight from './settings/settings-line-height'
import SettingsOverallTheme from './settings/settings-overall-theme'
import SettingsPdfViewer from './settings/settings-pdf-viewer'
import SettingsSpellCheckLanguage from './settings/settings-spell-check-language'
import SettingsSyntaxValidation from './settings/settings-syntax-validation'
import SettingsMathPreview from './settings/settings-math-preview'
import { useFeatureFlag } from '@/shared/context/split-test-context'
import importOverleafModules from '../../../../macros/import-overleaf-module.macro'
import { ElementType } from 'react'
import OLForm from '@/features/ui/components/ol/ol-form'
const moduleSettings: Array<{
import: { default: ElementType }
path: string
}> = importOverleafModules('settingsEntries')
export default function SettingsMenu() {
const { t } = useTranslation()
const anonymous = getMeta('ol-anonymous')
const enableMathPreview = useFeatureFlag('math-preview')
if (anonymous) {
return null
}
return (
<>
<h4>{t('settings')}</h4>
<OLForm id="left-menu-setting" className="settings">
<SettingsCompiler />
<SettingsImageName />
<SettingsDocument />
<SettingsSpellCheckLanguage />
<SettingsDictionary />
{moduleSettings.map(({ import: { default: Component }, path }) => (
<Component key={path} />
))}
<SettingsAutoComplete />
<SettingsAutoCloseBrackets />
<SettingsSyntaxValidation />
{enableMathPreview && <SettingsMathPreview />}
<SettingsEditorTheme />
<SettingsOverallTheme />
<SettingsKeybindings />
<SettingsFontSize />
<SettingsFontFamily />
<SettingsLineHeight />
<SettingsPdfViewer />
</OLForm>
</>
)
}