diff --git a/webapp/channels/src/components/channel_header/__snapshots__/channel_header.test.tsx.snap b/webapp/channels/src/components/channel_header/__snapshots__/channel_header.test.tsx.snap index fefa82fb12..35895ea144 100644 --- a/webapp/channels/src/components/channel_header/__snapshots__/channel_header.test.tsx.snap +++ b/webapp/channels/src/components/channel_header/__snapshots__/channel_header.test.tsx.snap @@ -76,9 +76,7 @@ exports[`components/ChannelHeader should match snapshot with last active display dir="auto" id="channelHeaderDescription" > - - - - - - + @@ -422,9 +420,7 @@ exports[`components/drafts/panel/panel_body should match snapshot 1`] = ` - - + @@ -699,9 +695,7 @@ exports[`components/drafts/panel/panel_body should match snapshot for priority 1 - - + @@ -1038,9 +1032,7 @@ exports[`components/drafts/panel/panel_body should match snapshot for requested_ - - + diff --git a/webapp/channels/src/components/profile_picture/__snapshots__/profile_picture.test.tsx.snap b/webapp/channels/src/components/profile_picture/__snapshots__/profile_picture.test.tsx.snap index 6b4aead388..eb122a71c7 100644 --- a/webapp/channels/src/components/profile_picture/__snapshots__/profile_picture.test.tsx.snap +++ b/webapp/channels/src/components/profile_picture/__snapshots__/profile_picture.test.tsx.snap @@ -12,9 +12,7 @@ exports[`components/ProfilePicture should match snapshot, no user specified, def url="http://example.com/image.png" /> - @@ -32,9 +30,7 @@ exports[`components/ProfilePicture should match snapshot, no user specified, ove url="http://example.com/image.png" /> - @@ -76,9 +72,7 @@ exports[`components/ProfilePicture should match snapshot, profile and src, defau /> - @@ -97,9 +91,7 @@ exports[`components/ProfilePicture should match snapshot, user specified 1`] = ` url="http://example.com/image.png" /> - @@ -117,9 +109,7 @@ exports[`components/ProfilePicture should match snapshot, user specified, overri url="http://example.com/image.png" /> - diff --git a/webapp/channels/src/components/status_icon.tsx b/webapp/channels/src/components/status_icon.tsx index a849c7bd80..a5c6f268b7 100644 --- a/webapp/channels/src/components/status_icon.tsx +++ b/webapp/channels/src/components/status_icon.tsx @@ -1,7 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React from 'react'; +import React, {memo} from 'react'; import StatusAwayAvatarIcon from 'components/widgets/icons/status_away_avatar_icon'; import StatusAwayIcon from 'components/widgets/icons/status_away_icon'; @@ -19,47 +19,39 @@ type Props = { type?: string; } -export default class StatusIcon extends React.PureComponent { - static defaultProps = { - className: '', - button: false, - }; - - render() { - const {button, status, type} = this.props; - - if (!status) { - return null; - } - - let className = 'status ' + this.props.className; - - if (button) { - className = this.props.className || ''; - } - - let IconComponent: React.ComponentType<{className?: string}> | string; - const iconComponentProps = {className}; - if (type === 'avatar') { - if (status === 'online') { - IconComponent = StatusOnlineAvatarIcon; - } else if (status === 'away') { - IconComponent = StatusAwayAvatarIcon; - } else if (status === 'dnd') { - IconComponent = StatusDndAvatarIcon; - } else { - IconComponent = StatusOfflineAvatarIcon; - } - } else if (status === 'online') { - IconComponent = StatusOnlineIcon; - } else if (status === 'away') { - IconComponent = StatusAwayIcon; - } else if (status === 'dnd') { - IconComponent = StatusDndIcon; - } else { - IconComponent = StatusOfflineIcon; - } - - return ; +const StatusIcon = ({ + className = '', + button = false, + status, + type, +}: Props) => { + if (!status) { + return null; } -} + + let iconClassName = `status ${className}`; + + if (button) { + iconClassName = className || ''; + } + + if (type === 'avatar') { + if (status === 'online') { + return ; + } else if (status === 'away') { + return ; + } else if (status === 'dnd') { + return ; + } + return ; + } else if (status === 'online') { + return ; + } else if (status === 'away') { + return ; + } else if (status === 'dnd') { + return ; + } + return ; +}; + +export default memo(StatusIcon); diff --git a/webapp/channels/src/components/suggestion/at_mention_provider/__snapshots__/at_mention_suggestion.test.tsx.snap b/webapp/channels/src/components/suggestion/at_mention_provider/__snapshots__/at_mention_suggestion.test.tsx.snap index 574a3bee61..f7669b8229 100644 --- a/webapp/channels/src/components/suggestion/at_mention_provider/__snapshots__/at_mention_suggestion.test.tsx.snap +++ b/webapp/channels/src/components/suggestion/at_mention_provider/__snapshots__/at_mention_suggestion.test.tsx.snap @@ -63,10 +63,7 @@ exports[`at mention suggestion Should display nick name of non signed in user 1` /> - + - +