Merge pull request #676 from petermein/user-online-indicators

User online indicators
This commit is contained in:
Toby Zerner 2016-01-02 09:34:11 +10:30
commit 0fcc8dca46
3 changed files with 25 additions and 0 deletions

View File

@ -2,6 +2,7 @@ import Component from 'flarum/Component';
import UserCard from 'flarum/components/UserCard';
import avatar from 'flarum/helpers/avatar';
import username from 'flarum/helpers/username';
import userOnline from 'flarum/helpers/userOnline';
import listItems from 'flarum/helpers/listItems';
/**
@ -45,6 +46,7 @@ export default class PostUser extends Component {
return (
<div className="PostUser">
{userOnline(user)}
<h3>
<a href={app.route.user(user)} config={m.route}>
{avatar(user, {className: 'PostUser-avatar'})}{' '}{username(user)}

View File

@ -0,0 +1,13 @@
import icon from 'flarum/helpers/icon';
/**
* The `useronline` helper displays a green circle if the user is online
*
* @param {User} user
* @return {Object}
*/
export default function userOnline(user) {
if (user.lastSeenTime() && user.isOnline()) {
return <span className="UserOnline">{icon('circle')}</span>;
}
}

View File

@ -49,6 +49,16 @@
font-size: 14px;
}
.UserOnline {
& .icon {
font-size: 12px;
}
& .fa-circle {
color: @online-user-circle-color;
}
}
.UserCard {
position: absolute;
top: -10px;