@@ -30,6 +30,10 @@ class DashboardView extends React.Component {
30
30
super ( props ) ;
31
31
this . closeAccountPage = this . closeAccountPage . bind ( this ) ;
32
32
this . gotoHomePage = this . gotoHomePage . bind ( this ) ;
33
+ this . toggleCollectionCreate = this . toggleCollectionCreate . bind ( this ) ;
34
+ this . state = {
35
+ isCollectionCreate : false
36
+ } ;
33
37
}
34
38
35
39
componentDidMount ( ) {
@@ -68,15 +72,13 @@ class DashboardView extends React.Component {
68
72
return this . props . user . username === this . props . params . username ;
69
73
}
70
74
71
- isCollectionCreate ( ) {
72
- const path = this . props . location . pathname ;
73
- return / c o l l e c t i o n s \/ c r e a t e $ / . test ( path ) ;
75
+ toggleCollectionCreate ( ) {
76
+ console . log ( 'toggle called' , this . state ) ;
77
+ this . setState ( ( prevState ) => ( {
78
+ isCollectionCreate : ! prevState . isCollectionCreate
79
+ } ) ) ;
74
80
}
75
81
76
- returnToDashboard = ( ) => {
77
- browserHistory . push ( `/${ this . ownerName ( ) } /collections` ) ;
78
- } ;
79
-
80
82
renderActionButton ( tabKey , username , t ) {
81
83
switch ( tabKey ) {
82
84
case TabKey . assets :
@@ -85,7 +87,7 @@ class DashboardView extends React.Component {
85
87
return (
86
88
this . isOwner ( ) && (
87
89
< React . Fragment >
88
- < Button to = { `/ ${ username } /collections/create` } >
90
+ < Button onClick = { this . toggleCollectionCreate } >
89
91
{ t ( 'DashboardView.CreateCollection' ) }
90
92
</ Button >
91
93
< CollectionSearchbar />
@@ -148,10 +150,10 @@ class DashboardView extends React.Component {
148
150
{ this . renderContent ( currentTab , username ) }
149
151
</ div >
150
152
</ main >
151
- { this . isCollectionCreate ( ) && (
153
+ { this . state . isCollectionCreate && (
152
154
< Overlay
153
155
title = { this . props . t ( 'DashboardView.CreateCollectionOverlay' ) }
154
- closeOverlay = { this . returnToDashboard }
156
+ closeOverlay = { this . toggleCollectionCreate }
155
157
>
156
158
< CollectionCreate />
157
159
</ Overlay >
0 commit comments