overleaf/services/web/frontend/js/features/review-panel-new/components/track-changes-on-widget.tsx
David c7eafd69c2 Merge pull request #21014 from overleaf/dk-review-panel-tc-widget
Add "Track changes is On" button when review panel is closed

GitOrigin-RevId: a165201f611860ba531f2eeb3d89f83a695cd017
2024-10-22 08:05:50 +00:00

36 lines
1.1 KiB
TypeScript

import { Trans } from 'react-i18next'
import { EditorView } from '@codemirror/view'
import classnames from 'classnames'
import { useCodeMirrorStateContext } from '@/features/source-editor/components/codemirror-context'
import { useLayoutContext } from '@/shared/context/layout-context'
import { useCallback } from 'react'
function TrackChangesOnWidget() {
const { setReviewPanelOpen } = useLayoutContext()
const state = useCodeMirrorStateContext()
const darkTheme = state.facet(EditorView.darkTheme)
const openReviewPanel = useCallback(() => {
setReviewPanelOpen(true)
}, [setReviewPanelOpen])
return (
<div className="review-panel-in-editor-widgets">
<div className="review-panel-in-editor-widgets-inner">
<button
className={classnames('review-panel-track-changes-indicator', {
'review-panel-track-changes-indicator-on-dark': darkTheme,
})}
onClick={openReviewPanel}
>
<Trans
i18nKey="track_changes_is_on"
components={{ strong: <strong /> }}
/>
</button>
</div>
</div>
)
}
export default TrackChangesOnWidget