Add new home screen

This commit is contained in:
Julia Friesel
2018-09-30 15:02:11 +02:00
parent bd37c118f1
commit 7b8b905550
40 changed files with 367 additions and 356 deletions
+5 -11
View File
@@ -40,20 +40,18 @@ export default class App extends Component {
}
navigate = (pageName, props) => {
const curr = this.state.currentPage
if (navigatingToCycleDayFromMainMenuEntry(pageName, curr)) {
this.cycleDayOrigin = curr
}
this.origin = this.state.currentPage
this.setState({currentPage: pageName, currentProps: props})
}
handleBackButtonPress = () => {
if (this.state.currentPage === 'Home') return false
if (isSymptomView(this.state.currentPage)) {
this.navigate('CycleDay', { cycleDay: this.state.currentProps.cycleDay })
this.navigate(
this.origin, { cycleDay: this.state.currentProps.cycleDay }
)
} else if(this.state.currentPage === 'CycleDay') {
this.navigate(this.cycleDayOrigin || 'Home')
this.cycleDayOrigin = null
this.navigate(this.origin)
} else {
this.navigate('Home')
}
@@ -93,7 +91,3 @@ export default class App extends Component {
)
}
}
function navigatingToCycleDayFromMainMenuEntry(target, curr) {
return target === 'CycleDay' && ['Home', 'Calendar', 'Chart'].indexOf(curr) > -1
}