mirror of
https://github.com/ENSL/ensl_gathers.git
synced 2024-11-22 20:51:23 +00:00
Simplify
This commit is contained in:
parent
5b4abf5115
commit
cb49b15eab
2 changed files with 11 additions and 22 deletions
|
@ -58,7 +58,6 @@ var UserMenu = React.createClass({
|
|||
});
|
||||
});
|
||||
},
|
||||
updateUsers: ,
|
||||
render: function () {
|
||||
var users = this.props.users.map(function (user) {
|
||||
return (
|
||||
|
|
|
@ -759,19 +759,6 @@ var MessageBar = React.createClass({displayName: "MessageBar",
|
|||
|
||||
"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);
|
||||
|
@ -819,18 +806,16 @@ var UserLogin = React.createClass({displayName: "UserLogin",
|
|||
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,
|
||||
var self = this;
|
||||
socket.on('users:update', function (data) {
|
||||
self.setProps({
|
||||
users: data.users
|
||||
});
|
||||
});
|
||||
},
|
||||
render: function () {
|
||||
var users = this.props.users.map(function (user) {
|
||||
|
@ -840,7 +825,12 @@ var UserMenu = React.createClass({displayName: "UserMenu",
|
|||
});
|
||||
return (
|
||||
React.createElement("ul", {className: "nav", id: "side-menu"},
|
||||
React.createElement(UserCounter, React.__spread({}, this.props)),
|
||||
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.users.length, " ")
|
||||
)
|
||||
),
|
||||
users,
|
||||
React.createElement("li", null, React.createElement("br", null), React.createElement(UserLogin, null), React.createElement("br", null))
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue