Skip to content

Commit

Permalink
Refactor + login/signup are both first screen
Browse files Browse the repository at this point in the history
  • Loading branch information
glena committed Jan 9, 2017
1 parent ba33cef commit 23e1375
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ export default class Base extends EventEmitter {
str: (keyPath, ...args) => i18n.str(m, keyPath, ...args)
};

const getScreenTitle = (m) => {
// if it is the first screen and the flag is enabled, it should hide the title
return l.ui.hideFistPageTitle(m) && screen.isFirstScreen(m)
? null
: title;
}

const props = {
avatar: avatar && m.getIn(["avatar", "transient", "url"]),
auxiliaryPane: screen.renderAuxiliaryPane(m),
Expand Down Expand Up @@ -115,9 +122,7 @@ export default class Base extends EventEmitter {
submitHandler: partialApplyId(screen, "submitHandler"),
tabs: screen.renderTabs(m),
terms: screen.renderTerms(m, i18nProp.html("signUpTerms")),
title: !l.ui.hideFistPageTitle(m) || !screen.isFirstScreen(m)
? title
: null,
title: getScreenTitle(m),
transitionName: screen.name === "loading" ? "fade" : "horizontal-fade"
};
render(l.ui.containerID(m), props);
Expand Down
9 changes: 8 additions & 1 deletion src/core/screen.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as l from './index';
import * as i18n from '../i18n';
import {getInitialScreen} from '../connection/database/index';
import {getInitialScreen, hasScreen} from '../connection/database/index';

export default class Screen {

Expand All @@ -24,6 +24,13 @@ export default class Screen {
const firstScreenName = getInitialScreen(m);
const currentScreenNameParts = this.name.split('.');
const currentScreenName = currentScreenNameParts[1] || currentScreenNameParts[0];

// if signup and login is enabled, both are the first screen in this scenario and
// neither of them should show the title
if (currentScreenName === 'signUp' && hasScreen(m, "login")) {
return true;
}

const initialScreens = [
firstScreenName,
'loading',
Expand Down

0 comments on commit 23e1375

Please sign in to comment.