const React = require("react"); import {MenubarMixin} from "javascripts/components/menubar"; const UserLogin = React.createClass({ propTypes: { socket: React.PropTypes.object.isRequired }, getInitialState() { return { userId: null }; }, handleChange(e) { const newId = e.target.value || null; this.setState({ userId: newId }); }, authorizeId(id) { this.props.socket.emit("users:authorize", { id: id }); }, handleSubmit(e) { e.preventDefault(); this.authorizeId(this.state.userId); }, render() { return (
); } }); const ResetGatherButton = exports.ResetGatherButton = React.createClass({ propTypes: { socket: React.PropTypes.object.isRequired, gather: React.PropTypes.object.isRequired }, handleGatherReset() { this.props.socket.emit("gather:reset", { type: this.props.gather.type }); }, render() { return ( ); } }); const AdminPanel = exports.AdminPanel = React.createClass({ mixins: [MenubarMixin], propTypes: { socket: React.PropTypes.object.isRequired, gatherPool: React.PropTypes.object.isRequired }, render() { const gatherPool = this.props.gatherPool; const resetButtons = []; for (let attr in gatherPool) { let gather = gatherPool[attr]; resetButtons.push(