overleaf/services/web/frontend/js/features/review-panel-new/components/review-panel-tabs.tsx
David 438192fc11 Open review panel current file view when clicking add comment tooltip (#20891)
* Remove need for custom set-review-panel-open event

* Open current file view when clicking add comment tooltip

---------

Co-authored-by: Domagoj Kriskovic <dom.kriskovic@overleaf.com>
GitOrigin-RevId: 2b21061193f4270030d73174014aabbd017fd38e
2024-10-14 11:08:56 +00:00

40 lines
1.1 KiB
TypeScript

import { FC, memo } from 'react'
import classnames from 'classnames'
import MaterialIcon from '@/shared/components/material-icon'
import { useTranslation } from 'react-i18next'
import {
useReviewPanelViewActionsContext,
useReviewPanelViewContext,
} from '../context/review-panel-view-context'
const ReviewPanelTabs: FC = () => {
const subView = useReviewPanelViewContext()
const { setView: setSubView } = useReviewPanelViewActionsContext()
const { t } = useTranslation()
return (
<>
<button
className={classnames('review-panel-tab', {
'review-panel-tab-active': subView === 'cur_file',
})}
onClick={() => setSubView('cur_file')}
>
<MaterialIcon type="description" />
{t('current_file')}
</button>
<button
className={classnames('review-panel-tab', {
'review-panel-tab-active': subView === 'overview',
})}
onClick={() => setSubView('overview')}
>
<MaterialIcon type="list" />
{t('overview')}
</button>
</>
)
}
export default memo(ReviewPanelTabs)