@@ -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+ collectionCreateVisible : false
36+ } ;
3337 }
3438
3539 componentDidMount ( ) {
@@ -68,15 +72,12 @@ 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+ this . setState ( ( prevState ) => ( {
77+ collectionCreateVisible : ! prevState . collectionCreateVisible
78+ } ) ) ;
7479 }
7580
76- returnToDashboard = ( ) => {
77- browserHistory . push ( `/${ this . ownerName ( ) } /collections` ) ;
78- } ;
79-
8081 renderActionButton ( tabKey , username , t ) {
8182 switch ( tabKey ) {
8283 case TabKey . assets :
@@ -85,7 +86,7 @@ class DashboardView extends React.Component {
8586 return (
8687 this . isOwner ( ) && (
8788 < React . Fragment >
88- < Button to = { `/ ${ username } /collections/create` } >
89+ < Button onClick = { this . toggleCollectionCreate } >
8990 { t ( 'DashboardView.CreateCollection' ) }
9091 </ Button >
9192 < CollectionSearchbar />
@@ -148,10 +149,10 @@ class DashboardView extends React.Component {
148149 { this . renderContent ( currentTab , username ) }
149150 </ div >
150151 </ main >
151- { this . isCollectionCreate ( ) && (
152+ { this . state . collectionCreateVisible && (
152153 < Overlay
153154 title = { this . props . t ( 'DashboardView.CreateCollectionOverlay' ) }
154- closeOverlay = { this . returnToDashboard }
155+ closeOverlay = { this . toggleCollectionCreate }
155156 >
156157 < CollectionCreate />
157158 </ Overlay >
0 commit comments