mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 14:43:46 +01:00
[web] Hide bulk track change actions for reviewers GitOrigin-RevId: f636f4c82fdfb43a6dedf1abbb3cc53805eab7f8
52 lines
1.6 KiB
TypeScript
52 lines
1.6 KiB
TypeScript
import { FC } from 'react'
|
|
import { useTranslation } from 'react-i18next'
|
|
import MaterialIcon from '@/shared/components/material-icon'
|
|
import OLTooltip from '@/shared/components/ol/ol-tooltip'
|
|
import { usePermissionsContext } from '@/features/ide-react/context/permissions-context'
|
|
import { useTrackedChangesActions } from '@/features/review-panel/hooks/use-tracked-changes-actions'
|
|
|
|
const TrackedChangesActions: FC = () => {
|
|
const { t } = useTranslation()
|
|
const permissions = usePermissionsContext()
|
|
const { changesInSelection, acceptChangesHandler, rejectChangesHandler } =
|
|
useTrackedChangesActions()
|
|
|
|
if (!permissions.write || changesInSelection.length === 0) {
|
|
return null
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<div className="editor-floating-menu-divider" />
|
|
<OLTooltip
|
|
id="editor-floating-menu-accept-changes"
|
|
description={t('accept_selected_changes')}
|
|
overlayProps={{ placement: 'right' }}
|
|
>
|
|
<button
|
|
className="editor-floating-menu-button"
|
|
onClick={acceptChangesHandler}
|
|
aria-label={t('accept_selected_changes')}
|
|
>
|
|
<MaterialIcon type="check" />
|
|
</button>
|
|
</OLTooltip>
|
|
<OLTooltip
|
|
id="editor-floating-menu-reject-changes"
|
|
description={t('reject_selected_changes')}
|
|
overlayProps={{ placement: 'right' }}
|
|
>
|
|
<button
|
|
className="editor-floating-menu-button"
|
|
onClick={rejectChangesHandler}
|
|
aria-label={t('reject_selected_changes')}
|
|
>
|
|
<MaterialIcon type="clear" />
|
|
</button>
|
|
</OLTooltip>
|
|
</>
|
|
)
|
|
}
|
|
|
|
export default TrackedChangesActions
|