2024-08-19 09:16:56 -04:00
|
|
|
import React, { FC, useRef, useState } from 'react'
|
|
|
|
import Icon from '@/shared/components/icon'
|
2024-10-18 06:14:45 -04:00
|
|
|
import OLOverlay from '@/features/ui/components/ol/ol-overlay'
|
|
|
|
import OLPopover from '@/features/ui/components/ol/ol-popover'
|
|
|
|
import OLTooltip from '@/features/ui/components/ol/ol-tooltip'
|
2024-08-19 09:16:56 -04:00
|
|
|
import { ReviewPanelResolvedThreadsMenu } from './review-panel-resolved-threads-menu'
|
2024-09-26 10:13:20 -04:00
|
|
|
import { useTranslation } from 'react-i18next'
|
2024-10-18 06:14:45 -04:00
|
|
|
import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher'
|
|
|
|
import MaterialIcon from '@/shared/components/material-icon'
|
2024-08-19 09:16:56 -04:00
|
|
|
|
|
|
|
export const ReviewPanelResolvedThreadsButton: FC = () => {
|
|
|
|
const [expanded, setExpanded] = useState(false)
|
|
|
|
const buttonRef = useRef<HTMLButtonElement>(null)
|
2024-09-26 10:13:20 -04:00
|
|
|
const { t } = useTranslation()
|
2024-08-19 09:16:56 -04:00
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
2024-10-18 06:14:45 -04:00
|
|
|
<OLTooltip
|
2024-09-26 10:13:20 -04:00
|
|
|
id="resolved-comments"
|
|
|
|
overlayProps={{ placement: 'bottom' }}
|
|
|
|
description={t('resolved_comments')}
|
2024-08-19 09:16:56 -04:00
|
|
|
>
|
2024-09-26 10:13:20 -04:00
|
|
|
<button
|
|
|
|
className="resolved-comments-toggle"
|
|
|
|
ref={buttonRef}
|
|
|
|
onClick={() => setExpanded(true)}
|
|
|
|
>
|
2024-10-18 06:14:45 -04:00
|
|
|
<BootstrapVersionSwitcher
|
|
|
|
bs3={<Icon type="inbox" fw />}
|
|
|
|
bs5={<MaterialIcon type="inbox" />}
|
|
|
|
/>
|
2024-09-26 10:13:20 -04:00
|
|
|
</button>
|
2024-10-18 06:14:45 -04:00
|
|
|
</OLTooltip>
|
2024-08-19 09:16:56 -04:00
|
|
|
{expanded && (
|
2024-10-18 06:14:45 -04:00
|
|
|
<OLOverlay
|
2024-08-19 09:16:56 -04:00
|
|
|
show
|
|
|
|
onHide={() => setExpanded(false)}
|
2024-10-18 06:14:45 -04:00
|
|
|
transition={false}
|
2024-08-19 09:16:56 -04:00
|
|
|
container={this}
|
|
|
|
containerPadding={0}
|
|
|
|
placement="bottom"
|
|
|
|
rootClose
|
2024-10-18 06:14:45 -04:00
|
|
|
target={buttonRef.current}
|
2024-08-19 09:16:56 -04:00
|
|
|
>
|
2024-10-18 06:14:45 -04:00
|
|
|
<OLPopover
|
2024-08-19 09:16:56 -04:00
|
|
|
id="popover-resolved-threads"
|
|
|
|
className="review-panel-resolved-comments review-panel-new"
|
|
|
|
>
|
|
|
|
<ReviewPanelResolvedThreadsMenu />
|
2024-10-18 06:14:45 -04:00
|
|
|
</OLPopover>
|
|
|
|
</OLOverlay>
|
2024-08-19 09:16:56 -04:00
|
|
|
)}
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|