adding support for trusted, verified/staff/danger badges, wip
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
|
||||
const icon_mapping = {'muted': 'notifications_off', 'banned': 'block'};
|
||||
const icon_mapping = {'muted': 'notifications_off', 'banned': 'block',
|
||||
'verified': 'verified', 'staff': 'verified_user', 'dangerous': 'dangerous'};
|
||||
|
||||
/* Contact's labels: [you], or icons [muted], [blocked] */
|
||||
export default class ContactBadges extends React.PureComponent {
|
||||
@@ -10,7 +11,7 @@ export default class ContactBadges extends React.PureComponent {
|
||||
badges = [];
|
||||
this.props.badges.map(function(b) {
|
||||
if (b.icon) {
|
||||
badges.push(<i className="material-icons as-badge" key={b.key || b.icon}>{icon_mapping[b.icon]}</i>);
|
||||
badges.push(<i className="material-icons as-badge" key={b.key || b.icon}>{icon_mapping[b.icon] || b.icon}</i>);
|
||||
} else {
|
||||
const style = 'badge' + (b.color ? ' ' + b.color : '');
|
||||
badges.push(<span className={style} key={b.key || b.name}>{b.name}</span>);
|
||||
|
||||
@@ -105,6 +105,9 @@ class ContactList extends React.Component {
|
||||
isChannel={isChannel}
|
||||
onSelected={this.props.onTopicSelected}
|
||||
showContextMenu={this.props.showContextMenu}
|
||||
isVerified={c.isVerified()}
|
||||
isStaff={c.isStaff()}
|
||||
isDangerous={c.isDangerous()}
|
||||
item={key}
|
||||
index={contactNodes.length}
|
||||
key={key} />
|
||||
|
||||
+10
-1
@@ -65,6 +65,15 @@ class Contact extends React.Component {
|
||||
const avatar = this.props.avatar ? this.props.avatar : true;
|
||||
const badges = this.props.badges ? this.props.badges.slice() : [];
|
||||
const icon_badges = [];
|
||||
if (this.props.isVerified) {
|
||||
icon_badges.push({icon: 'verified'});
|
||||
}
|
||||
if (this.props.isStaff) {
|
||||
icon_badges.push({icon: 'staff'});
|
||||
}
|
||||
if (this.props.isDangerous) {
|
||||
icon_badges.push({icon: 'dangerous'});
|
||||
}
|
||||
if (this.props.acs) {
|
||||
if (this.props.showMode) {
|
||||
badges.push({name: this.props.acs.getMode(), key: 'mode'});
|
||||
@@ -101,7 +110,7 @@ class Contact extends React.Component {
|
||||
<div className="text-box">
|
||||
<div><span className="contact-title">{title}</span>
|
||||
{this.props.isChannel ? <img src="/img/channel.png" className="channel" alt="channel" /> : null}
|
||||
<UnreadBadge count={this.props.unread} /><ContactBadges badges={icon_badges} />
|
||||
<ContactBadges badges={icon_badges} /><UnreadBadge count={this.props.unread} />
|
||||
</div>
|
||||
{this.props.showMode ?
|
||||
<span><ContactBadges badges={badges} /></span> :
|
||||
|
||||
Reference in New Issue
Block a user