mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 22:23:42 +01:00
Merge pull request #31909 from overleaf/ds-removing-useIsNewEditorEnabled-2
[Part 2] Removing the usage of `useIsNewEditorEnabled` for editor tear down GitOrigin-RevId: 864652da0edcedab4f3b1ba47d8d42fb65260118
This commit is contained in:
@@ -1,47 +0,0 @@
|
||||
import { FC } from 'react'
|
||||
import SplitTestBadge from '@/shared/components/split-test-badge'
|
||||
import MaterialIcon from '@/shared/components/material-icon'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import OLTooltip from '@/shared/components/ol/ol-tooltip'
|
||||
|
||||
// TODO ide-redesign-cleanup: Remove this component and only use RailPanelHeader
|
||||
export const PanelHeading: FC<
|
||||
React.PropsWithChildren<{
|
||||
title: string
|
||||
splitTestName?: string
|
||||
children?: React.ReactNode
|
||||
handleClose(): void
|
||||
}>
|
||||
> = ({ title, splitTestName, children, handleClose }) => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
return (
|
||||
<div className="panel-heading">
|
||||
<div className="panel-heading-label">
|
||||
<span>{title}</span>
|
||||
{splitTestName && (
|
||||
<SplitTestBadge
|
||||
splitTestName={splitTestName}
|
||||
displayOnVariants={['enabled']}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{children}
|
||||
<OLTooltip
|
||||
id="close-panel"
|
||||
description={t('close')}
|
||||
overlayProps={{ placement: 'bottom' }}
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
className="btn panel-heading-close-button"
|
||||
aria-label={t('close')}
|
||||
onClick={handleClose}
|
||||
>
|
||||
<MaterialIcon type="close" />
|
||||
</button>
|
||||
</OLTooltip>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
import {
|
||||
Segmentation,
|
||||
sendMB,
|
||||
@@ -10,22 +9,17 @@ import { useCallback } from 'react'
|
||||
export function populateEditorRedesignSegmentation<
|
||||
SegmentationType extends Segmentation,
|
||||
>(
|
||||
segmentation: SegmentationType | undefined = {} as SegmentationType,
|
||||
editorRedesign: boolean
|
||||
segmentation: SegmentationType | undefined = {} as SegmentationType
|
||||
): SegmentationType & { 'editor-redesign'?: 'enabled' } {
|
||||
return editorRedesign
|
||||
? { ...segmentation, 'editor-redesign': 'enabled' }
|
||||
: segmentation
|
||||
return { ...segmentation, 'editor-redesign': 'enabled' }
|
||||
}
|
||||
|
||||
export const useEditorAnalytics = () => {
|
||||
const editorRedesign = useIsNewEditorEnabled()
|
||||
|
||||
const populateSegmentation = useCallback(
|
||||
(segmentation: Segmentation | undefined = {}): Segmentation => {
|
||||
return populateEditorRedesignSegmentation(segmentation, editorRedesign)
|
||||
return populateEditorRedesignSegmentation(segmentation)
|
||||
},
|
||||
[editorRedesign]
|
||||
[]
|
||||
)
|
||||
|
||||
const sendEvent: typeof sendMB = useCallback(
|
||||
|
||||
Reference in New Issue
Block a user