diff --git a/README.md b/README.md index cb9ffff..10193a3 100644 --- a/README.md +++ b/README.md @@ -83,4 +83,4 @@ This section has moved here: https://facebook.github.io/create-react-app/docs/de ### `npm run build` fails to minify -This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify +This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify \ No newline at end of file diff --git a/src/components/DialogTemplateListItems/BackButton.jsx b/src/components/DialogTemplateListItems/BackButton.jsx index d931e4f..dbbfe31 100644 --- a/src/components/DialogTemplateListItems/BackButton.jsx +++ b/src/components/DialogTemplateListItems/BackButton.jsx @@ -8,26 +8,21 @@ export default class BackButton extends React.Component { } handleBack() { - // special handling for geoFilter due to clear filter functionality inside - // the geoFilter which updages the url and conflicts with previousUrl - if (this.props.view === 'geoFilter') { - this.props.setViewCatalog(); - this.props.setUrl(this.props.catalogFilterUrl); - // this next condition is for when developing locally. - // on update to code, app refreshes and previousUrl becomes current url; - // override this by hard setting the url to root - } else if (this.props.previousUrl === window.location.pathname) { - this.props.setViewCatalog(); - this.props.setUrl('/') - // all other conditions, setViewCatalog and use previousUrl + // Check if in cart view. + // Cart is only route with multiple paths to it. + // So if previousUrl is collection, go back to that collection + // Else, go home using stored filter parameters + if (this.props.view === 'orderCart' && this.props.previousUrl.startsWith('/collection')) { + this.props.setViewCollection(); + this.props.setUrl(this.props.previousUrl); + this.props.selectCollection(this.props.selectedCollection); } else { this.props.setViewCatalog(); - this.props.setUrl(this.props.previousUrl); + this.props.setUrl(this.props.catalogFilterUrl); } } render() { - return (
- Please visit the shopping cart to finalize your order. + Please visit the to finalize your order.
); @@ -636,7 +646,7 @@ class OrderTnrisDataForm extends Component { This dataset has been added to the shopping cart.- Please visit the shopping cart to finalize your order. + Please visit the to finalize your order.
); diff --git a/src/components/TnrisDownloadTemplate/TnrisDownloadTemplate.jsx b/src/components/TnrisDownloadTemplate/TnrisDownloadTemplate.jsx index d143e3d..b9c7665 100644 --- a/src/components/TnrisDownloadTemplate/TnrisDownloadTemplate.jsx +++ b/src/components/TnrisDownloadTemplate/TnrisDownloadTemplate.jsx @@ -40,7 +40,7 @@ export default class TnrisDownloadTemplate extends React.Component { } componentWillUnmount() { - this.props.clearSelectedCollection(); + //this.props.clearSelectedCollection(); } setTemplateView(viewString) { diff --git a/src/containers/BackButtonContainer.jsx b/src/containers/BackButtonContainer.jsx index 1c48aeb..8169159 100644 --- a/src/containers/BackButtonContainer.jsx +++ b/src/containers/BackButtonContainer.jsx @@ -3,13 +3,20 @@ import {connect} from 'react-redux' import BackButton from '../components/DialogTemplateListItems/BackButton' import {catalogActions, - collectionActions, - urlTrackerActions} from '../actions' + collectionActions, + urlTrackerActions, +} from '../actions' + +import { + getAllCollections +} from '../selectors/collectionSelectors' const mapStateToProps = state => ({ previousUrl: state.urlTracker.previousUrl, catalogFilterUrl: state.urlTracker.catalogFilterUrl, - view: state.catalog.view + view: state.catalog.view, + selectedCollection: state.collections.selectedCollection, + collections: getAllCollections(state) }); const mapDispatchToProps = (dispatch) => ({ diff --git a/src/containers/OrderTnrisDataFormContainer.jsx b/src/containers/OrderTnrisDataFormContainer.jsx index a250b65..dcb9f69 100644 --- a/src/containers/OrderTnrisDataFormContainer.jsx +++ b/src/containers/OrderTnrisDataFormContainer.jsx @@ -1,6 +1,6 @@ import {connect} from 'react-redux' -import {orderCartActions} from '../actions' +import {orderCartActions, urlTrackerActions, catalogActions} from '../actions' import {getAllCollections} from '../selectors/collectionSelectors' import OrderTnrisDataForm from '../components/OrderTnrisDataForm' @@ -13,6 +13,12 @@ const mapStateToProps = state => ({ }); const mapDispatchToProps = dispatch => ({ + setUrl: (newUrl, history) => { + dispatch(urlTrackerActions.setUrl(newUrl, history)); + }, + setViewOrderCart: () => { + dispatch(catalogActions.setViewOrderCart()); + }, addCollectionToCart: (collectionId, formInfo) => { dispatch(orderCartActions.addCollectionToCart(collectionId, formInfo)); }, diff --git a/src/sass/_catalog.scss b/src/sass/_catalog.scss index 78695ec..b8eb9e7 100644 --- a/src/sass/_catalog.scss +++ b/src/sass/_catalog.scss @@ -4,7 +4,7 @@ styles for component: Catalog */ .catalog-component { - margin-bottom: 75px; + margin-bottom: 106px; .catalog-view-container { padding-top: 106px;