MM-58411 Migrate tooltips of 'components/actions_menu/actions_menu' to WithTooltip (#27238)
* Added console log for draft PR * Replaced tooltip component with changes * Updated snapshot for tests * Updated title to use FormattedMessage * Remove defineMessages * Fix style * Removed unused tooltip --------- Co-authored-by: ezekiel <ezekiel@itsmart.my> Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
@@ -7,30 +7,14 @@ exports[`components/actions_menu/ActionsMenu has actions - marketplace disabled
|
|||||||
onToggle={[Function]}
|
onToggle={[Function]}
|
||||||
open={true}
|
open={true}
|
||||||
>
|
>
|
||||||
<OverlayTrigger
|
<WithTooltip
|
||||||
className="hidden-xs"
|
id="center_post_id_1_tooltip"
|
||||||
defaultOverlayShown={false}
|
|
||||||
delayShow={500}
|
|
||||||
overlay={
|
|
||||||
<Tooltip
|
|
||||||
bsClass="tooltip"
|
|
||||||
className="hidden-xs"
|
|
||||||
id="actions-menu-icon-tooltip"
|
|
||||||
placement="right"
|
|
||||||
>
|
|
||||||
<Memo(MemoizedFormattedMessage)
|
|
||||||
defaultMessage="Message actions"
|
|
||||||
id="post_info.tooltip.actions"
|
|
||||||
/>
|
|
||||||
</Tooltip>
|
|
||||||
}
|
|
||||||
placement="top"
|
placement="top"
|
||||||
rootClose={true}
|
title={
|
||||||
trigger={
|
<Memo(MemoizedFormattedMessage)
|
||||||
Array [
|
defaultMessage="Message actions"
|
||||||
"hover",
|
id="post_info.tooltip.actions"
|
||||||
"focus",
|
/>
|
||||||
]
|
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
@@ -45,7 +29,7 @@ exports[`components/actions_menu/ActionsMenu has actions - marketplace disabled
|
|||||||
className="icon icon-apps"
|
className="icon icon-apps"
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
</OverlayTrigger>
|
</WithTooltip>
|
||||||
<Menu
|
<Menu
|
||||||
ariaLabel="Post extra options"
|
ariaLabel="Post extra options"
|
||||||
id="center_actions_dropdown_post_id_1"
|
id="center_actions_dropdown_post_id_1"
|
||||||
@@ -74,30 +58,14 @@ exports[`components/actions_menu/ActionsMenu has actions - marketplace enabled a
|
|||||||
onToggle={[Function]}
|
onToggle={[Function]}
|
||||||
open={true}
|
open={true}
|
||||||
>
|
>
|
||||||
<OverlayTrigger
|
<WithTooltip
|
||||||
className="hidden-xs"
|
id="center_post_id_1_tooltip"
|
||||||
defaultOverlayShown={false}
|
|
||||||
delayShow={500}
|
|
||||||
overlay={
|
|
||||||
<Tooltip
|
|
||||||
bsClass="tooltip"
|
|
||||||
className="hidden-xs"
|
|
||||||
id="actions-menu-icon-tooltip"
|
|
||||||
placement="right"
|
|
||||||
>
|
|
||||||
<Memo(MemoizedFormattedMessage)
|
|
||||||
defaultMessage="Message actions"
|
|
||||||
id="post_info.tooltip.actions"
|
|
||||||
/>
|
|
||||||
</Tooltip>
|
|
||||||
}
|
|
||||||
placement="top"
|
placement="top"
|
||||||
rootClose={true}
|
title={
|
||||||
trigger={
|
<Memo(MemoizedFormattedMessage)
|
||||||
Array [
|
defaultMessage="Message actions"
|
||||||
"hover",
|
id="post_info.tooltip.actions"
|
||||||
"focus",
|
/>
|
||||||
]
|
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
@@ -112,7 +80,7 @@ exports[`components/actions_menu/ActionsMenu has actions - marketplace enabled a
|
|||||||
className="icon icon-apps"
|
className="icon icon-apps"
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
</OverlayTrigger>
|
</WithTooltip>
|
||||||
<Menu
|
<Menu
|
||||||
ariaLabel="Post extra options"
|
ariaLabel="Post extra options"
|
||||||
id="center_actions_dropdown_post_id_1"
|
id="center_actions_dropdown_post_id_1"
|
||||||
@@ -160,30 +128,14 @@ exports[`components/actions_menu/ActionsMenu no actions - sysadmin - menu should
|
|||||||
onToggle={[Function]}
|
onToggle={[Function]}
|
||||||
open={true}
|
open={true}
|
||||||
>
|
>
|
||||||
<OverlayTrigger
|
<WithTooltip
|
||||||
className="hidden-xs"
|
id="center_post_id_1_tooltip"
|
||||||
defaultOverlayShown={false}
|
|
||||||
delayShow={500}
|
|
||||||
overlay={
|
|
||||||
<Tooltip
|
|
||||||
bsClass="tooltip"
|
|
||||||
className="hidden-xs"
|
|
||||||
id="actions-menu-icon-tooltip"
|
|
||||||
placement="right"
|
|
||||||
>
|
|
||||||
<Memo(MemoizedFormattedMessage)
|
|
||||||
defaultMessage="Message actions"
|
|
||||||
id="post_info.tooltip.actions"
|
|
||||||
/>
|
|
||||||
</Tooltip>
|
|
||||||
}
|
|
||||||
placement="top"
|
placement="top"
|
||||||
rootClose={true}
|
title={
|
||||||
trigger={
|
<Memo(MemoizedFormattedMessage)
|
||||||
Array [
|
defaultMessage="Message actions"
|
||||||
"hover",
|
id="post_info.tooltip.actions"
|
||||||
"focus",
|
/>
|
||||||
]
|
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
@@ -198,7 +150,7 @@ exports[`components/actions_menu/ActionsMenu no actions - sysadmin - menu should
|
|||||||
className="icon icon-apps"
|
className="icon icon-apps"
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
</OverlayTrigger>
|
</WithTooltip>
|
||||||
<Menu
|
<Menu
|
||||||
ariaLabel="Post extra options"
|
ariaLabel="Post extra options"
|
||||||
id="center_actions_dropdown_post_id_1"
|
id="center_actions_dropdown_post_id_1"
|
||||||
|
|||||||
@@ -3,9 +3,8 @@
|
|||||||
|
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {Tooltip} from 'react-bootstrap';
|
|
||||||
import {FormattedMessage, injectIntl} from 'react-intl';
|
|
||||||
import type {IntlShape} from 'react-intl';
|
import type {IntlShape} from 'react-intl';
|
||||||
|
import {FormattedMessage, injectIntl} from 'react-intl';
|
||||||
|
|
||||||
import type {AppBinding} from '@mattermost/types/apps';
|
import type {AppBinding} from '@mattermost/types/apps';
|
||||||
import type {Post} from '@mattermost/types/posts';
|
import type {Post} from '@mattermost/types/posts';
|
||||||
@@ -15,21 +14,21 @@ import Permissions from 'mattermost-redux/constants/permissions';
|
|||||||
import type {ActionResult} from 'mattermost-redux/types/actions';
|
import type {ActionResult} from 'mattermost-redux/types/actions';
|
||||||
|
|
||||||
import FormattedMarkdownMessage from 'components/formatted_markdown_message';
|
import FormattedMarkdownMessage from 'components/formatted_markdown_message';
|
||||||
import OverlayTrigger from 'components/overlay_trigger';
|
|
||||||
import SystemPermissionGate from 'components/permissions_gates/system_permission_gate';
|
import SystemPermissionGate from 'components/permissions_gates/system_permission_gate';
|
||||||
import MarketplaceModal from 'components/plugin_marketplace/marketplace_modal';
|
|
||||||
import type {OpenedFromType} from 'components/plugin_marketplace/marketplace_modal';
|
import type {OpenedFromType} from 'components/plugin_marketplace/marketplace_modal';
|
||||||
|
import MarketplaceModal from 'components/plugin_marketplace/marketplace_modal';
|
||||||
import Menu from 'components/widgets/menu/menu';
|
import Menu from 'components/widgets/menu/menu';
|
||||||
import MenuWrapper from 'components/widgets/menu/menu_wrapper';
|
import MenuWrapper from 'components/widgets/menu/menu_wrapper';
|
||||||
|
import WithTooltip from 'components/with_tooltip';
|
||||||
|
|
||||||
import Pluggable from 'plugins/pluggable';
|
import Pluggable from 'plugins/pluggable';
|
||||||
import {createCallContext} from 'utils/apps';
|
import {createCallContext} from 'utils/apps';
|
||||||
import {Locations, Constants, ModalIdentifiers} from 'utils/constants';
|
import {Constants, Locations, ModalIdentifiers} from 'utils/constants';
|
||||||
import * as PostUtils from 'utils/post_utils';
|
import * as PostUtils from 'utils/post_utils';
|
||||||
import * as Utils from 'utils/utils';
|
import * as Utils from 'utils/utils';
|
||||||
|
|
||||||
import type {ModalData} from 'types/actions';
|
import type {ModalData} from 'types/actions';
|
||||||
import type {HandleBindingClick, PostEphemeralCallResponseForPost, OpenAppsModal} from 'types/apps';
|
import type {HandleBindingClick, OpenAppsModal, PostEphemeralCallResponseForPost} from 'types/apps';
|
||||||
import type {PluginComponent} from 'types/store/plugins';
|
import type {PluginComponent} from 'types/store/plugins';
|
||||||
|
|
||||||
import './actions_menu.scss';
|
import './actions_menu.scss';
|
||||||
@@ -112,18 +111,6 @@ export class ActionMenuClass extends React.PureComponent<Props, State> {
|
|||||||
this.buttonRef = React.createRef<HTMLButtonElement>();
|
this.buttonRef = React.createRef<HTMLButtonElement>();
|
||||||
}
|
}
|
||||||
|
|
||||||
tooltip = (
|
|
||||||
<Tooltip
|
|
||||||
id='actions-menu-icon-tooltip'
|
|
||||||
className='hidden-xs'
|
|
||||||
>
|
|
||||||
<FormattedMessage
|
|
||||||
id='post_info.tooltip.actions'
|
|
||||||
defaultMessage='Message actions'
|
|
||||||
/>
|
|
||||||
</Tooltip>
|
|
||||||
);
|
|
||||||
|
|
||||||
componentDidUpdate(prevProps: Props) {
|
componentDidUpdate(prevProps: Props) {
|
||||||
if (this.props.isMenuOpen && !prevProps.isMenuOpen) {
|
if (this.props.isMenuOpen && !prevProps.isMenuOpen) {
|
||||||
this.fetchBindings();
|
this.fetchBindings();
|
||||||
@@ -131,7 +118,7 @@ export class ActionMenuClass extends React.PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static getDerivedStateFromProps(props: Props) {
|
static getDerivedStateFromProps(props: Props) {
|
||||||
const state: Partial<State> = { };
|
const state: Partial<State> = {};
|
||||||
if (props.appBindings) {
|
if (props.appBindings) {
|
||||||
state.appBindings = props.appBindings;
|
state.appBindings = props.appBindings;
|
||||||
}
|
}
|
||||||
@@ -387,12 +374,15 @@ export class ActionMenuClass extends React.PureComponent<Props, State> {
|
|||||||
open={this.props.isMenuOpen}
|
open={this.props.isMenuOpen}
|
||||||
onToggle={this.handleDropdownOpened}
|
onToggle={this.handleDropdownOpened}
|
||||||
>
|
>
|
||||||
<OverlayTrigger
|
<WithTooltip
|
||||||
className='hidden-xs'
|
id={`${this.props.location}_${this.props.post.id}_tooltip`}
|
||||||
delayShow={500}
|
title={
|
||||||
|
<FormattedMessage
|
||||||
|
id='post_info.tooltip.actions'
|
||||||
|
defaultMessage='Message actions'
|
||||||
|
/>
|
||||||
|
}
|
||||||
placement='top'
|
placement='top'
|
||||||
overlay={this.tooltip}
|
|
||||||
rootClose={true}
|
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
key='more-actions-button'
|
key='more-actions-button'
|
||||||
@@ -407,7 +397,7 @@ export class ActionMenuClass extends React.PureComponent<Props, State> {
|
|||||||
>
|
>
|
||||||
<i className={'icon icon-apps'}/>
|
<i className={'icon icon-apps'}/>
|
||||||
</button>
|
</button>
|
||||||
</OverlayTrigger>
|
</WithTooltip>
|
||||||
<Menu
|
<Menu
|
||||||
id={`${this.props.location}_actions_dropdown_${this.props.post.id}`}
|
id={`${this.props.location}_actions_dropdown_${this.props.post.id}`}
|
||||||
openLeft={true}
|
openLeft={true}
|
||||||
@@ -417,7 +407,7 @@ export class ActionMenuClass extends React.PureComponent<Props, State> {
|
|||||||
>
|
>
|
||||||
{menuItems}
|
{menuItems}
|
||||||
</Menu>
|
</Menu>
|
||||||
</MenuWrapper>
|
</MenuWrapper >
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user