diff options
author | 2018-07-06 01:32:43 +0300 | |
---|---|---|
committer | 2023-01-13 10:37:53 +0300 | |
commit | 7f25b0f261b5a5fc2696054004fb24673375b91b (patch) | |
tree | 38ee591e176b4799e39eff7a16f1950e017e7bb4 /vnext/src/components/Chat.js | |
parent | 88732ba8c06c23a93f7248b6eabc182f38be3d33 (diff) |
Proptypes & eslint
Diffstat (limited to 'vnext/src/components/Chat.js')
-rw-r--r-- | vnext/src/components/Chat.js | 13 |
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', |