diff --git a/web_external/index.js b/web_external/index.js index 3ed32e7..fdd44e4 100644 --- a/web_external/index.js +++ b/web_external/index.js @@ -107,14 +107,13 @@ observeStore(next => { } }, s => s.get('mode')); -// Update start screen with login/logout changes. -observeStore( - next => startScreen.render({ - username: next.getIn(['user', 'login']), - openProject: !!next.getIn(['project', 'id']) - }), - s => s.get('user') -); +// Update start screen with login/logout/project changes. +const updateStartScreen = state => startScreen.render({ + username: state.getIn(['user', 'login']), + openProject: !!state.getIn(['project', 'id']) +}); +observeStore(updateStartScreen, s => s.get('user')); +observeStore(updateStartScreen, s => s.getIn(['project', 'id'])); // Open a project. observeStore(next => { diff --git a/web_external/view/overlay/StartScreen/index.jade b/web_external/view/overlay/StartScreen/index.jade index 7bf8c9c..f36fd64 100644 --- a/web_external/view/overlay/StartScreen/index.jade +++ b/web_external/view/overlay/StartScreen/index.jade @@ -5,6 +5,7 @@ .side-menu .menu-item.new-project.clickable New Project .menu-item.open-project.clickable Open Project + .menu-item.close-project.clickable Close Project hr diff --git a/web_external/view/overlay/StartScreen/index.js b/web_external/view/overlay/StartScreen/index.js index c30bd74..51f4813 100644 --- a/web_external/view/overlay/StartScreen/index.js +++ b/web_external/view/overlay/StartScreen/index.js @@ -68,6 +68,10 @@ class StartScreen { } }); + this.el.select('.close-project').on('click', () => { + store.dispatch(action.closeProject()); + }); + this.el.select('.log-in').on('click', () => { store.dispatch(action.switchMode(appMode.loginDialog)); }); @@ -106,6 +110,11 @@ class StartScreen { .classed('disabled', !loggedIn) .classed('clickable', loggedIn); + // Gray out the close project button if there's no open project. + this.el.select('.close-project') + .classed('disabled', !openProject) + .classed('clickable', openProject); + // Only display the "close" button if there's already a project open. this.el.select('.close-overlay') .style('display', openProject ? null : 'none');