"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 DisconnectUserButton = React.createClass({
getDefaultProps() {
return {
id: null
};
},
disconnectUser() {
socket.emit("users:disconnect", {
id: this.props.id
});
},
render() {
return
}
});
var UserModal = React.createClass({
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.username}
{adminOptions}
);
}
})
var UserItem = React.createClass({
render() {
const user = this.props.user;
const currentUser = this.props.currentUser;
return (
{user.username}
);
}
});
var UserMenu = React.createClass({
render() {
const users = this.props.users
.sort((a, b) => (a.username.toLowerCase() > b.username.toLowerCase()) ? 1 : -1)
.map(user => {
return
});
return (
Online
{this.props.users.length}
);
}
});
var AdminPanel = React.createClass({
handleGatherReset() {
socket.emit("gather:reset");
},
render() {
return (
Administration Panel
);
}
});
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(
);
}
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 });
return (
);
}
});
var CurrentUser = React.createClass({
render() {
if (this.props.user) {
var adminOptions;
if (this.props.user.admin || this.props.user.moderator) {
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
}
}
});