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 () {
|
render: function () {
|
||||||
var users = this.props.users.map(function (user) {
|
var users = this.props.users.map(function (user) {
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -759,19 +759,6 @@ var MessageBar = React.createClass({displayName: "MessageBar",
|
||||||
|
|
||||||
"use strict";
|
"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",
|
var UserLogin = React.createClass({displayName: "UserLogin",
|
||||||
authorizeId: function (id) {
|
authorizeId: function (id) {
|
||||||
id = parseInt(id, 10);
|
id = parseInt(id, 10);
|
||||||
|
@ -819,17 +806,15 @@ var UserLogin = React.createClass({displayName: "UserLogin",
|
||||||
var UserMenu = React.createClass({displayName: "UserMenu",
|
var UserMenu = React.createClass({displayName: "UserMenu",
|
||||||
getDefaultProps: function () {
|
getDefaultProps: function () {
|
||||||
return {
|
return {
|
||||||
count: 0,
|
|
||||||
users: []
|
users: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
componentDidMount: function () {
|
componentDidMount: function () {
|
||||||
socket.on('users:update', this.updateUsers);
|
var self = this;
|
||||||
},
|
socket.on('users:update', function (data) {
|
||||||
updateUsers: function (data) {
|
self.setProps({
|
||||||
this.setProps({
|
users: data.users
|
||||||
count: data.count,
|
});
|
||||||
users: data.users
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
render: function () {
|
render: function () {
|
||||||
|
@ -840,7 +825,12 @@ var UserMenu = React.createClass({displayName: "UserMenu",
|
||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
React.createElement("ul", {className: "nav", id: "side-menu"},
|
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,
|
users,
|
||||||
React.createElement("li", null, React.createElement("br", null), React.createElement(UserLogin, null), React.createElement("br", null))
|
React.createElement("li", null, React.createElement("br", null), React.createElement(UserLogin, null), React.createElement("br", null))
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue