[MM-59894] Migrate tooltips of 'components/app_bar/app_bar_plugin_component.tsx' to WithTooltip (#27834)

Этот коммит содержится в:
Ivy Gesare
2024-08-06 08:32:46 +03:00
коммит произвёл GitHub
родитель 540febd866
Коммит 9466b948ad

Просмотреть файл

@@ -3,17 +3,16 @@
import classNames from 'classnames'; import classNames from 'classnames';
import React, {useState, useEffect} from 'react'; import React, {useState, useEffect} from 'react';
import {Tooltip} from 'react-bootstrap';
import {useSelector} from 'react-redux'; import {useSelector} from 'react-redux';
import {getCurrentChannel, getMyCurrentChannelMembership} from 'mattermost-redux/selectors/entities/channels'; import {getCurrentChannel, getMyCurrentChannelMembership} from 'mattermost-redux/selectors/entities/channels';
import {getActiveRhsComponent} from 'selectors/rhs'; import {getActiveRhsComponent} from 'selectors/rhs';
import OverlayTrigger from 'components/overlay_trigger';
import PluginIcon from 'components/widgets/icons/plugin_icon'; import PluginIcon from 'components/widgets/icons/plugin_icon';
import WithTooltip from 'components/with_tooltip';
import Constants, {suitePluginIds} from 'utils/constants'; import {suitePluginIds} from 'utils/constants';
import type {PluginComponent, AppBarComponent} from 'types/store/plugins'; import type {PluginComponent, AppBarComponent} from 'types/store/plugins';
@@ -56,11 +55,6 @@ const AppBarPluginComponent = (props: PluginComponentProps) => {
const buttonId = `app-bar-icon-${component.pluginId}`; const buttonId = `app-bar-icon-${component.pluginId}`;
const tooltipText = component.tooltipText || component.dropdownText || component.pluginId; const tooltipText = component.tooltipText || component.dropdownText || component.pluginId;
const tooltip = (
<Tooltip id={'pluginTooltip-' + buttonId}>
<span>{tooltipText}</span>
</Tooltip>
);
const iconUrl = component.iconUrl; const iconUrl = component.iconUrl;
let content: React.ReactNode = ( let content: React.ReactNode = (
@@ -101,11 +95,10 @@ const AppBarPluginComponent = (props: PluginComponentProps) => {
const boardsEnabled = component.pluginId === suitePluginIds.focalboard; const boardsEnabled = component.pluginId === suitePluginIds.focalboard;
return ( return (
<OverlayTrigger <WithTooltip
trigger={['hover', 'focus']} id={'pluginTooltip-' + buttonId}
delayShow={Constants.OVERLAY_TIME_DELAY} title={tooltipText}
placement='left' placement='left'
overlay={tooltip}
> >
<div <div
id={buttonId} id={buttonId}
@@ -117,7 +110,7 @@ const AppBarPluginComponent = (props: PluginComponentProps) => {
{content} {content}
{boardsEnabled && <NewChannelWithBoardTourTip/>} {boardsEnabled && <NewChannelWithBoardTourTip/>}
</div> </div>
</OverlayTrigger> </WithTooltip>
); );
}; };