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
fae27843
Commit
fae27843
authored
6 years ago
by
Julia Friesel
Browse files
Options
Downloads
Patches
Plain Diff
Add navigation arrows
parent
a59aa86d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
components/cycle-day/cycle-day-overview.js
+1
-28
1 addition, 28 deletions
components/cycle-day/cycle-day-overview.js
components/cycle-day/index.js
+46
-24
46 additions, 24 deletions
components/cycle-day/index.js
styles/index.js
+20
-7
20 additions, 7 deletions
styles/index.js
with
67 additions
and
59 deletions
components/cycle-day/cycle-day-overview.js
+
1
−
28
View file @
fae27843
...
@@ -17,37 +17,10 @@ import {
...
@@ -17,37 +17,10 @@ import {
cervixPosition
as
positionLabels
,
cervixPosition
as
positionLabels
,
intensity
as
intensityLabels
intensity
as
intensityLabels
}
from
'
./labels/labels
'
}
from
'
./labels/labels
'
import
cycleDayModule
from
'
../../lib/cycle
'
import
{
bleedingDaysSortedByDate
}
from
'
../../db
'
const
getCycleDayNumber
=
cycleDayModule
().
getCycleDayNumber
export
default
class
DayView
extends
Component
{
export
default
class
DayView
extends
Component
{
constructor
(
props
)
{
super
(
props
)
this
.
cycleDay
=
props
.
cycleDay
this
.
showView
=
props
.
showView
this
.
state
=
{
cycleDayNumber
:
getCycleDayNumber
(
this
.
cycleDay
.
date
),
}
this
.
setStateWithCycleDayNumber
=
(
function
(
DayViewComponent
)
{
return
function
()
{
DayViewComponent
.
setState
({
cycleDayNumber
:
getCycleDayNumber
(
DayViewComponent
.
cycleDay
.
date
)
})
}
})(
this
)
bleedingDaysSortedByDate
.
addListener
(
this
.
setStateWithCycleDayNumber
)
}
componentWillUnmount
()
{
bleedingDaysSortedByDate
.
removeListener
(
this
.
setStateWithCycleDayNumber
)
}
render
()
{
render
()
{
const
cycleDay
=
this
.
cycleDay
const
cycleDay
=
this
.
props
.
cycleDay
return
(
return
(
<
View
style
=
{
styles
.
symptomBoxesView
}
>
<
View
style
=
{
styles
.
symptomBoxesView
}
>
<
SymptomBox
<
SymptomBox
...
...
This diff is collapsed.
Click to expand it.
components/cycle-day/index.js
+
46
−
24
View file @
fae27843
...
@@ -4,66 +4,88 @@ import {
...
@@ -4,66 +4,88 @@ import {
Text
,
Text
,
ScrollView
ScrollView
}
from
'
react-native
'
}
from
'
react-native
'
import
Icon
from
'
react-native-vector-icons/MaterialCommunityIcons
'
import
cycleModule
from
'
../../lib/cycle
'
import
cycleModule
from
'
../../lib/cycle
'
import
{
formatDateForViewHeader
}
from
'
./labels/format
'
import
{
formatDateForViewHeader
}
from
'
./labels/format
'
import
styles
from
'
../../styles
'
import
styles
,
{
iconStyles
}
from
'
../../styles
'
import
actionButtonModule
from
'
./action-buttons
'
import
actionButtonModule
from
'
./action-buttons
'
import
symptomComponents
from
'
./symptoms
'
import
symptomComponents
from
'
./symptoms
'
import
DayView
from
'
./cycle-day-overview
'
import
DayView
from
'
./cycle-day-overview
'
import
{
LocalDate
}
from
'
js-joda
'
import
{
getOrCreateCycleDay
}
from
'
../../db
'
const
getCycleDayNumber
=
cycleModule
().
getCycleDayNumber
const
getCycleDayNumber
=
cycleModule
().
getCycleDayNumber
const
symptomComponentNames
=
Object
.
keys
(
symptomComponents
)
export
default
class
Day
extends
Component
{
export
default
class
Day
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
)
super
(
props
)
this
.
cycleDay
=
props
.
navigation
.
state
.
params
.
cycleDay
this
.
state
=
{
this
.
state
=
{
visibleComponent
:
'
DayView
'
,
visibleComponent
:
'
DayView
'
,
cycleDay
:
props
.
navigation
.
state
.
params
.
cycleDay
}
}
const
showView
=
view
=>
{
this
.
showView
=
view
=>
{
this
.
setState
({
visibleComponent
:
view
})
this
.
setState
({
visibleComponent
:
view
})
}
}
this
.
makeActionButtons
=
actionButtonModule
(
this
.
showView
)
}
const
makeActionButtons
=
actionButtonModule
(
showView
)
goToCycleDay
(
target
)
{
const
localDate
=
LocalDate
.
parse
(
this
.
state
.
cycleDay
.
date
)
const
targetDate
=
target
===
'
before
'
?
localDate
.
minusDays
(
1
).
toString
()
:
localDate
.
plusDays
(
1
).
toString
()
this
.
setState
({
cycleDay
:
getOrCreateCycleDay
(
targetDate
)})
}
const
symptomComponentNames
=
Object
.
keys
(
symptomComponents
)
render
()
{
this
.
cycleDayViews
=
symptomComponentNames
.
reduce
((
acc
,
curr
)
=>
{
const
cycleDayNumber
=
getCycleDayNumber
(
this
.
state
.
cycleDay
.
date
)
const
cycleDayViews
=
symptomComponentNames
.
reduce
((
acc
,
curr
)
=>
{
acc
[
curr
]
=
React
.
createElement
(
acc
[
curr
]
=
React
.
createElement
(
symptomComponents
[
curr
],
symptomComponents
[
curr
],
{
{
cycleDay
:
this
.
cycleDay
,
cycleDay
:
this
.
state
.
cycleDay
,
makeActionButtons
makeActionButtons
:
this
.
makeActionButtons
}
}
)
)
return
acc
return
acc
},
{})
},
{})
// DayView needs showView instead of makeActionButtons
// DayView needs showView instead of makeActionButtons
this
.
cycleDayViews
.
DayView
=
React
.
createElement
(
DayView
,
{
cycleDayViews
.
DayView
=
React
.
createElement
(
DayView
,
{
cycleDay
:
this
.
cycleDay
,
dateString
:
this
.
state
.
cycleDay
.
date
,
showView
cycleDay
:
this
.
state
.
cycleDay
,
showView
:
this
.
showView
})
})
}
render
()
{
const
cycleDayNumber
=
getCycleDayNumber
(
this
.
cycleDay
.
date
)
return
(
return
(
<
ScrollView
>
<
ScrollView
>
<
View
style
=
{
styles
.
cycleDayDateView
}
>
<
View
style
=
{
styles
.
cycleDayDateView
}
>
<
Text
style
=
{
styles
.
dateHeader
}
>
<
Icon
{
formatDateForViewHeader
(
this
.
cycleDay
.
date
)}
name
=
'
arrow-left-drop-circle
'
<
/Text
>
{...
iconStyles
.
navigationArrow
}
{
cycleDayNumber
&&
onPress
=
{()
=>
this
.
goToCycleDay
(
'
before
'
)}
<
Text
style
=
{
styles
.
cycleDayNumber
}
>
/
>
Cycle
day
{
cycleDayNumber
}
<
View
>
<
/Text>
}
<
Text
style
=
{
styles
.
dateHeader
}
>
{
formatDateForViewHeader
(
this
.
state
.
cycleDay
.
date
)}
<
/Text
>
{
cycleDayNumber
&&
<
Text
style
=
{
styles
.
cycleDayNumber
}
>
Cycle
day
{
cycleDayNumber
}
<
/Text>
}
<
/View
>
<
Icon
name
=
'
arrow-right-drop-circle
'
{...
iconStyles
.
navigationArrow
}
onPress
=
{()
=>
this
.
goToCycleDay
(
'
after
'
)}
/
>
<
/View
>
<
/View
>
<
View
>
<
View
>
{
this
.
cycleDayViews
[
this
.
state
.
visibleComponent
]
}
{
cycleDayViews
[
this
.
state
.
visibleComponent
]
}
<
/View
>
<
/View
>
<
/ScrollView
>
<
/ScrollView
>
)
)
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
styles/index.js
+
20
−
7
View file @
fae27843
...
@@ -2,6 +2,7 @@ import { StyleSheet } from 'react-native'
...
@@ -2,6 +2,7 @@ import { StyleSheet } from 'react-native'
export
const
primaryColor
=
'
#ff7e5f
'
export
const
primaryColor
=
'
#ff7e5f
'
export
const
secondaryColor
=
'
#351c4d
'
export
const
secondaryColor
=
'
#351c4d
'
export
const
fontOnPrimaryColor
=
'
white
'
export
default
StyleSheet
.
create
({
export
default
StyleSheet
.
create
({
container
:
{
container
:
{
...
@@ -17,12 +18,12 @@ export default StyleSheet.create({
...
@@ -17,12 +18,12 @@ export default StyleSheet.create({
dateHeader
:
{
dateHeader
:
{
fontSize
:
18
,
fontSize
:
18
,
fontWeight
:
'
bold
'
,
fontWeight
:
'
bold
'
,
color
:
'
white
'
,
color
:
fontOnPrimaryColor
,
textAlign
:
'
center
'
,
textAlign
:
'
center
'
,
},
},
cycleDayNumber
:
{
cycleDayNumber
:
{
fontSize
:
15
,
fontSize
:
15
,
color
:
'
white
'
,
color
:
fontOnPrimaryColor
,
textAlign
:
'
center
'
,
textAlign
:
'
center
'
,
marginLeft
:
15
marginLeft
:
15
},
},
...
@@ -70,10 +71,15 @@ export default StyleSheet.create({
...
@@ -70,10 +71,15 @@ export default StyleSheet.create({
},
},
cycleDayDateView
:
{
cycleDayDateView
:
{
backgroundColor
:
primaryColor
,
backgroundColor
:
primaryColor
,
padding
:
10
,
paddingVertical
:
18
,
paddingHorizontal
:
15
,
alignItems
:
'
center
'
,
flexDirection
:
'
row
'
,
flexDirection
:
'
row
'
,
justifyContent
:
'
center
'
,
justifyContent
:
'
space-between
'
alignItems
:
'
center
'
},
navigationArrow
:
{
fontSize
:
60
,
color
:
fontOnPrimaryColor
},
},
homeButtons
:
{
homeButtons
:
{
marginHorizontal
:
15
marginHorizontal
:
15
...
@@ -107,6 +113,13 @@ export default StyleSheet.create({
...
@@ -107,6 +113,13 @@ export default StyleSheet.create({
},
},
menuLabel
:
{
menuLabel
:
{
fontSize
:
15
,
fontSize
:
15
,
color
:
'
white
'
color
:
fontOnPrimaryColor
},
},
})
})
\ No newline at end of file
export
const
iconStyles
=
{
navigationArrow
:
{
size
:
45
,
color
:
fontOnPrimaryColor
}
}
\ No newline at end of file
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