From f5f61288bebb186e97af3f689527c22bf12677a2 Mon Sep 17 00:00:00 2001 From: Vesa Luusua Date: Wed, 11 Oct 2017 20:14:58 +0300 Subject: [PATCH] PayoutPreferencesPage uses TopbarContainer --- .../PayoutPreferencesPage.js | 106 +++--------------- .../PayoutPreferencesPage.test.js.snap | 24 +--- 2 files changed, 18 insertions(+), 112 deletions(-) diff --git a/src/containers/PayoutPreferencesPage/PayoutPreferencesPage.js b/src/containers/PayoutPreferencesPage/PayoutPreferencesPage.js index 9d093d97..9fced7d2 100644 --- a/src/containers/PayoutPreferencesPage/PayoutPreferencesPage.js +++ b/src/containers/PayoutPreferencesPage/PayoutPreferencesPage.js @@ -1,122 +1,48 @@ import React, { PropTypes } from 'react'; import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withRouter } from 'react-router-dom'; -import * as propTypes from '../../util/propTypes'; -import { sendVerificationEmail } from '../../ducks/user.duck'; -import { logout, authenticationInProgress } from '../../ducks/Auth.duck'; -import { manageDisableScrolling, isScrollingDisabled } from '../../ducks/UI.duck'; -import { Page, Topbar } from '../../components'; +import { isScrollingDisabled } from '../../ducks/UI.duck'; +import { Page } from '../../components'; +import { TopbarContainer } from '../../containers'; export const PayoutPreferencesPageComponent = props => { - const { - authInfoError, - authInProgress, - currentUser, - currentUserHasListings, - currentUserHasOrders, - history, - isAuthenticated, - location, - logoutError, - notificationCount, - onLogout, - onManageDisableScrolling, - sendVerificationEmailInProgress, - sendVerificationEmailError, - onResendVerificationEmail, - } = props; + const { authInfoError, logoutError, scrollingDisabled } = props; return ( - - + + ); }; PayoutPreferencesPageComponent.defaultProps = { authInfoError: null, - currentUser: null, - currentUserHasOrders: null, logoutError: null, - notificationCount: 0, - sendVerificationEmailError: null, }; -const { bool, func, instanceOf, number, object, shape } = PropTypes; +const { bool, instanceOf } = PropTypes; PayoutPreferencesPageComponent.propTypes = { authInfoError: instanceOf(Error), - authInProgress: bool.isRequired, - currentUser: propTypes.currentUser, - currentUserHasListings: bool.isRequired, - currentUserHasOrders: bool, - isAuthenticated: bool.isRequired, logoutError: instanceOf(Error), - notificationCount: number, - onLogout: func.isRequired, - onManageDisableScrolling: func.isRequired, - sendVerificationEmailInProgress: bool.isRequired, - sendVerificationEmailError: instanceOf(Error), - onResendVerificationEmail: func.isRequired, - - // from withRouter - history: shape({ - push: func.isRequired, - }).isRequired, - location: shape({ state: object }).isRequired, + scrollingDisabled: bool.isRequired, }; const mapStateToProps = state => { - // Page needs authInfoError and logoutError, Topbar needs isAuthenticated - const { authInfoError, isAuthenticated, logoutError } = state.Auth; - // Topbar needs user info. - const { - currentUser, - currentUserHasListings, - currentUserHasOrders, - currentUserNotificationCount: notificationCount, - sendVerificationEmailInProgress, - sendVerificationEmailError, - } = state.user; + // Page needs authInfoError and logoutError + const { authInfoError, logoutError } = state.Auth; return { authInfoError, - authInProgress: authenticationInProgress(state), - currentUser, - currentUserHasListings, - currentUserHasOrders, - notificationCount, - isAuthenticated, logoutError, scrollingDisabled: isScrollingDisabled(state), - sendVerificationEmailInProgress, - sendVerificationEmailError, }; }; -const mapDispatchToProps = dispatch => ({ - onLogout: historyPush => dispatch(logout(historyPush)), - onManageDisableScrolling: (componentId, disableScrolling) => - dispatch(manageDisableScrolling(componentId, disableScrolling)), - onResendVerificationEmail: () => dispatch(sendVerificationEmail()), -}); - -const PayoutPreferencesPage = compose(connect(mapStateToProps, mapDispatchToProps), withRouter)( - PayoutPreferencesPageComponent -); +const PayoutPreferencesPage = compose(connect(mapStateToProps))(PayoutPreferencesPageComponent); export default PayoutPreferencesPage; diff --git a/src/containers/PayoutPreferencesPage/__snapshots__/PayoutPreferencesPage.test.js.snap b/src/containers/PayoutPreferencesPage/__snapshots__/PayoutPreferencesPage.test.js.snap index 61bba1e1..05bba793 100644 --- a/src/containers/PayoutPreferencesPage/__snapshots__/PayoutPreferencesPage.test.js.snap +++ b/src/containers/PayoutPreferencesPage/__snapshots__/PayoutPreferencesPage.test.js.snap @@ -2,28 +2,8 @@ exports[`PayoutPreferencesPage matches snapshot 1`] = ` - + `;