diff --git a/client/app/bundles/comments/components/CommentBox/CommentBox.jsx b/client/app/bundles/comments/components/CommentBox/CommentBox.jsx index 68611457..edcb4cd1 100644 --- a/client/app/bundles/comments/components/CommentBox/CommentBox.jsx +++ b/client/app/bundles/comments/components/CommentBox/CommentBox.jsx @@ -1,4 +1,5 @@ -import React, { PropTypes } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import Immutable from 'immutable'; import ActionCable from 'actioncable'; import _ from 'lodash'; @@ -15,13 +16,13 @@ class CommentBox extends BaseComponent { static propTypes = { pollInterval: PropTypes.number.isRequired, actions: PropTypes.shape({ - fetchComments: React.PropTypes.function, + fetchComments: PropTypes.function, }), data: PropTypes.shape({ - isFetching: React.PropTypes.boolean, - isSaving: React.PropTypes.boolean, - submitCommentError: React.PropTypes.string, - $$comments: React.PropTypes.arrayOf(CommentPropTypes), + isFetching: PropTypes.boolean, + isSaving: PropTypes.boolean, + submitCommentError: PropTypes.string, + $$comments: PropTypes.arrayOf(CommentPropTypes), }).isRequired, intl: intlShape.isRequired, }; diff --git a/client/app/bundles/comments/components/CommentBox/CommentForm/CommentForm.jsx b/client/app/bundles/comments/components/CommentBox/CommentForm/CommentForm.jsx index 5b49b3de..12dd88da 100644 --- a/client/app/bundles/comments/components/CommentBox/CommentForm/CommentForm.jsx +++ b/client/app/bundles/comments/components/CommentBox/CommentForm/CommentForm.jsx @@ -1,7 +1,8 @@ // NOTE: https://github.com/react-bootstrap/react-bootstrap/issues/1850 seesm to require string // refs and not the callback kind. /* eslint-disable react/no-find-dom-node, react/no-string-refs */ -import React, { PropTypes } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import ReactDOM from 'react-dom'; import Col from 'react-bootstrap/lib/Col'; import FormControl from 'react-bootstrap/lib/FormControl'; diff --git a/client/app/bundles/comments/components/CommentBox/CommentList/Comment/Comment.jsx b/client/app/bundles/comments/components/CommentBox/CommentList/Comment/Comment.jsx index 8f2d9fa1..37b4e9b6 100644 --- a/client/app/bundles/comments/components/CommentBox/CommentList/Comment/Comment.jsx +++ b/client/app/bundles/comments/components/CommentBox/CommentList/Comment/Comment.jsx @@ -1,5 +1,6 @@ import BaseComponent from 'libs/components/BaseComponent'; -import React, { PropTypes } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import marked from 'marked'; import css from './Comment.scss'; diff --git a/client/app/bundles/comments/components/CommentBox/CommentList/CommentList.jsx b/client/app/bundles/comments/components/CommentBox/CommentList/CommentList.jsx index afdc67fb..6ccdc857 100644 --- a/client/app/bundles/comments/components/CommentBox/CommentList/CommentList.jsx +++ b/client/app/bundles/comments/components/CommentBox/CommentList/CommentList.jsx @@ -1,7 +1,8 @@ import Alert from 'react-bootstrap/lib/Alert'; import BaseComponent from 'libs/components/BaseComponent'; import Immutable from 'immutable'; -import React, { PropTypes } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import ReactCSSTransitionGroup from 'react-addons-css-transition-group'; import _ from 'lodash'; diff --git a/client/app/bundles/comments/components/CommentScreen/CommentScreen.jsx b/client/app/bundles/comments/components/CommentScreen/CommentScreen.jsx index 44e53e1f..2c6e9b27 100644 --- a/client/app/bundles/comments/components/CommentScreen/CommentScreen.jsx +++ b/client/app/bundles/comments/components/CommentScreen/CommentScreen.jsx @@ -1,4 +1,5 @@ -import React, { PropTypes } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import BaseComponent from 'libs/components/BaseComponent'; diff --git a/client/app/bundles/comments/components/NavigationBar/CommentsCount.jsx b/client/app/bundles/comments/components/NavigationBar/CommentsCount.jsx index 115231f5..4749c972 100644 --- a/client/app/bundles/comments/components/NavigationBar/CommentsCount.jsx +++ b/client/app/bundles/comments/components/NavigationBar/CommentsCount.jsx @@ -1,4 +1,5 @@ -import React, { PropTypes } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; const href = 'https://github.com/shakacode/react_on_rails/blob/master/README.md#multiple-react-' + 'components-on-a-page-with-one-store'; diff --git a/client/app/bundles/comments/components/NavigationBar/NavigationBar.jsx b/client/app/bundles/comments/components/NavigationBar/NavigationBar.jsx index 827aa4cb..6d496f70 100644 --- a/client/app/bundles/comments/components/NavigationBar/NavigationBar.jsx +++ b/client/app/bundles/comments/components/NavigationBar/NavigationBar.jsx @@ -3,7 +3,8 @@ import classNames from 'classnames'; import _ from 'lodash'; -import React, { PropTypes } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import CommentsCount from './CommentsCount'; import * as paths from '../../constants/paths'; diff --git a/client/app/bundles/comments/components/TestReactRouterRedirect/TestReactRouterRedirect.jsx b/client/app/bundles/comments/components/TestReactRouterRedirect/TestReactRouterRedirect.jsx index 3cfe4fbc..ea9b22d7 100644 --- a/client/app/bundles/comments/components/TestReactRouterRedirect/TestReactRouterRedirect.jsx +++ b/client/app/bundles/comments/components/TestReactRouterRedirect/TestReactRouterRedirect.jsx @@ -1,20 +1,29 @@ import React from 'react'; +import { Redirect } from 'react-router-dom'; import BaseComponent from 'libs/components/BaseComponent'; export default class TestReactRouterRedirect extends BaseComponent { - static checkAuth(nextState, replace) { + + static checkAuth() { // Hard code this to demonstrate the effect const notAuthorized = true; - if (notAuthorized) { - replace({ pathname: '/', state: { redirectFrom: nextState.location.pathname } }); - } + return notAuthorized; } render() { - return ( -
Nope.
- ); - } + if (TestReactRouterRedirect.checkAuth()) { + return ( + + ); + } + return
Nope.
; + } } diff --git a/client/app/bundles/comments/containers/NavigationBarContainer.jsx b/client/app/bundles/comments/containers/NavigationBarContainer.jsx index cf65c514..361086f1 100644 --- a/client/app/bundles/comments/containers/NavigationBarContainer.jsx +++ b/client/app/bundles/comments/containers/NavigationBarContainer.jsx @@ -1,4 +1,5 @@ -import React, { PropTypes } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import BaseComponent from 'libs/components/BaseComponent'; diff --git a/client/app/bundles/comments/containers/NonRouterCommentsContainer.jsx b/client/app/bundles/comments/containers/NonRouterCommentsContainer.jsx index eea52532..6a1a16df 100644 --- a/client/app/bundles/comments/containers/NonRouterCommentsContainer.jsx +++ b/client/app/bundles/comments/containers/NonRouterCommentsContainer.jsx @@ -1,4 +1,5 @@ -import React, { PropTypes } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import BaseComponent from 'libs/components/BaseComponent'; diff --git a/client/app/bundles/comments/containers/RouterCommentsContainer.jsx b/client/app/bundles/comments/containers/RouterCommentsContainer.jsx index eb01405f..3e30b282 100644 --- a/client/app/bundles/comments/containers/RouterCommentsContainer.jsx +++ b/client/app/bundles/comments/containers/RouterCommentsContainer.jsx @@ -1,4 +1,5 @@ -import React, { PropTypes } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import { IntlProvider } from 'react-intl'; diff --git a/client/app/bundles/comments/layout/Layout.jsx b/client/app/bundles/comments/layout/Layout.jsx index dcae7823..d4c0dbfd 100644 --- a/client/app/bundles/comments/layout/Layout.jsx +++ b/client/app/bundles/comments/layout/Layout.jsx @@ -1,10 +1,11 @@ -import React, { PropTypes } from 'react'; -import { IndexLink, Link } from 'react-router'; -import BaseComponent from 'libs/components/BaseComponent'; +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; +import { NavLink as Link } from 'react-router-dom'; import './Layout.scss'; -export default class Layout extends BaseComponent { +/* eslint-disable react/prefer-stateless-function */ +export default class Layout extends Component { static propTypes = { children: PropTypes.object.isRequired, @@ -17,9 +18,9 @@ export default class Layout extends BaseComponent {