mirror of
https://github.com/ENSL/ensl_gathers.git
synced 2024-11-23 12:52:15 +00:00
148 lines
No EOL
15 KiB
JavaScript
148 lines
No EOL
15 KiB
JavaScript
"use strict";
|
|
|
|
var Chatroom = React.createClass({displayName: "Chatroom",
|
|
getDefaultProps: function () {
|
|
return {
|
|
history: []
|
|
};
|
|
},
|
|
componentDidMount: function () {
|
|
var self = this;
|
|
var TIMER_INTERVAL = 60000; // Every minute
|
|
|
|
socket.on("message:new", function (data) {
|
|
var history = self.props.history;
|
|
history.push(data);
|
|
self.setProps({
|
|
history: history
|
|
});
|
|
self.scrollToBottom();
|
|
});
|
|
|
|
// Message History Retrieved
|
|
socket.on("message:refresh", function (data) {
|
|
self.setProps({
|
|
history: data.chatHistory
|
|
});
|
|
self.scrollToBottom();
|
|
});
|
|
|
|
socket.emit("message:refresh", {});
|
|
|
|
self.timer = setInterval(function () {
|
|
if (self.refs.messages) self.refs.messages.refreshTime();
|
|
}, TIMER_INTERVAL);
|
|
},
|
|
|
|
componentDidUnmount: function () {
|
|
clearInterval(this.timer);
|
|
},
|
|
sendMessage: function (message) {
|
|
socket.emit("newMessage", {message: message});
|
|
},
|
|
scrollToBottom: function () {
|
|
var node = React.findDOMNode(this.refs.messageContainer);
|
|
node.scrollTop = node.scrollHeight;
|
|
},
|
|
render: function () {
|
|
var messages = this.props.history.map(function (message) {
|
|
return (
|
|
React.createElement(ChatMessage, {
|
|
avatar: message.author.avatar,
|
|
username: message.author.username,
|
|
content: message.content,
|
|
ref: "messages",
|
|
createdAt: message.createdAt})
|
|
);
|
|
});
|
|
return (
|
|
React.createElement("div", {className: "panel panel-default"},
|
|
React.createElement("div", {className: "panel-heading"}, "Gather Chat"),
|
|
React.createElement("div", {className: "panel-body"},
|
|
React.createElement("ul", {className: "chat", id: "chatmessages", ref: "messageContainer"},
|
|
messages
|
|
)
|
|
),
|
|
React.createElement("div", {className: "panel-footer"},
|
|
React.createElement(MessageBar, null)
|
|
)
|
|
)
|
|
);
|
|
}
|
|
});
|
|
|
|
var ChatMessage = React.createClass({displayName: "ChatMessage",
|
|
getInitialState: function () {
|
|
return {
|
|
timeAgo: $.timeago(this.props.createdAt)
|
|
}
|
|
},
|
|
refreshTime: function () {
|
|
var self = this;
|
|
self.setState({
|
|
timeAgo: $.timeago(self.props.createdAt)
|
|
});
|
|
},
|
|
render: function () {
|
|
return (
|
|
React.createElement("li", {className: "left clearfix"},
|
|
React.createElement("span", {className: "chat-img pull-left"},
|
|
React.createElement("img", {
|
|
src: this.props.avatar,
|
|
alt: "User Avatar",
|
|
height: "40",
|
|
width: "40",
|
|
className: "img-circle"})
|
|
),
|
|
React.createElement("div", {className: "chat-body clearfix"},
|
|
React.createElement("div", {className: "header"},
|
|
React.createElement("strong", {className: "primary-font"}, this.props.username),
|
|
React.createElement("small", {className: "pull-right text-muted"},
|
|
React.createElement("i", {className: "fa fa-clock-o fa-fw"}), " ", this.state.timeAgo
|
|
)
|
|
),
|
|
React.createElement("p", null, this.props.content)
|
|
)
|
|
)
|
|
);
|
|
}
|
|
});
|
|
|
|
var MessageBar = React.createClass({displayName: "MessageBar",
|
|
sendMessage: function (content) {
|
|
socket.emit("message:new", {
|
|
content: content
|
|
});
|
|
},
|
|
handleSubmit: function (e) {
|
|
e.preventDefault();
|
|
var content = React.findDOMNode(this.refs.content).value.trim();
|
|
if (!content) return;
|
|
React.findDOMNode(this.refs.content).value = '';
|
|
this.sendMessage(content);
|
|
return;
|
|
},
|
|
render: function () {
|
|
return (
|
|
React.createElement("form", {onSubmit: this.handleSubmit},
|
|
React.createElement("div", {className: "input-group"},
|
|
React.createElement("input", {
|
|
id: "btn-input",
|
|
type: "text",
|
|
className: "form-control",
|
|
ref: "content",
|
|
placeholder: "Be polite please..."}),
|
|
React.createElement("span", {className: "input-group-btn"},
|
|
React.createElement("input", {
|
|
type: "submit",
|
|
className: "btn btn-primary",
|
|
id: "btn-chat",
|
|
value: "Send"})
|
|
)
|
|
)
|
|
)
|
|
);
|
|
}
|
|
});
|
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