This commit is contained in:
Chris Blanchard 2015-07-31 11:49:59 +01:00
parent 5b4abf5115
commit cb49b15eab
2 changed files with 11 additions and 22 deletions

View file

@ -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 (

View file

@ -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))
) )