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
0adbf343
Commit
0adbf343
authored
5 years ago
by
mashazyu
Committed by
Sofiya Tepikin
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Introduces SymptomCell component
parent
09129adb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
components/chart/day-column.js
+18
-39
18 additions, 39 deletions
components/chart/day-column.js
components/chart/symptom-cell.js
+52
-0
52 additions, 0 deletions
components/chart/symptom-cell.js
with
70 additions
and
39 deletions
components/chart/day-column.js
+
18
−
39
View file @
0adbf343
...
...
@@ -18,7 +18,10 @@ import styles from './styles'
import
config
from
'
../../config
'
import
cycleModule
from
'
../../lib/cycle
'
import
{
getCycleDay
}
from
'
../../db
'
import
DotAndLine
from
'
./dot-and-line
'
import
SymptomCell
from
'
./symptom-cell
'
import
{
normalizeToScale
}
from
'
../helpers/chart
'
const
label
=
styles
.
column
.
label
...
...
@@ -139,42 +142,6 @@ class DayColumn extends Component {
return
false
}
drawSymptom
=
(
symptom
)
=>
{
const
{
symptomHeight
}
=
this
.
props
const
shouldDrawSymptom
=
this
.
data
.
hasOwnProperty
(
symptom
)
const
styleParent
=
[
styles
.
symptomRow
,
{
height
:
symptomHeight
}]
if
(
shouldDrawSymptom
)
{
const
styleSymptom
=
styles
.
iconColors
[
symptom
]
const
symptomData
=
this
.
data
[
symptom
]
const
symptomColor
=
styleSymptom
.
shades
[
symptomData
]
const
dataIsComplete
=
this
.
isSymptomDataComplete
(
symptom
)
const
isMucusOrCervix
=
(
symptom
===
'
mucus
'
)
||
(
symptom
===
'
cervix
'
)
const
backgroundColor
=
(
isMucusOrCervix
&&
!
dataIsComplete
)
?
'
white
'
:
symptomColor
const
borderWidth
=
(
isMucusOrCervix
&&
!
dataIsComplete
)
?
2
:
0
const
borderColor
=
symptomColor
const
styleChild
=
[
styles
.
symptomDot
,
{
backgroundColor
,
borderColor
,
borderWidth
}]
return
(
<
View
style
=
{
styleParent
}
key
=
{
symptom
}
>
<
View
style
=
{
styleChild
}
/
>
<
/View
>
)
}
else
{
return
(
<
View
style
=
{
styleParent
}
key
=
{
symptom
}
/
>
)
}
}
render
()
{
const
columnElements
=
[]
const
{
dateString
,
...
...
@@ -264,9 +231,21 @@ class DayColumn extends Component {
onPress
=
{()
=>
this
.
onDaySelect
(
dateString
)}
activeOpacity
=
{
1
}
>
<
View
>
{
symptomRowSymptoms
.
map
(
symptom
=>
this
.
drawSymptom
(
symptom
))}
<
/View
>
{
symptomRowSymptoms
.
map
(
symptom
=>
{
const
hasSymptomData
=
this
.
data
.
hasOwnProperty
(
symptom
)
return
(
<
SymptomCell
key
=
{
symptom
}
symptom
=
{
symptom
}
symptomValue
=
{
hasSymptomData
&&
this
.
data
[
symptom
]}
isSymptomDataComplete
=
{
hasSymptomData
&&
this
.
isSymptomDataComplete
(
symptom
)
}
height
=
{
this
.
props
.
symptomHeight
}
/>
)
}
)}
<
Surface
width
=
{
config
.
columnWidth
}
height
=
{
columnHeight
}
>
{
column
}
...
...
This diff is collapsed.
Click to expand it.
components/chart/symptom-cell.js
0 → 100644
+
52
−
0
View file @
0adbf343
import
React
from
'
react
'
import
PropTypes
from
'
prop-types
'
import
{
View
}
from
'
react-native
'
import
styles
from
'
./styles
'
const
SymptomCell
=
({
height
,
symptom
,
symptomValue
,
isSymptomDataComplete
})
=>
{
const
shouldDrawDot
=
symptomValue
!==
false
const
styleParent
=
[
styles
.
symptomRow
,
{
height
}]
let
styleChild
if
(
shouldDrawDot
)
{
const
styleSymptom
=
styles
.
iconColors
[
symptom
]
const
symptomColor
=
styleSymptom
.
shades
[
symptomValue
]
const
isMucusOrCervix
=
(
symptom
===
'
mucus
'
)
||
(
symptom
===
'
cervix
'
)
const
backgroundColor
=
(
isMucusOrCervix
&&
!
isSymptomDataComplete
)
?
'
white
'
:
symptomColor
const
borderWidth
=
(
isMucusOrCervix
&&
!
isSymptomDataComplete
)
?
2
:
0
const
borderColor
=
symptomColor
styleChild
=
[
styles
.
symptomDot
,
{
backgroundColor
,
borderColor
,
borderWidth
}]
}
return
(
<
View
style
=
{
styleParent
}
key
=
{
symptom
}
>
{
shouldDrawDot
&&
<
View
style
=
{
styleChild
}
/>
}
<
/View
>
)
}
SymptomCell
.
propTypes
=
{
height
:
PropTypes
.
number
,
symptom
:
PropTypes
.
string
,
symptomValue
:
PropTypes
.
oneOfType
([
PropTypes
.
bool
,
PropTypes
.
number
,
]),
isSymptomDataComplete
:
PropTypes
.
bool
,
}
export
default
SymptomCell
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