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
ad83a084
Commit
ad83a084
authored
6 years ago
by
Julia Friesel
Browse files
Options
Downloads
Patches
Plain Diff
Flatten props and add keys to array elements
parent
a17cc89e
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/chart/chart.js
+1
-1
1 addition, 1 deletion
components/chart/chart.js
components/chart/day-column.js
+10
-7
10 additions, 7 deletions
components/chart/day-column.js
components/chart/dot-and-line.js
+6
-0
6 additions, 0 deletions
components/chart/dot-and-line.js
with
17 additions
and
8 deletions
components/chart/chart.js
+
1
−
1
View file @
ad83a084
...
...
@@ -18,7 +18,7 @@ export default class CycleChart extends Component {
this
.
renderColumn
=
({
item
,
index
})
=>
{
return
(
<
DayColumn
item
=
{
item
}
{...
item
}
index
=
{
index
}
navigate
=
{
this
.
props
.
navigation
.
navigate
}
{...
getInfoForNeighborColumns
(
index
,
this
.
state
.
columns
)}
...
...
This diff is collapsed.
Click to expand it.
components/chart/day-column.js
+
10
−
7
View file @
ad83a084
...
...
@@ -15,10 +15,6 @@ const label = styles.column.label
const
getFhmAndLtlInfo
=
setUpFertilityStatusFunc
()
export
default
class
DayColumn
extends
Component
{
constructor
(
props
)
{
super
(
props
)
}
passDateToDayView
(
dateString
)
{
const
cycleDay
=
getOrCreateCycleDay
(
dateString
)
this
.
props
.
navigate
(
'
cycleDay
'
,
{
cycleDay
})
...
...
@@ -36,7 +32,7 @@ export default class DayColumn extends Component {
temperatureExclude
,
bleeding
,
mucus
}
=
this
.
props
.
item
}
=
this
.
props
const
nfpLineInfo
=
getFhmAndLtlInfo
(
dateString
,
temperature
)
const
columnElements
=
[]
...
...
@@ -50,6 +46,7 @@ export default class DayColumn extends Component {
size
=
{
30
}
color
=
'
#900
'
style
=
{{
marginTop
:
20
}}
key
=
'
bleeding
'
/>
)
}
...
...
@@ -62,6 +59,7 @@ export default class DayColumn extends Component {
left
=
{
config
.
columnMiddle
-
styles
.
mucusIcon
.
width
/
2
}
{...
styles
.
mucusIcon
}
backgroundColor
=
{
styles
.
mucusIconShades
[
mucus
]}
key
=
'
mucus
'
/>
)
columnElements
.
push
(
mucusIcon
)
...
...
@@ -74,6 +72,7 @@ export default class DayColumn extends Component {
width
=
{
styles
.
nfpLine
.
strokeWidth
}
height
=
{
200
}
{...
styles
.
nfpLine
}
key
=
'
fhm
'
/>
)
columnElements
.
push
(
fhmLine
)
}
...
...
@@ -84,6 +83,7 @@ export default class DayColumn extends Component {
width
=
{
'
100%
'
}
top
=
{
nfpLineInfo
.
drawLtlAt
}
{...
styles
.
nfpLine
}
key
=
'
ltl
'
/>
)
columnElements
.
push
(
ltlLine
)
}
...
...
@@ -93,8 +93,11 @@ export default class DayColumn extends Component {
<
DotAndLine
y
=
{
y
}
exclude
=
{
temperatureExclude
}
rightY
=
{
this
.
props
.
rightY
}
rightTemperatureExclude
=
{
this
.
props
.
rightTemperatureExclude
}
leftY
=
{
this
.
props
.
leftY
}
rightY
=
{
this
.
props
.
righty
}
leftTemperatureExclude
=
{
this
.
props
.
leftTemperatureExclude
}
key
=
'
dotandline
'
/>
)
}
...
...
@@ -111,7 +114,7 @@ export default class DayColumn extends Component {
<
/Text
>
)
columnElements
.
push
(
<
View
position
=
'
absolute
'
bottom
=
{
0
}
>
<
View
position
=
'
absolute
'
bottom
=
{
0
}
key
=
'
date
'
>
{
cycleDayLabel
}
{
dateLabel
}
<
/View
>
...
...
This diff is collapsed.
Click to expand it.
components/chart/dot-and-line.js
+
6
−
0
View file @
ad83a084
...
...
@@ -4,6 +4,10 @@ import styles from './styles'
import
config
from
'
./config
'
export
default
class
DotAndLine
extends
Component
{
shouldComponentUpdate
(
newProps
)
{
return
Object
.
keys
(
newProps
).
some
(
key
=>
newProps
[
key
]
!=
this
.
props
[
key
])
}
render
()
{
const
y
=
this
.
props
.
y
const
exclude
=
this
.
props
.
exclude
...
...
@@ -28,6 +32,7 @@ export default class DotAndLine extends Component {
top
=
{
y
-
(
dotStyle
.
height
/
2
)}
left
=
{
config
.
columnMiddle
-
(
dotStyle
.
width
/
2
)}
style
=
{
dotStyle
}
key
=
'
dot
'
/>
)
return
[
lineToLeft
,
lineToRight
,
dot
]
...
...
@@ -61,5 +66,6 @@ function makeLine(leftY, rightY, direction, excludeLine) {
],
}}
{...
lineStyle
}
key
=
{
direction
}
/>
)
}
\ 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