[MM-59905] Migrate tooltips of 'components/threading/channel_threads/thread_footer/thread_footer.tsx' to WithTooltip (#27802)

This commit is contained in:
Brandon Shen 2024-08-07 01:19:41 -07:00 committed by GitHub
parent 5f8f1f8142
commit 24ae4a6d9e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 44 deletions

View File

@ -796,8 +796,10 @@ exports[`components/threading/channel_threads/thread_footer should show unread i
<div
className="ThreadFooter"
>
<SimpleTooltip
content={
<WithTooltip
id="threadFooterIndicator"
placement="top"
title={
<Memo(MemoizedFormattedMessage)
defaultMessage="{newReplies, plural, =0 {no unread messages} =1 {one unread message} other {# unread messages}}"
id="threading.numNewMessages"
@ -808,28 +810,12 @@ exports[`components/threading/channel_threads/thread_footer should show unread i
}
/>
}
id="threadFooterIndicator"
>
<OverlayTrigger
defaultOverlayShown={false}
delayShow={100}
overlay={
<Tooltip
className="hidden-xs"
id="threadFooterIndicator"
placement="top"
>
<Memo(MemoizedFormattedMessage)
defaultMessage="{newReplies, plural, =0 {no unread messages} =1 {one unread message} other {# unread messages}}"
id="threading.numNewMessages"
values={
Object {
"newReplies": 2,
}
}
/>
</Tooltip>
}
delay={400}
disabled={false}
overlay={<Unknown />}
placement="top"
trigger={
Array [
@ -840,11 +826,9 @@ exports[`components/threading/channel_threads/thread_footer should show unread i
>
<OverlayTrigger
defaultOverlayShown={false}
delayShow={100}
delay={400}
overlay={
<OverlayWrapper
className="hidden-xs"
id="threadFooterIndicator"
intl={
Object {
"$t": [Function],
@ -884,18 +868,7 @@ exports[`components/threading/channel_threads/thread_footer should show unread i
"wrapRichTextChunksInFragment": undefined,
}
}
placement="top"
>
<Memo(MemoizedFormattedMessage)
defaultMessage="{newReplies, plural, =0 {no unread messages} =1 {one unread message} other {# unread messages}}"
id="threading.numNewMessages"
values={
Object {
"newReplies": 2,
}
}
/>
</OverlayWrapper>
/>
}
placement="top"
trigger={
@ -920,7 +893,7 @@ exports[`components/threading/channel_threads/thread_footer should show unread i
</div>
</OverlayTrigger>
</OverlayTrigger>
</SimpleTooltip>
</WithTooltip>
<Memo(Avatars)
size="sm"
userIds={

View File

@ -8,8 +8,8 @@ import type {ComponentProps} from 'react';
import type {UserThread} from '@mattermost/types/threads';
import Timestamp from 'components/timestamp';
import SimpleTooltip from 'components/widgets/simple_tooltip';
import Avatars from 'components/widgets/users/avatars';
import WithTooltip from 'components/with_tooltip';
import {fakeDate} from 'tests/helpers/date';
import {mockStore} from 'tests/test_store';
@ -161,7 +161,7 @@ describe('components/threading/channel_threads/thread_footer', () => {
);
expect(wrapper).toMatchSnapshot();
expect(wrapper.find(SimpleTooltip).find('.dot-unreads').exists()).toBe(true);
expect(wrapper.find(WithTooltip).find('.dot-unreads').exists()).toBe(true);
});
test('should not show unread indicator if not following', () => {
@ -176,7 +176,7 @@ describe('components/threading/channel_threads/thread_footer', () => {
mountOptions,
);
expect(wrapper.find(SimpleTooltip).find('.dot-unreads').exists()).toBe(false);
expect(wrapper.find(WithTooltip).find('.dot-unreads').exists()).toBe(false);
});
test('should have avatars', () => {

View File

@ -22,8 +22,8 @@ import Button from 'components/threading/common/button';
import FollowButton from 'components/threading/common/follow_button';
import {THREADING_TIME} from 'components/threading/common/options';
import Timestamp from 'components/timestamp';
import SimpleTooltip from 'components/widgets/simple_tooltip';
import Avatars from 'components/widgets/users/avatars';
import WithTooltip from 'components/with_tooltip';
import type {GlobalState} from 'types/store';
@ -84,9 +84,10 @@ function ThreadFooter({
{!isFollowing || threadIsSynthetic(thread) || !thread.unread_replies ? (
<div className='indicator'/>
) : (
<SimpleTooltip
<WithTooltip
id='threadFooterIndicator'
content={
placement='top'
title={
<FormattedMessage
id='threading.numNewMessages'
defaultMessage='{newReplies, plural, =0 {no unread messages} =1 {one unread message} other {# unread messages}}'
@ -100,7 +101,7 @@ function ThreadFooter({
>
<div className='dot-unreads'/>
</div>
</SimpleTooltip>
</WithTooltip>
)}
{participantIds && participantIds.length > 0 ? (