Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Drip
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
backup
Drip
Commits
ef6d42fe
Commit
ef6d42fe
authored
6 years ago
by
Julia Friesel
Browse files
Options
Downloads
Patches
Plain Diff
Differentiate origins for cycle day view and symptom view
parent
472edacb
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
components/app.js
+12
-4
12 additions, 4 deletions
components/app.js
with
12 additions
and
4 deletions
components/app.js
+
12
−
4
View file @
ef6d42fe
...
...
@@ -23,7 +23,8 @@ const menuTitlesLowerCase = Object.keys(menuTitles).reduce((acc, curr) => {
return
acc
},
{})
const
isSymptomView
=
name
=>
Object
.
keys
(
symptomViews
).
indexOf
(
name
)
>
-
1
const
isSymptomView
=
name
=>
Object
.
keys
(
symptomViews
).
includes
(
name
)
const
isMenuItem
=
name
=>
Object
.
keys
(
menuTitles
).
includes
(
name
)
export
default
class
App
extends
Component
{
constructor
(
props
)
{
...
...
@@ -40,7 +41,14 @@ export default class App extends Component {
}
navigate
=
(
pageName
,
props
)
=>
{
this
.
origin
=
this
.
state
.
currentPage
// for the back button to work properly, we want to
// remember two origins: which menu item we came from
// and from where we navigated to the symptom view (day
// view or home page)
if
(
isMenuItem
(
this
.
state
.
currentPage
))
{
this
.
menuOrigin
=
this
.
state
.
currentPage
}
this
.
originForSymptomView
=
this
.
state
.
currentPage
this
.
setState
({
currentPage
:
pageName
,
currentProps
:
props
})
}
...
...
@@ -48,10 +56,10 @@ export default class App extends Component {
if
(
this
.
state
.
currentPage
===
'
Home
'
)
return
false
if
(
isSymptomView
(
this
.
state
.
currentPage
))
{
this
.
navigate
(
this
.
origin
,
{
cycleDay
:
this
.
state
.
currentProps
.
cycleDay
}
this
.
origin
ForSymptomView
,
{
cycleDay
:
this
.
state
.
currentProps
.
cycleDay
}
)
}
else
if
(
this
.
state
.
currentPage
===
'
CycleDay
'
)
{
this
.
navigate
(
this
.
o
rigin
)
this
.
navigate
(
this
.
menuO
rigin
)
}
else
{
this
.
navigate
(
'
Home
'
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment