compiler-setting.tsx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { useProjectSettingsContext } from '@/features/editor-left-menu/context/project-settings-context'
  2. import DropdownSetting from '../dropdown-setting'
  3. import type { Option } from '../dropdown-setting'
  4. import { useTranslation } from 'react-i18next'
  5. import { usePermissionsContext } from '@/features/ide-react/context/permissions-context'
  6. import { ProjectCompiler } from '../../../../../../../types/project-settings'
  7. const OPTIONS: Option<ProjectCompiler>[] = [
  8. {
  9. value: 'pdflatex',
  10. label: 'pdfLaTeX',
  11. },
  12. {
  13. value: 'latex',
  14. label: 'LaTeX',
  15. },
  16. {
  17. value: 'xelatex',
  18. label: 'XeLaTeX',
  19. },
  20. {
  21. value: 'lualatex',
  22. label: 'LuaLaTeX',
  23. },
  24. ]
  25. export default function CompilerSetting() {
  26. const { compiler, setCompiler } = useProjectSettingsContext()
  27. const { t } = useTranslation()
  28. const { write } = usePermissionsContext()
  29. return (
  30. <DropdownSetting
  31. id="compiler"
  32. label={t('compiler')}
  33. description={t('the_latex_engine_used_for_compiling')}
  34. disabled={!write}
  35. options={OPTIONS}
  36. onChange={setCompiler}
  37. value={compiler}
  38. translateOptions="no"
  39. />
  40. )
  41. }