Files
Verso/services/web/frontend/js/features/editor-navigation-toolbar/try-new-editor-button.tsx
T
DavidandCopybot af41215058 Merge pull request #29607 from overleaf/dp-redesign-opt-in
Add opt-in for editor redesign

GitOrigin-RevId: 29ec8f4045a6bf29ab26a5ce5bceff70fb3aba6e
2025-11-20 09:05:28 +00:00

37 lines
1.1 KiB
TypeScript

import { useCallback } from 'react'
import OLButton from '../../shared/components/ol/ol-button'
import { useTranslation } from 'react-i18next'
import { useSwitchEnableNewEditorState } from '../ide-redesign/hooks/use-switch-enable-new-editor-state'
import MaterialIcon from '@/shared/components/material-icon'
import { useEditorAnalytics } from '@/shared/hooks/use-editor-analytics'
const TryNewEditorButton = () => {
const { t } = useTranslation()
const { loading, setEditorRedesignStatus } = useSwitchEnableNewEditorState()
const { sendEvent } = useEditorAnalytics()
const onClick = useCallback(() => {
sendEvent('switch-to-new-editor', {
location: 'toolbar',
})
setEditorRedesignStatus(true)
}, [setEditorRedesignStatus, sendEvent])
return (
<div className="d-flex align-items-center">
<OLButton
className="toolbar-experiment-button try-new-editor-button"
onClick={onClick}
size="sm"
variant="secondary"
isLoading={loading}
>
<MaterialIcon type="fiber_new" />
{t('try_the_new_editor_design')}
</OLButton>
</div>
)
}
export default TryNewEditorButton