aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/components/Chat.js
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/src/components/Chat.js')
-rw-r--r--vnext/src/components/Chat.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/vnext/src/components/Chat.js b/vnext/src/components/Chat.js
index 916de003..dd94dd9e 100644
--- a/vnext/src/components/Chat.js
+++ b/vnext/src/components/Chat.js
@@ -1,4 +1,6 @@
import React from 'react';
+import ReactRouterPropTypes from 'react-router-prop-types';
+import { UserType } from './Types';
import moment from 'moment';
import PM from './PM';
@@ -14,7 +16,7 @@ export default class Chat extends React.Component {
chats: []
};
}
- componentWillMount() {
+ componentDidMount() {
this.loadChat(this.props.match.params.user);
}
@@ -57,14 +59,14 @@ export default class Chat extends React.Component {
{uname ? (
<div className="chatroom">
- <ul style={chatStyle} ref="chats">
+ <ul style={chatStyle}>
{
chats.map((chat) =>
<PM key={moment.utc(chat.timestamp).valueOf()} chat={chat} {...this.props} />
)
}
</ul>
- <MessageInput data={{ mid: 0, timestamp: "0", to: { uname: uname } }} onSend={this.onSend}>
+ <MessageInput data={{ mid: 0, timestamp: '0', to: { uname: uname } }} onSend={this.onSend}>
Reply...
</MessageInput>
</div>
@@ -78,6 +80,11 @@ export default class Chat extends React.Component {
}
}
+Chat.propTypes = {
+ visitor: UserType.isRequired,
+ match: ReactRouterPropTypes.match.isRequired
+};
+
const chatStyle = {
boxSizing: 'border-box',
padding: '0 20px',