Merge pull request #20586 from overleaf/dp-resoled-comments-tooltip

Add tooltips for resolved comments toggle and reopen/delete thread buttons

GitOrigin-RevId: 6e043d0ca83418f4362ec1b49994c4ceed24742b
This commit is contained in:
David 2024-09-26 15:13:20 +01:00 committed by Copybot
parent cfd0b39b96
commit 2a051700b5
2 changed files with 35 additions and 12 deletions

View file

@ -7,6 +7,7 @@ import MaterialIcon from '@/shared/components/material-icon'
import { ExpandableContent } from './review-panel-expandable-content' import { ExpandableContent } from './review-panel-expandable-content'
import { ReviewPanelCommentContent } from './review-panel-comment-content' import { ReviewPanelCommentContent } from './review-panel-comment-content'
import { Change, CommentOperation } from '../../../../../types/change' import { Change, CommentOperation } from '../../../../../types/change'
import Tooltip from '@/shared/components/tooltip'
export const ReviewPanelResolvedThread: FC<{ export const ReviewPanelResolvedThread: FC<{
id: string id: string
@ -32,12 +33,25 @@ export const ReviewPanelResolvedThread: FC<{
/> />
</div> </div>
<div className="review-panel-resolved-comment-buttons"> <div className="review-panel-resolved-comment-buttons">
<Tooltip
id="reopen-thread"
overlayProps={{ placement: 'bottom' }}
description={t('reopen')}
>
<Button onClick={() => reopenThread(id as ThreadId)}> <Button onClick={() => reopenThread(id as ThreadId)}>
<MaterialIcon type="refresh" accessibilityLabel={t('reopen')} /> <MaterialIcon type="refresh" accessibilityLabel={t('reopen')} />
</Button> </Button>
</Tooltip>
<Tooltip
id="delete-thread"
overlayProps={{ placement: 'bottom' }}
description={t('delete')}
>
<Button onClick={() => deleteThread(id as ThreadId)}> <Button onClick={() => deleteThread(id as ThreadId)}>
<MaterialIcon type="delete" accessibilityLabel={t('delete')} /> <MaterialIcon type="delete" accessibilityLabel={t('delete')} />
</Button> </Button>
</Tooltip>
</div> </div>
</div> </div>
<div className="review-panel-resolved-comment-quoted-text"> <div className="review-panel-resolved-comment-quoted-text">

View file

@ -2,13 +2,21 @@ import React, { FC, useRef, useState } from 'react'
import Icon from '@/shared/components/icon' import Icon from '@/shared/components/icon'
import { ReviewPanelResolvedThreadsMenu } from './review-panel-resolved-threads-menu' import { ReviewPanelResolvedThreadsMenu } from './review-panel-resolved-threads-menu'
import { Overlay, Popover } from 'react-bootstrap' import { Overlay, Popover } from 'react-bootstrap'
import Tooltip from '@/shared/components/tooltip'
import { useTranslation } from 'react-i18next'
export const ReviewPanelResolvedThreadsButton: FC = () => { export const ReviewPanelResolvedThreadsButton: FC = () => {
const [expanded, setExpanded] = useState(false) const [expanded, setExpanded] = useState(false)
const buttonRef = useRef<HTMLButtonElement>(null) const buttonRef = useRef<HTMLButtonElement>(null)
const { t } = useTranslation()
return ( return (
<> <>
<Tooltip
id="resolved-comments"
overlayProps={{ placement: 'bottom' }}
description={t('resolved_comments')}
>
<button <button
className="resolved-comments-toggle" className="resolved-comments-toggle"
ref={buttonRef} ref={buttonRef}
@ -16,6 +24,7 @@ export const ReviewPanelResolvedThreadsButton: FC = () => {
> >
<Icon type="inbox" fw /> <Icon type="inbox" fw />
</button> </button>
</Tooltip>
{expanded && ( {expanded && (
<Overlay <Overlay
show show