"use strict";
var UserLogin = React.createClass({
authorizeId(id) {
socket.emit("users:authorize", {
id: parseInt(id, 10)
});
setTimeout(function () {
socket.emit("gather:refresh");
}, 1000);
},
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 UserMenu = React.createClass({
getDefaultProps() {
return {
users: []
};
},
componentDidMount() {
let self = this;
socket.on('users:update', data => self.setProps({users: data.users}));
},
render() {
let users = this.props.users.map(user => {
return (
{user.username}
);
});
return (
Online
{this.props.users.length}
);
}
});
var AdminPanel = React.createClass({
handleGatherReset() {
socket.emit("gather:reset");
},
render() {
return (
Swap Into a Different Account
Gather Options
);
}
});
var ProfileModal = React.createClass({
componentDidMount() {
let self = this;
socket.on("users:update", data => self.setProps({user: data.currentUser}));
},
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 division = this.props.user.profile.skill;
let skillLevels = ["Low Skill", "Medium Skill", "High Skill"].map(skill => {
if (skill === skill) {
return
} else {
return
}
});
return (
);
}
});
var CurrentUser = React.createClass({
componentDidMount() {
let self = this;
React.render(, document.getElementById('admin-menu'));
React.render(, document.getElementById('profile-panel'));
socket.on("users:update", data => self.setProps({user: data.currentUser}));
socket.emit("users:refresh");
},
render() {
if (this.props.user) {
var adminOptions;
if (this.props.user.admin) {
adminOptions = (
Administration
)
}
return (
{this.props.user.username}
);
} else {
return false;
}
}
});