Pass in symptoms as flat properties, not object

This commit is contained in:
Julia Friesel
2018-09-17 20:24:28 +02:00
parent 44c51225e6
commit 03022ffa88
2 changed files with 12 additions and 12 deletions
+2 -1
View File
@@ -62,6 +62,7 @@ export default class CycleChart extends Component {
jsDate.getDate() jsDate.getDate()
).toString() ).toString()
}) })
const chartSymptoms = [ const chartSymptoms = [
'bleeding', 'bleeding',
'temperature', 'temperature',
@@ -103,7 +104,7 @@ export default class CycleChart extends Component {
return { return {
dateString, dateString,
y: temp ? normalizeToScale(temp, columnHeight) : null, y: temp ? normalizeToScale(temp, columnHeight) : null,
symptoms, ...symptoms,
...getFhmAndLtlInfo(dateString, temp, columnHeight) ...getFhmAndLtlInfo(dateString, temp, columnHeight)
} }
}) })
+10 -11
View File
@@ -31,7 +31,6 @@ export default class DayColumn extends Component {
dateString, dateString,
y, y,
temperatureExclude, temperatureExclude,
symptoms,
drawFhmLine, drawFhmLine,
drawLtlAt, drawLtlAt,
rightY, rightY,
@@ -116,36 +115,36 @@ export default class DayColumn extends Component {
> >
<View height={symptomHeight}> <View height={symptomHeight}>
<View style={styles.symptomRow}> <View style={styles.symptomRow}>
{typeof symptoms.bleeding === 'number' && {typeof this.props.bleeding === 'number' &&
<Icon <Icon
name='drop' name='drop'
size={12} size={12}
color={styles.bleedingIconShades[symptoms.bleeding]} color={styles.bleedingIconShades[this.props.bleeding]}
key='bleeding' key='bleeding'
/> />
} }
</View> </View>
<View style={styles.symptomRow}> <View style={styles.symptomRow}>
{typeof symptoms.mucus === 'number' && {typeof this.props.mucus === 'number' &&
<View <View
{...styles.mucusIcon} {...styles.mucusIcon}
backgroundColor={styles.mucusIconShades[symptoms.mucus]} backgroundColor={styles.mucusIconShades[this.props.mucus]}
key='mucus' key='mucus'
/> />
} }
</View> </View>
<View style={styles.symptomRow}> <View style={styles.symptomRow}>
{typeof symptoms.cervix === 'number' && {typeof this.props.cervix === 'number' &&
<View <View
{...styles.mucusIcon} {...styles.mucusIcon}
// cervix is sum of openess and firmness - fertile only when closed and hard (=0) // cervix is sum of openess and firmness - fertile only when closed and hard (=0)
backgroundColor={symptoms.cervix > 0 ? 'blue' : 'green'} backgroundColor={this.props.cervix > 0 ? 'blue' : 'green'}
key='cervix' key='cervix'
/> />
} }
</View> </View>
<View style={styles.symptomRow}> <View style={styles.symptomRow}>
{typeof symptoms.sex === 'number' && {typeof this.props.sex === 'number' &&
<View <View
{...styles.mucusIcon} {...styles.mucusIcon}
backgroundColor='orange' backgroundColor='orange'
@@ -154,7 +153,7 @@ export default class DayColumn extends Component {
} }
</View> </View>
<View style={styles.symptomRow}> <View style={styles.symptomRow}>
{typeof symptoms.desire === 'number' && {typeof this.props.desire === 'number' &&
<View <View
{...styles.mucusIcon} {...styles.mucusIcon}
backgroundColor='red' backgroundColor='red'
@@ -163,7 +162,7 @@ export default class DayColumn extends Component {
} }
</View> </View>
<View style={styles.symptomRow}> <View style={styles.symptomRow}>
{symptoms.pain && {this.props.pain &&
<View <View
{...styles.mucusIcon} {...styles.mucusIcon}
backgroundColor='blue' backgroundColor='blue'
@@ -172,7 +171,7 @@ export default class DayColumn extends Component {
} }
</View> </View>
<View style={styles.symptomRow}> <View style={styles.symptomRow}>
{symptoms.note && {this.props.note &&
<View <View
{...styles.mucusIcon} {...styles.mucusIcon}
backgroundColor='green' backgroundColor='green'