From 21b923b554b0abbddb886140962ed59a79329738 Mon Sep 17 00:00:00 2001 From: Michael <74271024+KvngMikey@users.noreply.github.com> Date: Thu, 22 Aug 2024 14:59:05 +0100 Subject: [PATCH] [MM-60159] Migrate tooltips of "components/rhs_header_post/rhs_header_post.tsx" to WithTooltip (#28015) --- .../rhs_header_post/rhs_header_post.tsx | 103 ++++++++---------- 1 file changed, 47 insertions(+), 56 deletions(-) diff --git a/webapp/channels/src/components/rhs_header_post/rhs_header_post.tsx b/webapp/channels/src/components/rhs_header_post/rhs_header_post.tsx index 1db69e679a..652f9a0e94 100644 --- a/webapp/channels/src/components/rhs_header_post/rhs_header_post.tsx +++ b/webapp/channels/src/components/rhs_header_post/rhs_header_post.tsx @@ -9,14 +9,13 @@ import type {Channel} from '@mattermost/types/channels'; import KeyboardShortcutSequence, { KEYBOARD_SHORTCUTS, } from 'components/keyboard_shortcuts/keyboard_shortcuts_sequence'; -import OverlayTrigger from 'components/overlay_trigger'; import FollowButton from 'components/threading/common/follow_button'; -import Tooltip from 'components/tooltip'; import CRTThreadsPaneTutorialTip from 'components/tours/crt_tour/crt_threads_pane_tutorial_tip'; +import WithTooltip from 'components/with_tooltip'; import {getHistory} from 'utils/browser_history'; -import Constants, {RHSStates} from 'utils/constants'; +import {RHSStates} from 'utils/constants'; import type {RhsState} from 'types/store/rhs'; @@ -79,12 +78,10 @@ class RhsHeaderPost extends React.PureComponent { const {isFollowingThread} = this.props; const {formatMessage} = this.props.intl; const closeSidebarTooltip = ( - - - + ); let backToResultsTooltip; @@ -93,52 +90,34 @@ class RhsHeaderPost extends React.PureComponent { case RHSStates.SEARCH: case RHSStates.MENTION: backToResultsTooltip = ( - - - + ); break; case RHSStates.FLAG: backToResultsTooltip = ( - - - + ); break; case RHSStates.PIN: backToResultsTooltip = ( - - - + ); break; } - const expandSidebarTooltip = ( - - - - - ); - - const shrinkSidebarTooltip = ( - + //rhsHeaderTooltipContent contains tooltips content for expand or shrink sidebarTooltip. + // if props.isExpanded is true, defaultMessage would feed from 'shrinkTooltip', else 'expandTooltip' + const rhsHeaderTooltipContent = this.props.isExpanded ? ( + <> { hideDescription={true} isInsideTooltip={true} /> - + + ) : ( + <> + + + ); const channelName = this.props.channel.display_name; if (backToResultsTooltip) { back = ( - - + ); } @@ -199,10 +190,10 @@ class RhsHeaderPost extends React.PureComponent { /> ) : null} - - + - - + {this.props.showThreadsTutorialTip && }