"use strict";
var UserLogin = React.createClass({
authorizeId(id) {
socket.emit("users:authorize", {
id: parseInt(id, 10)
});
},
handleSubmit(e) {
e.preventDefault();
let id = React.findDOMNode(this.refs.authorize_id).value.trim();
if (!id) return;
React.findDOMNode(this.refs.authorize_id).value = '';
this.authorizeId(id);
},
render() {
return (
);
}
});
var UserModal = React.createClass({
render() {
let user = this.props.user;
console.log(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)})
]
}
return (
×
{user.username}
Close
);
}
})
var UserItem = React.createClass({
render() {
let user = this.props.user;
return (
{user.username}
);
}
});
var UserMenu = React.createClass({
render() {
let users = this.props.users.map(user => {
return
});
return (
Online
{this.props.users.length}
);
}
});
var AdminPanel = React.createClass({
handleGatherReset() {
socket.emit("gather:reset");
},
render() {
return (
×
Administration Panel
Close
);
}
});
var ProfileModal = React.createClass({
handleUserUpdate(e) {
e.preventDefault();
let abilities = {
skulk: React.findDOMNode(this.refs.skulk).checked,
lerk: React.findDOMNode(this.refs.lerk).checked,
gorge: React.findDOMNode(this.refs.gorge).checked,
fade: React.findDOMNode(this.refs.fade).checked,
onos: React.findDOMNode(this.refs.onos).checked,
commander: React.findDOMNode(this.refs.commander).checked
};
let skill = React.findDOMNode(this.refs.playerskill).value;
socket.emit("users:update:profile", {
id: this.props.user.id,
profile: {
abilities: abilities,
skill: skill
}
});
},
render() {
if (!this.props.user) return false;
let abilities = this.props.user.profile.abilities;
let abilitiesForm = [];
for (let lifeform in abilities) {
abilitiesForm.push(
{_.capitalize(lifeform)}
);
}
let skillLevel = this.props.user.profile.skill;
let skillLevels = _.uniq(["Low Skill", "Medium Skill", "High Skill", skillLevel])
.filter(skill => { return typeof skill === 'string' })
.map(skill => { return {skill} });
return (
);
}
});
var CurrentUser = React.createClass({
render() {
if (this.props.user) {
var adminOptions;
if (this.props.user.admin) {
adminOptions = (
Administration
)
}
return (
{this.props.user.username}
);
} else {
return false;
}
}
});
var AssumeUserIdButton = React.createClass({
assumeId(e) {
e.preventDefault();
if (this.props.gatherer) {
socket.emit("users:authorize", {
id: this.props.gatherer.id
});
// Refresh Gather list
setTimeout(() => {
socket.emit("gather:refresh");
}, 5000);
}
},
render() {
let currentUser = this.props.currentUser;
let gatherer = this.props.gatherer;
if (currentUser && gatherer) {
return Assume User ID
}
}
});