mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 06:03:45 +01:00
* feat: transitioning optimized images from a compile mode to a project level toggle. We still persist it for the proect and between users, and ensure that draft mode does not interact with it (silently disabled while draft mode is on) * feat: cleaning up unused var, tests, and locales * feat: updating copy GitOrigin-RevId: 8010edfab164980f14125739e481d8b512f6b3df
29 lines
1.0 KiB
TypeScript
29 lines
1.0 KiB
TypeScript
import ToggleSetting from '../toggle-setting'
|
|
import getMeta from '../../../../utils/meta'
|
|
import { useTranslation } from 'react-i18next'
|
|
import { useProjectSettingsContext } from '@/features/ide-settings/context/project-settings-context'
|
|
import { usePermissionsContext } from '@/features/ide-react/context/permissions-context'
|
|
import { useSetCompilationSettingWithEvent } from '@/features/ide-settings/hooks/use-set-compilation-setting'
|
|
|
|
export default function OptimizeCompilesSetting() {
|
|
const { t } = useTranslation()
|
|
const png2pdfEnabled = getMeta('ol-canUsePng2Pdf')
|
|
const { png2pdf, setPng2pdf } = useProjectSettingsContext()
|
|
const { write } = usePermissionsContext()
|
|
const changePng2pdf = useSetCompilationSettingWithEvent(
|
|
'optimize-compiles',
|
|
setPng2pdf
|
|
)
|
|
|
|
return png2pdfEnabled ? (
|
|
<ToggleSetting
|
|
id="optimizeCompiles"
|
|
label={t('optimise_images_recommended')}
|
|
description={t('speed_up_compiles_by_reusing_images')}
|
|
disabled={!write}
|
|
checked={png2pdf}
|
|
onChange={changePng2pdf}
|
|
/>
|
|
) : null
|
|
}
|