Skip to content

Commit

Permalink
Merge pull request #58 from ronichoudhury-work/close-project-button
Browse files Browse the repository at this point in the history
Add a close project menu item to the start screen
  • Loading branch information
Roni Choudhury authored Mar 10, 2017
2 parents fdf7e90 + 4108f45 commit 63233fe
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
15 changes: 7 additions & 8 deletions web_external/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
1 change: 1 addition & 0 deletions web_external/view/overlay/StartScreen/index.jade
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 9 additions & 0 deletions web_external/view/overlay/StartScreen/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
});
Expand Down Expand Up @@ -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');
Expand Down

0 comments on commit 63233fe

Please sign in to comment.