import React from 'react';
import Avatar from 'misago/components/avatar'; // jshint ignore:line
import Status, { StatusIcon, StatusLabel } from 'misago/components/user-status'; // jshint ignore:line
export default class extends React.Component {
getClassName() {
if (this.props.user.rank.css_class) {
return 'user-card user-card-' + this.props.user.rank.css_class + ' ui-ready';
} else {
return 'user-card ui-ready';
}
}
getUserStatus() {
if (this.props.showStatus) {
if (this.props.user.status) {
/* jshint ignore:start */
return
;
/* jshint ignore:end */
} else {
/* jshint ignore:start */
return
;
/* jshint ignore:end */
}
} else {
return null;
}
}
getRankName() {
if (this.props.showRank) {
if (this.props.user.rank.is_tab) {
/* jshint ignore:start */
return
{this.props.user.rank.name}
;
/* jshint ignore:end */
} else {
/* jshint ignore:start */
return
{this.props.user.rank.name}
;
/* jshint ignore:end */
}
} else {
return null;
}
}
getUserTitle() {
if (this.props.user.title) {
/* jshint ignore:start */
return {this.props.user.title};
/* jshint ignore:end */
} else {
return null;
}
}
getUserJoinedOn() {
/* jshint ignore:start */
let title = interpolate(gettext("Joined on %(joined_on)s"), {
'joined_on': this.props.user.joined_on.format('LL, LT')
}, true);
let age = interpolate(gettext("Joined %(joined_on)s"), {
'joined_on': this.props.user.joined_on.fromNow()
}, true);
return
{age}
;
/* jshint ignore:end */
}
getPostsCount() {
let message = ngettext(
"%(posts)s post",
"%(posts)s posts",
this.props.user.posts);
return interpolate(message, {
'posts': this.props.user.posts
}, true);
}
getThreadsCount() {
let message = ngettext(
"%(threads)s thread",
"%(threads)s threads",
this.props.user.threads);
return interpolate(message, {
'threads': this.props.user.threads
}, true);
}
getFollowersCount() {
let message = ngettext(
"%(followers)s follower",
"%(followers)s followers",
this.props.user.followers);
return interpolate(message, {
'followers': this.props.user.followers
}, true);
}
render() {
/* jshint ignore:start */
return
{this.getUserStatus()}
{this.getRankName()}
{this.getUserTitle()}
{this.getUserJoinedOn()}
-
{this.getPostsCount()}
-
{this.getThreadsCount()}
-
{this.getFollowersCount()}
;
/* jshint ignore:end */
}
}