From 7f25b0f261b5a5fc2696054004fb24673375b91b Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 6 Jul 2018 01:32:43 +0300 Subject: Proptypes & eslint --- vnext/src/components/Button.js | 2 +- vnext/src/components/Chat.js | 13 ++++++++++--- vnext/src/components/Contact.js | 5 +++++ vnext/src/components/Contacts.js | 12 ++++++------ vnext/src/components/Feeds.js | 15 ++++++++++++--- vnext/src/components/Footer.js | 4 ++-- vnext/src/components/Header.js | 27 ++++++++++++++++----------- vnext/src/components/Icon.js | 2 +- vnext/src/components/Message.js | 7 ++++--- vnext/src/components/MessageInput.js | 20 ++++++++++---------- vnext/src/components/PM.js | 11 +++++++++-- vnext/src/components/Post.js | 25 +++++++++++++++++-------- vnext/src/components/Settings.js | 10 +++++----- vnext/src/components/Spinner.js | 2 +- vnext/src/components/Thread.js | 23 +++++++++++++++++------ 15 files changed, 116 insertions(+), 62 deletions(-) (limited to 'vnext/src/components') diff --git a/vnext/src/components/Button.js b/vnext/src/components/Button.js index 583f8e4b..656c0426 100644 --- a/vnext/src/components/Button.js +++ b/vnext/src/components/Button.js @@ -1,4 +1,4 @@ -import React from 'react' +import React from 'react'; export default function Button(props) { return ( 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 ? (
-
@@ -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', diff --git a/vnext/src/components/Contact.js b/vnext/src/components/Contact.js index 0e969cc1..01dd1ae6 100644 --- a/vnext/src/components/Contact.js +++ b/vnext/src/components/Contact.js @@ -1,4 +1,5 @@ import React from 'react'; +import { UserType } from './Types'; import Avatar from './Avatar'; @@ -14,3 +15,7 @@ export default class Contact extends React.Component { ); } } + +Contact.propTypes = { + user: UserType +}; diff --git a/vnext/src/components/Contacts.js b/vnext/src/components/Contacts.js index 3f2e7288..84a6ec9f 100644 --- a/vnext/src/components/Contacts.js +++ b/vnext/src/components/Contacts.js @@ -1,4 +1,5 @@ import React from 'react'; + import { getChats } from '../api'; @@ -11,7 +12,7 @@ export default class Contacts extends React.Component { pms: [] }; } - componentWillMount() { + componentDidMount() { this.refreshChats(); } @@ -26,11 +27,10 @@ export default class Contacts extends React.Component { } render() { const { pms } = this.state; - const user = this.props.visitor; return (
-