diff --git a/app/components/channel_drawer/channels_list/index.js b/app/components/channel_drawer/channels_list/index.js
index 203c1e7a7..ef6cb7cc8 100644
--- a/app/components/channel_drawer/channels_list/index.js
+++ b/app/components/channel_drawer/channels_list/index.js
@@ -52,8 +52,7 @@ class ChannelsList extends Component {
term: ''
};
- MaterialIcon.getImageSource('close', 20, this.props.theme.sidebarHeaderTextColor).
- then((source) => {
+ MaterialIcon.getImageSource('close', 20, this.props.theme.sidebarHeaderTextColor).then((source) => {
this.closeButton = source;
});
}
diff --git a/app/components/channel_icon.js b/app/components/channel_icon.js
index 1166d1e27..d537a545b 100644
--- a/app/components/channel_icon.js
+++ b/app/components/channel_icon.js
@@ -16,89 +16,111 @@ import {General} from 'mattermost-redux/constants';
import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme';
-function channelIcon(props) {
- const {isActive, hasUnread, isInfo, membersCount, size, status, theme, type} = props;
- const style = getStyleSheet(theme);
+export default class ChannelIcon extends React.PureComponent {
+ static propTypes = {
+ isActive: PropTypes.bool,
+ isInfo: PropTypes.bool,
+ hasUnread: PropTypes.bool,
+ membersCount: PropTypes.number,
+ size: PropTypes.number,
+ status: PropTypes.string,
+ theme: PropTypes.object.isRequired,
+ type: PropTypes.string.isRequired
+ };
- let activeIcon;
- let unreadIcon;
- let activeGroupBox;
- let unreadGroupBox;
- let activeGroup;
- let unreadGroup;
+ static defaultProps = {
+ isActive: false,
+ isInfo: false,
+ hasUnread: false,
+ size: 12
+ };
- if (hasUnread) {
- unreadIcon = style.iconUnread;
- unreadGroupBox = style.groupBoxUnread;
- unreadGroup = style.groupUnread;
- }
+ render() {
+ const {isActive, hasUnread, isInfo, membersCount, size, status, theme, type} = this.props;
+ const style = getStyleSheet(theme);
- if (isActive) {
- activeIcon = style.iconActive;
- activeGroupBox = style.groupBoxActive;
- activeGroup = style.groupActive;
- }
+ let activeIcon;
+ let unreadIcon;
+ let activeGroupBox;
+ let unreadGroupBox;
+ let activeGroup;
+ let unreadGroup;
+ let offlineColor = changeOpacity(theme.sidebarText, 0.5);
- if (isInfo) {
- activeIcon = style.iconInfo;
- activeGroupBox = style.groupBoxInfo;
- activeGroup = style.groupInfo;
- }
+ if (hasUnread) {
+ unreadIcon = style.iconUnread;
+ unreadGroupBox = style.groupBoxUnread;
+ unreadGroup = style.groupUnread;
+ }
- if (type === General.OPEN_CHANNEL) {
- return (
-
- );
- } else if (type === General.PRIVATE_CHANNEL) {
- return (
-
- );
- } else if (type === General.GM_CHANNEL) {
- return (
-
+ if (isActive) {
+ activeIcon = style.iconActive;
+ activeGroupBox = style.groupBoxActive;
+ activeGroup = style.groupActive;
+ }
+
+ if (isInfo) {
+ activeIcon = style.iconInfo;
+ activeGroupBox = style.groupBoxInfo;
+ activeGroup = style.groupInfo;
+ offlineColor = changeOpacity(theme.centerChannelColor, 0.5);
+ }
+
+ let icon;
+
+ if (type === General.OPEN_CHANNEL) {
+ icon = (
+
+ );
+ } else if (type === General.PRIVATE_CHANNEL) {
+ icon = (
+
+ );
+ } else if (type === General.GM_CHANNEL) {
+ icon = (
{membersCount}
-
- );
- }
- switch (status) {
- case General.ONLINE:
+ );
+ } else if (type === General.DM_CHANNEL) {
+ if (status === General.ONLINE) {
+ icon = (
+
+ );
+ } else if (status === General.AWAY) {
+ icon = (
+
+ );
+ } else {
+ icon = (
+
+ );
+ }
+ }
+
return (
-
-
-
- );
- case General.AWAY:
- return (
-
-
-
- );
- default:
- return (
-
-
+
+ {icon}
);
}
@@ -106,9 +128,12 @@ function channelIcon(props) {
const getStyleSheet = makeStyleSheetFromTheme((theme) => {
return StyleSheet.create({
+ container: {
+ marginRight: 12,
+ alignItems: 'center'
+ },
icon: {
- color: changeOpacity(theme.sidebarText, 0.4),
- paddingRight: 12
+ color: changeOpacity(theme.sidebarText, 0.4)
},
iconActive: {
color: theme.sidebarTextActiveColor
@@ -119,12 +144,6 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => {
iconInfo: {
color: theme.centerChannelColor
},
- statusIcon: {
- paddingRight: 12
- },
- groupContainer: {
- paddingRight: 12
- },
groupBox: {
alignSelf: 'flex-start',
alignItems: 'center',
@@ -157,23 +176,3 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => {
}
});
});
-
-channelIcon.propTypes = {
- isActive: PropTypes.bool,
- isInfo: PropTypes.bool,
- hasUnread: PropTypes.bool,
- membersCount: PropTypes.number,
- size: PropTypes.number,
- status: PropTypes.string,
- theme: PropTypes.object.isRequired,
- type: PropTypes.string.isRequired
-};
-
-channelIcon.defaultProps = {
- isActive: false,
- isInfo: false,
- hasUnread: false,
- size: 12
-};
-
-export default channelIcon;