diff --git a/webapp/channels/src/components/channel_header_dropdown/mobile_channel_header_dropdown.tsx b/webapp/channels/src/components/channel_header_dropdown/mobile_channel_header_dropdown.tsx index 0addea3e7a..5362e0474e 100644 --- a/webapp/channels/src/components/channel_header_dropdown/mobile_channel_header_dropdown.tsx +++ b/webapp/channels/src/components/channel_header_dropdown/mobile_channel_header_dropdown.tsx @@ -1,9 +1,8 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React from 'react'; -import {FormattedMessage, injectIntl} from 'react-intl'; -import type {IntlShape} from 'react-intl'; +import React, {memo} from 'react'; +import {FormattedMessage, useIntl} from 'react-intl'; import type {Channel} from '@mattermost/types/channels'; import type {UserProfile} from '@mattermost/types/users'; @@ -24,13 +23,19 @@ type Props = { teammateIsBot?: boolean; teammateStatus?: string; displayName: string; - intl: IntlShape; } -class MobileChannelHeaderDropdown extends React.PureComponent { - getChannelTitle = () => { - const {user, channel, teammateId, displayName} = this.props; +const MobileChannelHeaderDropdown = ({ + user, + channel, + teammateId, + displayName, + teammateIsBot, + teammateStatus, +}: Props) => { + const intl = useIntl(); + const getChannelTitle = () => { if (channel.type === Constants.DM_CHANNEL) { if (user.id === teammateId) { return ( @@ -46,39 +51,36 @@ class MobileChannelHeaderDropdown extends React.PureComponent { return channel.display_name; }; - render() { - const {teammateIsBot, teammateStatus} = this.props; - let dmHeaderIconStatus; + let dmHeaderIconStatus; - if (!teammateIsBot) { - dmHeaderIconStatus = ( - - ); - } - - return ( - - - - {dmHeaderIconStatus} - {this.getChannelTitle()} - - - - - - -
- {'×'} -
-
-
+ if (!teammateIsBot) { + dmHeaderIconStatus = ( + ); } -} -export default injectIntl(MobileChannelHeaderDropdown); + return ( + + + + {dmHeaderIconStatus} + {getChannelTitle()} + + + + + + +
+ {'×'} +
+
+
+ ); +}; + +export default memo(MobileChannelHeaderDropdown); diff --git a/webapp/channels/src/components/channel_header_mobile/__snapshots__/channel_header_mobile.test.tsx.snap b/webapp/channels/src/components/channel_header_mobile/__snapshots__/channel_header_mobile.test.tsx.snap index 123a9d3f5b..20cab4cc4c 100644 --- a/webapp/channels/src/components/channel_header_mobile/__snapshots__/channel_header_mobile.test.tsx.snap +++ b/webapp/channels/src/components/channel_header_mobile/__snapshots__/channel_header_mobile.test.tsx.snap @@ -16,7 +16,7 @@ exports[`components/ChannelHeaderMobile/ChannelHeaderMobile should match snapsho
- +
- +
- +
- +