Merge pull request #19030 from overleaf/dp-presentation-mode-flag

Add separate feature flag for presentation mode

GitOrigin-RevId: a996fa313c101dd822ad83109ba77fa95f99f644
This commit is contained in:
David 2024-06-21 09:39:50 +01:00 committed by Copybot
parent 3d5418611b
commit a8cb423078
2 changed files with 8 additions and 2 deletions

View file

@ -327,6 +327,7 @@ const _ProjectController = {
'pdf-caching-prefetch-large', 'pdf-caching-prefetch-large',
'pdf-caching-prefetching', 'pdf-caching-prefetching',
'pdf-controls', 'pdf-controls',
'pdf-presentation-mode',
'pdfjs-40', 'pdfjs-40',
'personal-access-token', 'personal-access-token',
'revert-file', 'revert-file',

View file

@ -3,6 +3,7 @@ import { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import ControlledDropdown from '@/shared/components/controlled-dropdown' import ControlledDropdown from '@/shared/components/controlled-dropdown'
import classNames from 'classnames' import classNames from 'classnames'
import { useFeatureFlag } from '@/shared/context/split-test-context'
const isMac = /Mac/.test(window.navigator?.platform) const isMac = /Mac/.test(window.navigator?.platform)
@ -37,6 +38,8 @@ function PdfZoomDropdown({
}: PdfZoomDropdownProps) { }: PdfZoomDropdownProps) {
const { t } = useTranslation() const { t } = useTranslation()
const enablePresentationMode = useFeatureFlag('pdf-presentation-mode')
const [customZoomValue, setCustomZoomValue] = useState<string>( const [customZoomValue, setCustomZoomValue] = useState<string>(
rawScaleToPercentage(rawScale) rawScaleToPercentage(rawScale)
) )
@ -45,6 +48,8 @@ function PdfZoomDropdown({
setCustomZoomValue(rawScaleToPercentage(rawScale)) setCustomZoomValue(rawScaleToPercentage(rawScale))
}, [rawScale]) }, [rawScale])
const showPresentOption = enablePresentationMode && document.fullscreenEnabled
return ( return (
<ControlledDropdown <ControlledDropdown
id="pdf-zoom-dropdown" id="pdf-zoom-dropdown"
@ -116,8 +121,8 @@ function PdfZoomDropdown({
<MenuItem draggable={false} key="page-height" eventKey="page-height"> <MenuItem draggable={false} key="page-height" eventKey="page-height">
{t('fit_to_height')} {t('fit_to_height')}
</MenuItem> </MenuItem>
{document.fullscreenEnabled && <MenuItem divider />} {showPresentOption && <MenuItem divider />}
{document.fullscreenEnabled && ( {showPresentOption && (
<MenuItem draggable={false} key="present" eventKey="present"> <MenuItem draggable={false} key="present" eventKey="present">
{t('presentation_mode')} {t('presentation_mode')}
</MenuItem> </MenuItem>