diff --git a/components/chart/chart.js b/components/chart/chart.js index ccffbba..97717df 100644 --- a/components/chart/chart.js +++ b/components/chart/chart.js @@ -2,6 +2,7 @@ import React, { Component } from 'react' import { View, FlatList } from 'react-native' import range from 'date-range' import { LocalDate } from 'js-joda' +import Svg, { G } from 'react-native-svg' import { makeYAxisLabels, normalizeToScale, makeHorizontalGrid } from './y-axis' import nfpLines from './nfp-lines' import DayColumn from './day-column' @@ -11,6 +12,13 @@ import { scaleObservable } from '../../local-storage' import config from '../../config' import { AppText } from '../app-text' import { shared as labels } from '../labels' +import BleedingIcon from '../../assets/bleeding' +import CervixIcon from '../../assets/cervix' +import DesireIcon from '../../assets/desire' +import MucusIcon from '../../assets/mucus' +import NoteIcon from '../../assets/note' +import PainIcon from '../../assets/pain' +import SexIcon from '../../assets/sex' export default class CycleChart extends Component { constructor(props) { @@ -55,7 +63,8 @@ export default class CycleChart extends Component { this.xAxisHeight = this.state.chartHeight * config.xAxisHeightPercentage const remainingHeight = this.state.chartHeight - this.xAxisHeight this.symptomHeight = config.symptomHeightPercentage * remainingHeight - this.symptomRowHeight = this.symptomRowSymptoms.length * this.symptomHeight + this.symptomRowHeight = this.symptomRowSymptoms.length * + this.symptomHeight this.columnHeight = remainingHeight - this.symptomRowHeight const chartSymptoms = [...this.symptomRowSymptoms] @@ -112,7 +121,8 @@ export default class CycleChart extends Component { (cycleDay.cervix.opening + cycleDay.cervix.firmness) } else if (symptom === 'sex') { // solo = 1 + partner = 2 - acc.sex = cycleDay.sex && (cycleDay.sex.solo + 2 * cycleDay.sex.partner) + acc.sex = cycleDay.sex && + (cycleDay.sex.solo + 2 * cycleDay.sex.partner) } else if (symptom === 'pain') { // is any pain documented? acc.pain = cycleDay.pain && @@ -153,8 +163,23 @@ export default class CycleChart extends Component { {this.symptomRowSymptoms.map(symptomName => { - return - {symptomName[0]} + return + + + {symptomIcons[symptomName].icon} + + })} @@ -162,10 +187,16 @@ export default class CycleChart extends Component { {makeYAxisLabels(this.columnHeight)} - + {labels.cycleDayWithLinebreak} - + {labels.date} @@ -224,4 +255,42 @@ function getInfoForNeighborColumns(index, cols) { ret.leftTemperatureExclude = left.temperatureExclude } return ret +} + +const symptomIcons = { + 'bleeding': { + 'viewBox': '10 10 320 400', + 'color': styles.iconShades.bleeding[3], + 'icon': + }, + 'mucus': { + 'viewBox': '10 10 320 400', + 'color': styles.iconShades.mucus[4], + 'icon': + }, + 'cervix': { + 'viewBox': '10 10 320 440', + 'color': styles.iconShades.cervix[3], + 'icon': + }, + 'desire': { + 'viewBox': '10 10 320 380', + 'color': styles.iconShades.desire[2], + 'icon': + }, + 'sex': { + 'viewBox': '10 10 320 400', + 'color': styles.iconShades.sex[2], + 'icon': + }, + 'pain': { + 'viewBox': '10 10 300 400', + 'color': styles.iconShades.pain[0], + 'icon': + }, + 'note': { + 'viewBox': '10 10 270 400', + 'color': styles.iconShades.note[0], + 'icon': + }, } \ No newline at end of file diff --git a/components/cycle-day/symptoms/action-button-footer.js b/components/cycle-day/symptoms/action-button-footer.js index 15f22eb..e923d8b 100644 --- a/components/cycle-day/symptoms/action-button-footer.js +++ b/components/cycle-day/symptoms/action-button-footer.js @@ -56,7 +56,12 @@ export default class ActionButtonFooter extends Component { const textStyle = [styles.menuText] if (disabledCondition) textStyle.push(styles.menuTextInActive) const iconStyle = disabledCondition ? - Object.assign({}, iconStyles.menuIcon, iconStyles.menuIconInactive) : + Object.assign( + {}, + iconStyles.menuIcon, + iconStyles.menuIconInactive + ) + : iconStyles.menuIcon return ( diff --git a/components/header.js b/components/header.js index ad96ba3..3cc76d9 100644 --- a/components/header.js +++ b/components/header.js @@ -16,7 +16,10 @@ export default class Header extends Component { return ( this.props.isCycleDayOverView ? - +