Skip to content
Snippets Groups Projects
Commit dd380cf9 authored by Julia Friesel's avatar Julia Friesel
Browse files

Merge branch '142-add-back-button-behavior-for-cycle-day-overview' into 'master'

Resolve "add back button behavior for cycle day overview"

Closes #142

See merge request bloodyhealth/drip!67
parents 5296a9c6 0414eb35
No related branches found
No related tags found
No related merge requests found
...@@ -29,6 +29,10 @@ export default class App extends Component { ...@@ -29,6 +29,10 @@ export default class App extends Component {
} }
navigate = (pageName, props) => { navigate = (pageName, props) => {
const curr = this.state.currentPage
if (navigatingToCycleDayFromMainMenuEntry(pageName, curr)) {
this.cycleDayOrigin = curr
}
this.setState({currentPage: pageName, currentProps: props}) this.setState({currentPage: pageName, currentProps: props})
} }
...@@ -36,6 +40,9 @@ export default class App extends Component { ...@@ -36,6 +40,9 @@ export default class App extends Component {
if (this.state.currentPage === 'Home') return false if (this.state.currentPage === 'Home') return false
if (isSymptomView(this.state.currentPage)) { if (isSymptomView(this.state.currentPage)) {
this.navigate('CycleDay', { cycleDay: this.state.currentProps.cycleDay }) this.navigate('CycleDay', { cycleDay: this.state.currentProps.cycleDay })
} else if(this.state.currentPage === 'CycleDay') {
this.navigate(this.cycleDayOrigin || 'Home')
this.cycleDayOrigin = null
} else { } else {
this.navigate('Home') this.navigate('Home')
} }
...@@ -63,3 +70,7 @@ export default class App extends Component { ...@@ -63,3 +70,7 @@ export default class App extends Component {
) )
} }
} }
function navigatingToCycleDayFromMainMenuEntry(target, curr) {
return target === 'CycleDay' && ['Home', 'Calendar', 'Chart'].indexOf(curr) > -1
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment