mirror of
https://github.com/ENSL/ensl_gathers.git
synced 2024-11-27 22:52:36 +00:00
114 lines
No EOL
11 KiB
JavaScript
114 lines
No EOL
11 KiB
JavaScript
"use strict";
|
||
|
||
var UserCounter = React.createClass({displayName: "UserCounter",
|
||
render: function () {
|
||
return (
|
||
React.createElement("li", null,
|
||
React.createElement("a", {href: "#"},
|
||
React.createElement("i", {className: "fa fa-users fa-fw"}), " Online",
|
||
React.createElement("span", {className: "badge add-left"}, " ", this.props.count, " ")
|
||
)
|
||
)
|
||
);
|
||
}
|
||
});
|
||
|
||
var UserLogin = React.createClass({displayName: "UserLogin",
|
||
authorizeId: function (id) {
|
||
id = parseInt(id, 10);
|
||
socket.emit("users:authorize", {
|
||
id: id
|
||
});
|
||
},
|
||
handleSubmit: function (e) {
|
||
e.preventDefault();
|
||
var id = React.findDOMNode(this.refs.authorize_id).value.trim();
|
||
if (!id) return;
|
||
React.findDOMNode(this.refs.authorize_id).value = '';
|
||
this.authorizeId(id);
|
||
return;
|
||
},
|
||
render: function () {
|
||
return (
|
||
React.createElement("form", {onSubmit: this.handleSubmit},
|
||
React.createElement("div", {className: "input-group signin"},
|
||
React.createElement("input", {
|
||
id: "btn-input",
|
||
type: "text",
|
||
className: "form-control",
|
||
ref: "authorize_id",
|
||
placeholder: "Choose an ID..."}),
|
||
React.createElement("span", {className: "input-group-btn"},
|
||
React.createElement("input", {
|
||
type: "submit",
|
||
className: "btn btn-primary",
|
||
id: "btn-chat",
|
||
value: "Login"})
|
||
)
|
||
),
|
||
React.createElement("div", {className: "signin"},
|
||
React.createElement("p", {className: "text-center"}, React.createElement("small", null, "Just a temporary measure until genuine authentication is implemented"))
|
||
)
|
||
)
|
||
);
|
||
}
|
||
})
|
||
|
||
var UserMenu = React.createClass({displayName: "UserMenu",
|
||
getDefaultProps: function () {
|
||
return {
|
||
count: 0,
|
||
users: []
|
||
};
|
||
},
|
||
componentDidMount: function () {
|
||
socket.on('users:update', this.updateUsers);
|
||
},
|
||
updateUsers: function (data) {
|
||
this.setProps({
|
||
count: data.count,
|
||
users: data.users
|
||
});
|
||
},
|
||
render: function () {
|
||
var users = this.props.users.map(function (user) {
|
||
return (
|
||
React.createElement("li", {key: user.id}, React.createElement("a", {href: "#"}, user.username))
|
||
);
|
||
});
|
||
return (
|
||
React.createElement("ul", {className: "nav", id: "side-menu"},
|
||
React.createElement(UserCounter, React.__spread({}, this.props)),
|
||
users,
|
||
React.createElement("li", null, React.createElement("br", null), React.createElement(UserLogin, null), React.createElement("br", null))
|
||
)
|
||
);
|
||
}
|
||
});
|
||
|
||
var CurrentUser = React.createClass({displayName: "CurrentUser",
|
||
componentDidMount: function () {
|
||
var self = this;
|
||
socket.on("users:update", function (data) {
|
||
self.setProps({
|
||
user: data.currentUser
|
||
});
|
||
});
|
||
socket.emit("users:refresh", {});
|
||
},
|
||
render: function () {
|
||
if (this.props.user) {
|
||
return (
|
||
React.createElement("a", {href: "#"}, this.props.user.username, " ", React.createElement("img", {src: this.props.user.avatar,
|
||
alt: "User Avatar",
|
||
height: "20",
|
||
width: "20"}))
|
||
);
|
||
} else {
|
||
return false;
|
||
}
|
||
}
|
||
});
|
||
|
||
alert("foo")
|
||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNmb3JtZWQuanMiLCJzb3VyY2VzIjpbbnVsbF0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLFlBQVksQ0FBQzs7QUFFYixJQUFJLGlDQUFpQywyQkFBQTtDQUNwQyxNQUFNLEVBQUUsWUFBWTtFQUNuQjtHQUNDLG9CQUFBLElBQUcsRUFBQSxJQUFDLEVBQUE7SUFDSCxvQkFBQSxHQUFFLEVBQUEsQ0FBQSxDQUFDLElBQUEsRUFBSSxDQUFDLEdBQUksQ0FBQSxFQUFBO0tBQ1gsb0JBQUEsR0FBRSxFQUFBLENBQUEsQ0FBQyxTQUFBLEVBQVMsQ0FBQyxtQkFBb0IsQ0FBSSxDQUFBLE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