@@ -11,6 +11,7 @@ import AssetList from '../../IDE/components/AssetList';
11
11
import AssetSize from '../../IDE/components/AssetSize' ;
12
12
import CollectionList from '../../IDE/components/CollectionList' ;
13
13
import SketchList from '../../IDE/components/SketchList' ;
14
+ import * as ProjectActions from '../../IDE/actions/project' ;
14
15
import {
15
16
CollectionSearchbar ,
16
17
SketchSearchbar
@@ -29,6 +30,7 @@ class DashboardView extends React.Component {
29
30
constructor ( props ) {
30
31
super ( props ) ;
31
32
this . closeAccountPage = this . closeAccountPage . bind ( this ) ;
33
+ this . createNewSketch = this . createNewSketch . bind ( this ) ;
32
34
this . gotoHomePage = this . gotoHomePage . bind ( this ) ;
33
35
this . toggleCollectionCreate = this . toggleCollectionCreate . bind ( this ) ;
34
36
this . state = {
@@ -44,6 +46,10 @@ class DashboardView extends React.Component {
44
46
browserHistory . push ( this . props . previousPath ) ;
45
47
}
46
48
49
+ createNewSketch ( ) {
50
+ this . props . newProject ( ) ;
51
+ }
52
+
47
53
gotoHomePage ( ) {
48
54
browserHistory . push ( '/' ) ;
49
55
}
@@ -98,7 +104,9 @@ class DashboardView extends React.Component {
98
104
return (
99
105
< React . Fragment >
100
106
{ this . isOwner ( ) && (
101
- < Button to = "/" > { t ( 'DashboardView.NewSketch' ) } </ Button >
107
+ < Button onClick = { this . createNewSketch } >
108
+ { t ( 'DashboardView.NewSketch' ) }
109
+ </ Button >
102
110
) }
103
111
< SketchSearchbar />
104
112
</ React . Fragment >
@@ -170,7 +178,12 @@ function mapStateToProps(state) {
170
178
} ;
171
179
}
172
180
181
+ const mapDispatchToProps = {
182
+ ...ProjectActions
183
+ } ;
184
+
173
185
DashboardView . propTypes = {
186
+ newProject : PropTypes . func . isRequired ,
174
187
location : PropTypes . shape ( {
175
188
pathname : PropTypes . string . isRequired
176
189
} ) . isRequired ,
@@ -185,4 +198,6 @@ DashboardView.propTypes = {
185
198
t : PropTypes . func . isRequired
186
199
} ;
187
200
188
- export default withTranslation ( ) ( connect ( mapStateToProps ) ( DashboardView ) ) ;
201
+ export default withTranslation ( ) (
202
+ connect ( mapStateToProps , mapDispatchToProps ) ( DashboardView )
203
+ ) ;
0 commit comments