From eec82dd273325090f07b8a2e89acf3b64db3eb13 Mon Sep 17 00:00:00 2001 From: gugray Date: Wed, 12 May 2021 20:35:58 +0200 Subject: [PATCH] Calls newProject from "New sketch" on Dashboard --- client/modules/User/pages/DashboardView.jsx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/client/modules/User/pages/DashboardView.jsx b/client/modules/User/pages/DashboardView.jsx index d0a6c6fde0..c44cd69d17 100644 --- a/client/modules/User/pages/DashboardView.jsx +++ b/client/modules/User/pages/DashboardView.jsx @@ -11,6 +11,7 @@ import AssetList from '../../IDE/components/AssetList'; import AssetSize from '../../IDE/components/AssetSize'; import CollectionList from '../../IDE/components/CollectionList'; import SketchList from '../../IDE/components/SketchList'; +import * as ProjectActions from '../../IDE/actions/project'; import { CollectionSearchbar, SketchSearchbar @@ -29,6 +30,7 @@ class DashboardView extends React.Component { constructor(props) { super(props); this.closeAccountPage = this.closeAccountPage.bind(this); + this.createNewSketch = this.createNewSketch.bind(this); this.gotoHomePage = this.gotoHomePage.bind(this); this.toggleCollectionCreate = this.toggleCollectionCreate.bind(this); this.state = { @@ -44,6 +46,10 @@ class DashboardView extends React.Component { browserHistory.push(this.props.previousPath); } + createNewSketch() { + this.props.newProject(); + } + gotoHomePage() { browserHistory.push('/'); } @@ -98,7 +104,9 @@ class DashboardView extends React.Component { return ( {this.isOwner() && ( - + )} @@ -170,7 +178,12 @@ function mapStateToProps(state) { }; } +const mapDispatchToProps = { + ...ProjectActions +}; + DashboardView.propTypes = { + newProject: PropTypes.func.isRequired, location: PropTypes.shape({ pathname: PropTypes.string.isRequired }).isRequired, @@ -185,4 +198,6 @@ DashboardView.propTypes = { t: PropTypes.func.isRequired }; -export default withTranslation()(connect(mapStateToProps)(DashboardView)); +export default withTranslation()( + connect(mapStateToProps, mapDispatchToProps)(DashboardView) +);