import React from 'react'; import Avatar from 'misago/components/avatar'; // jshint ignore:line import DropdownToggle from 'misago/components/dropdown-toggle'; // jshint ignore:line import FollowButton from './follow-button'; // jshint ignore:line import MessageButton from './message-button'; // jshint ignore:line import ModerationNav from './moderation/nav'; // jshint ignore:line import { CompactNav } from './navs'; // jshint ignore:line import Status, { StatusIcon, StatusLabel } from 'misago/components/user-status'; // jshint ignore:line export default class extends React.Component { getUserStatus() { /* jshint ignore:start */ return (
  • ); /* jshint ignore:end */ } getUserRank() { if (this.props.profile.rank.is_tab) { /* jshint ignore:start */ return (
  • {this.props.profile.rank.name}
  • ); /* jshint ignore:end */ } else { /* jshint ignore:start */ return (
  • {this.props.profile.rank.name}
  • ); /* jshint ignore:end */ } } getUserTitle() { if (this.props.profile.title) { /* jshint ignore:start */ return (
  • {this.props.profile.title}
  • ); /* jshint ignore:end */ } else if (this.props.profile.rank.title) { /* jshint ignore:start */ return (
  • {this.props.profile.rank.title}
  • ); /* jshint ignore:end */ } else { return null; } } getJoinedOn() { /* jshint ignore:start */ let title = interpolate(gettext("Joined on %(joined_on)s"), { 'joined_on': this.props.profile.joined_on.format('LL, LT') }, true); let age = interpolate(gettext("Joined %(joined_on)s"), { 'joined_on': this.props.profile.joined_on.fromNow() }, true); return (
  • {age}
  • ); /* jshint ignore:end */ } getEmail() { if (this.props.profile.email) { /* jshint ignore:start */ return (
  • {this.props.profile.email}
  • ); /* jshint ignore:end */ } else { return null; } } getFollowButton() { if (this.props.profile.acl.can_follow) { /* jshint ignore:start */ return ( ); /* jshint ignore:end */ } else { return null; } } getModerationButton() { if (this.props.profile.acl.can_moderate) { /* jshint ignore:start */ return (
    ); /* jshint ignore:end */ } else { return null; } } render() { /* jshint ignore:start */ const canFollow = this.props.profile.acl.can_follow; const canModerate = this.props.profile.acl.can_moderate; const isProfileOwner = this.props.user.id === this.props.profile.id; const canMessage = !isProfileOwner && this.props.user.acl.can_start_private_threads; let cols = 0; if (canFollow) cols += 1; if (canModerate) cols += 1; if (canMessage) cols += 1; const colsWidth = cols ? 2 * cols + 1 : 0; let headerClassName = 'page-header'; if (this.props.profile.rank.css_class) { headerClassName += ' page-header-rank-' + this.props.profile.rank.css_class; } return (

    {this.props.profile.username}

    {!!cols && (
    {canMessage && (
    )} {canFollow && (
    {this.getFollowButton()}
    )} {canModerate && (
    {this.getModerationButton()}
    )}
    )}
      {this.getUserStatus()} {this.getUserRank()} {this.getUserTitle()} {this.getJoinedOn()} {this.getEmail()}
    ); /* jshint ignore:end */ } } /* jshint ignore:start */ export function IsDisabledMessage(props) { if (props.isActive !== false) return null; return (

    {gettext("This user's account has been disabled by administrator.")}

    ); } export function getColStyle(cols, col) { let colStyle = ""; if (cols == 1) { colStyle = "col-xs-12"; } if (cols == 2) { colStyle = "col-xs-6 col-sm-6"; } if (cols == 3) { if (col == 2) { colStyle = "col-xs-12 col-sm-4 xs-margin-top"; } else { colStyle += "col-xs-6 col-sm-4"; } } return colStyle; } /* jshint ignore:end */