@@ -11,6 +11,7 @@ import AssetList from '../../IDE/components/AssetList';
1111import AssetSize from '../../IDE/components/AssetSize' ;
1212import CollectionList from '../../IDE/components/CollectionList' ;
1313import SketchList from '../../IDE/components/SketchList' ;
14+ import * as ProjectActions from '../../IDE/actions/project' ;
1415import {
1516 CollectionSearchbar ,
1617 SketchSearchbar
@@ -29,6 +30,7 @@ class DashboardView extends React.Component {
2930 constructor ( props ) {
3031 super ( props ) ;
3132 this . closeAccountPage = this . closeAccountPage . bind ( this ) ;
33+ this . createNewSketch = this . createNewSketch . bind ( this ) ;
3234 this . gotoHomePage = this . gotoHomePage . bind ( this ) ;
3335 this . toggleCollectionCreate = this . toggleCollectionCreate . bind ( this ) ;
3436 this . state = {
@@ -44,6 +46,10 @@ class DashboardView extends React.Component {
4446 browserHistory . push ( this . props . previousPath ) ;
4547 }
4648
49+ createNewSketch ( ) {
50+ this . props . newProject ( ) ;
51+ }
52+
4753 gotoHomePage ( ) {
4854 browserHistory . push ( '/' ) ;
4955 }
@@ -98,7 +104,9 @@ class DashboardView extends React.Component {
98104 return (
99105 < React . Fragment >
100106 { this . isOwner ( ) && (
101- < Button to = "/" > { t ( 'DashboardView.NewSketch' ) } </ Button >
107+ < Button onClick = { this . createNewSketch } >
108+ { t ( 'DashboardView.NewSketch' ) }
109+ </ Button >
102110 ) }
103111 < SketchSearchbar />
104112 </ React . Fragment >
@@ -170,7 +178,12 @@ function mapStateToProps(state) {
170178 } ;
171179}
172180
181+ const mapDispatchToProps = {
182+ ...ProjectActions
183+ } ;
184+
173185DashboardView . propTypes = {
186+ newProject : PropTypes . func . isRequired ,
174187 location : PropTypes . shape ( {
175188 pathname : PropTypes . string . isRequired
176189 } ) . isRequired ,
@@ -185,4 +198,6 @@ DashboardView.propTypes = {
185198 t : PropTypes . func . isRequired
186199} ;
187200
188- export default withTranslation ( ) ( connect ( mapStateToProps ) ( DashboardView ) ) ;
201+ export default withTranslation ( ) (
202+ connect ( mapStateToProps , mapDispatchToProps ) ( DashboardView )
203+ ) ;
0 commit comments