mirror of
https://github.com/flarum/framework.git
synced 2024-11-24 19:53:16 +08:00
Merge pull request #676 from petermein/user-online-indicators
User online indicators
This commit is contained in:
commit
0fcc8dca46
|
@ -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)}
|
||||
|
|
13
js/lib/helpers/userOnline.js
Normal file
13
js/lib/helpers/userOnline.js
Normal 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>;
|
||||
}
|
||||
}
|
|
@ -49,6 +49,16 @@
|
|||
font-size: 14px;
|
||||
}
|
||||
|
||||
.UserOnline {
|
||||
& .icon {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
& .fa-circle {
|
||||
color: @online-user-circle-color;
|
||||
}
|
||||
}
|
||||
|
||||
.UserCard {
|
||||
position: absolute;
|
||||
top: -10px;
|
||||
|
|
Loading…
Reference in New Issue
Block a user