add icon indicators for muted and blocked contacts

This commit is contained in:
or-else
2019-04-07 09:28:54 +03:00
parent 545b0c79cb
commit 4bd0052d9f
8 changed files with 78 additions and 28 deletions
+11 -5
View File
@@ -1,17 +1,23 @@
import React from 'react';
/* Contact's labels: [you], [muted], [blocked], etc */
// FIXME: this class is unused.
const icon_mapping = {'muted': 'notifications_off', 'banned': 'block'};
/* Contact's labels: [you], or icons [muted], [blocked] */
export default class ContactBadges extends React.PureComponent {
render() {
let badges = null;
if (this.props.badges && this.props.badges.length > 0) {
badges = [];
this.props.badges.map(function(b) {
let style = 'badge' + (b.color ? ' ' + b.color : '');
badges.push(<span className={style} key={b.key || b.name}>{b.name}</span>);
if (b.icon) {
badges.push(<i className="material-icons as-badge" key={b.key || b.icon}>{icon_mapping[b.icon]}</i>);
} else {
const style = 'badge' + (b.color ? ' ' + b.color : '');
badges.push(<span className={style} key={b.key || b.name}>{b.name}</span>);
}
});
return <React.Fragment>{badges}</React.Fragment>;
}
return <span>{badges}</span>;
return null;
}
};