import {LifeformIcons} from "javascripts/components/gather"; const React = require("react"); const helper = require("javascripts/helper"); const enslUrl = helper.enslUrl; const hiveUrl = helper.hiveUrl; const modalId = helper.modalId; const Ps = require('perfect-scrollbar'); const DisconnectUserButton = React.createClass({ propTypes: { socket: React.PropTypes.object.isRequired, id: React.PropTypes.number.isRequired }, getDefaultProps() { return { id: null }; }, disconnectUser() { this.props.socket.emit("users:disconnect", { id: this.props.id }); }, render() { return } }); const UserModal = React.createClass({ propTypes: { user: React.PropTypes.object.isRequired, socket: React.PropTypes.object.isRequired, currentUser: React.PropTypes.object.isRequired, close: React.PropTypes.func.isRequired }, render() { const currentUser = this.props.currentUser; const user = this.props.user; let hiveStats; if (user.hive.id) { hiveStats = [ Hive Stats, ELO {user.hive.skill} , Hours Played {Math.round(user.hive.playTime / 3600)} , Wins {user.hive.wins} , Losses {user.hive.loses} , Kills (/min) {user.hive.kills} ({_.round(user.hive.kills / (user.hive.playTime / 60), 1)}) , Assists (/min) {user.hive.assists} ({_.round(user.hive.assists / (user.hive.playTime / 60), 1)}) , Deaths (/min) {user.hive.deaths} ({_.round(user.hive.deaths / (user.hive.playTime / 60), 1)}) ] } let adminOptions; if (currentUser.admin) { adminOptions = ; } return (

{user.country}  {user.username}

User Avatar
{hiveStats}
Lifeforms
Links ENSL Profile  Hive Profile
{adminOptions}
); } }) const UserItem = React.createClass({ propTypes: { user: React.PropTypes.object.isRequired, socket: React.PropTypes.object.isRequired, currentUser: React.PropTypes.object.isRequired, mountModal: React.PropTypes.func.isRequired }, openModal(e) { e.preventDefault(); this.props.mountModal({ component: UserModal, props: { user: this.props.user, currentUser: this.props.currentUser, socket: this.props.socket } }); }, render() { const user = this.props.user; const currentUser = this.props.currentUser; return (
  • {user.username}
  • ); } }); const UserMenu = exports.UserMenu = React.createClass({ propTypes: { socket: React.PropTypes.object.isRequired, users: React.PropTypes.array.isRequired, mountModal: React.PropTypes.func.isRequired }, componentDidMount() { }, render() { const users = this.props.users .sort((a, b) => (a.username.toLowerCase() > b.username.toLowerCase()) ? 1 : -1) .map(user => { return }); return (
      {users}
    ); } }); const ProfileModal = exports.ProfileModal = React.createClass({ propTypes: { user: React.PropTypes.object.isRequired, socket: React.PropTypes.object.isRequired, close: React.PropTypes.func.isRequired }, getInitialState() { const user = this.props.user; console.log(user.profile); return { abilities: { skulk: user.profile.abilities.skulk, lerk: user.profile.abilities.lerk, gorge: user.profile.abilities.gorge, fade: user.profile.abilities.fade, onos: user.profile.abilities.onos, commander: user.profile.abilities.commander }, skill: user.profile.skill }; }, handleUserUpdate(e) { e.preventDefault(); this.props.socket.emit("users:update:profile", { id: this.props.user.id, profile: { abilities: this.state.abilities, skill: this.state.skill } }); this.props.close(); }, handleAbilityChange(e) { let abilities = this.state.abilities; abilities[e.target.name] = e.target.checked; this.setState({abilities: abilities}); }, handleSkillChange(e) { this.setState({ skill: e.target.value }); }, render() { const user = this.props.user; if (!user) return false; const abilities = this.state.abilities; let abilitiesForm = []; for (let lifeform in abilities) { abilitiesForm.push(
    ); } let skillLevel = user.profile.skill; let skillLevels = _.uniq(["Low Skill", "Medium Skill", "High Skill", skillLevel]) .filter(skill => { return typeof skill === 'string' }) .map(skill => { return }); return (

    Profile


    Try to give an accurate representation of your skill to raise the quality of your gathers



    {abilitiesForm}

    Specify which lifeforms you'd like to play in the gather


    You will need to rejoin the gather to see your updated profile

    ); } }); const CurrentUser = exports.CurrentUser = React.createClass({ render() { if (this.props.user) { let adminOptions; if (this.props.user.admin || this.props.user.moderator) { adminOptions = (
  • Administration
  • ) } return (
  • {this.props.user.username}  User Avatar
  • ); } else { return false; } } }); var AssumeUserIdButton = exports.AssumeUserIdButton = React.createClass({ propTypes: { socket: React.PropTypes.object.isRequired, gatherer: React.PropTypes.object.isRequired, currentUser: React.PropTypes.object.isRequired, }, assumeId(e) { e.preventDefault(); if (this.props.gatherer) { this.props.socket.emit("users:authorize", { id: this.props.gatherer.id }); // Refresh Gather list setTimeout(() => { this.props.socket.emit("gather:refresh"); }, 5000); } }, render() { let currentUser = this.props.currentUser; let gatherer = this.props.gatherer; if (currentUser && gatherer) { return } } });