mirror of https://github.com/vector-im/riot-web
CSS classes to colour offline users differently
So we can use the same 66% opacity as idle tiles for offline-with-last-active-time to reduce the visual jarringpull/21833/head
parent
a5272542ef
commit
a49a545161
|
@ -29,6 +29,23 @@ var PRESENCE_CLASS = {
|
||||||
"unavailable": "mx_EntityTile_unavailable"
|
"unavailable": "mx_EntityTile_unavailable"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
function presence_class_for_member(presence_state, last_active_ago) {
|
||||||
|
// offline is split into two categories depending on whether we have
|
||||||
|
// a last_active_ago for them.
|
||||||
|
if (presence_state == 'offline') {
|
||||||
|
if (last_active_ago) {
|
||||||
|
return PRESENCE_CLASS['offline'] + '_beenactive';
|
||||||
|
} else {
|
||||||
|
return PRESENCE_CLASS['offline'] + '_neveractive';
|
||||||
|
}
|
||||||
|
} else if (presence_state) {
|
||||||
|
return PRESENCE_CLASS[presence_state];
|
||||||
|
} else {
|
||||||
|
return PRESENCE_CLASS['offline'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = React.createClass({
|
module.exports = React.createClass({
|
||||||
displayName: 'EntityTile',
|
displayName: 'EntityTile',
|
||||||
|
|
||||||
|
@ -79,7 +96,10 @@ module.exports = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
var presenceClass = PRESENCE_CLASS[this.props.presenceState] || "mx_EntityTile_offline";
|
const presenceClass = presence_class_for_member(
|
||||||
|
this.props.presenceState, this.props.presenceLastActiveAgo
|
||||||
|
);
|
||||||
|
|
||||||
var mainClassName = "mx_EntityTile ";
|
var mainClassName = "mx_EntityTile ";
|
||||||
mainClassName += presenceClass + (this.props.className ? (" " + this.props.className) : "");
|
mainClassName += presenceClass + (this.props.className ? (" " + this.props.className) : "");
|
||||||
var nameEl;
|
var nameEl;
|
||||||
|
|
Loading…
Reference in New Issue