@@ -30,6 +30,10 @@ class DashboardView extends React.Component {
3030 super ( props ) ;
3131 this . closeAccountPage = this . closeAccountPage . bind ( this ) ;
3232 this . gotoHomePage = this . gotoHomePage . bind ( this ) ;
33+ this . toggleCollectionCreate = this . toggleCollectionCreate . bind ( this ) ;
34+ this . state = {
35+ isCollectionCreate : false
36+ } ;
3337 }
3438
3539 componentDidMount ( ) {
@@ -68,15 +72,13 @@ class DashboardView extends React.Component {
6872 return this . props . user . username === this . props . params . username ;
6973 }
7074
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+ } ) ) ;
7480 }
7581
76- returnToDashboard = ( ) => {
77- browserHistory . push ( `/${ this . ownerName ( ) } /collections` ) ;
78- } ;
79-
8082 renderActionButton ( tabKey , username , t ) {
8183 switch ( tabKey ) {
8284 case TabKey . assets :
@@ -85,7 +87,7 @@ class DashboardView extends React.Component {
8587 return (
8688 this . isOwner ( ) && (
8789 < React . Fragment >
88- < Button to = { `/ ${ username } /collections/create` } >
90+ < Button onClick = { this . toggleCollectionCreate } >
8991 { t ( 'DashboardView.CreateCollection' ) }
9092 </ Button >
9193 < CollectionSearchbar />
@@ -148,10 +150,10 @@ class DashboardView extends React.Component {
148150 { this . renderContent ( currentTab , username ) }
149151 </ div >
150152 </ main >
151- { this . isCollectionCreate ( ) && (
153+ { this . state . isCollectionCreate && (
152154 < Overlay
153155 title = { this . props . t ( 'DashboardView.CreateCollectionOverlay' ) }
154- closeOverlay = { this . returnToDashboard }
156+ closeOverlay = { this . toggleCollectionCreate }
155157 >
156158 < CollectionCreate />
157159 </ Overlay >
0 commit comments