2024-08-19 09:16:56 -04:00
|
|
|
import React, { FC, useRef, useState } from 'react'
|
|
|
|
import Icon from '@/shared/components/icon'
|
|
|
|
import { ReviewPanelResolvedThreadsMenu } from './review-panel-resolved-threads-menu'
|
|
|
|
import { Overlay, Popover } from 'react-bootstrap'
|
2024-09-26 10:13:20 -04:00
|
|
|
import Tooltip from '@/shared/components/tooltip'
|
|
|
|
import { useTranslation } from 'react-i18next'
|
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-09-26 10:13:20 -04:00
|
|
|
<Tooltip
|
|
|
|
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)}
|
|
|
|
>
|
|
|
|
<Icon type="inbox" fw />
|
|
|
|
</button>
|
|
|
|
</Tooltip>
|
2024-08-19 09:16:56 -04:00
|
|
|
{expanded && (
|
|
|
|
<Overlay
|
|
|
|
show
|
|
|
|
onHide={() => setExpanded(false)}
|
|
|
|
animation={false}
|
|
|
|
container={this}
|
|
|
|
containerPadding={0}
|
|
|
|
placement="bottom"
|
|
|
|
rootClose
|
|
|
|
target={buttonRef.current ?? undefined}
|
|
|
|
>
|
|
|
|
<Popover
|
|
|
|
id="popover-resolved-threads"
|
|
|
|
className="review-panel-resolved-comments review-panel-new"
|
|
|
|
>
|
|
|
|
<ReviewPanelResolvedThreadsMenu />
|
|
|
|
</Popover>
|
|
|
|
</Overlay>
|
|
|
|
)}
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|