Skip to content

Commit

Permalink
Add icon to channel switcher and class prop to status icon
Browse files Browse the repository at this point in the history
  • Loading branch information
jwilander committed Feb 28, 2017
1 parent 11ccb9b commit 89dd0ee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 6 additions & 1 deletion webapp/components/status_icon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,20 @@ export default class StatusIcon extends React.Component {

return (
<span
className='status'
className={'status ' + this.props.className}
dangerouslySetInnerHTML={{__html: statusIcon}}
/>
);
}

}

StatusIcon.defaultProps = {
className: ''
};

StatusIcon.propTypes = {
status: React.PropTypes.string,
className: React.PropTypes.string,
type: React.PropTypes.string
};
7 changes: 5 additions & 2 deletions webapp/components/suggestion/switch_channel_provider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Client from 'client/web_client.jsx';
import AppDispatcher from 'dispatcher/app_dispatcher.jsx';
import {Constants, ActionTypes} from 'utils/constants.jsx';
import * as Utils from 'utils/utils.jsx';
import {sortChannelsByDisplayName} from 'utils/channel_utils.jsx';
import {sortChannelsByDisplayName, buildGroupChannelName} from 'utils/channel_utils.jsx';

import React from 'react';

Expand All @@ -25,12 +25,15 @@ class SwitchChannelSuggestion extends Suggestion {
className += ' suggestion--selected';
}

const displayName = item.display_name;
let displayName = item.display_name;
let icon = null;
if (item.type === Constants.OPEN_CHANNEL) {
icon = <div className='status'><i className='fa fa-globe'/></div>;
} else if (item.type === Constants.PRIVATE_CHANNEL) {
icon = <div className='status'><i className='fa fa-lock'/></div>;
} else if (item.type === Constants.GM_CHANNEL) {
displayName = buildGroupChannelName(item.id);
icon = <div className='status'>{UserStore.getProfileListInChannel(item.id, true).length}</div>;
} else {
icon = (
<div className='pull-left'>
Expand Down

0 comments on commit 89dd0ee

Please sign in to comment.