diff --git a/components/cycle-day/cycle-day-overview.js b/components/cycle-day/cycle-day-overview.js
index 6741598..d4ea2cc 100644
--- a/components/cycle-day/cycle-day-overview.js
+++ b/components/cycle-day/cycle-day-overview.js
@@ -5,7 +5,10 @@ import {
Text
} from 'react-native'
import styles from '../../styles'
-import { bleeding as labels} from './labels/labels'
+import {
+ bleedingLabels as bleedingLabels,
+ mucusFeeling as feelingLabels
+} from './labels/labels'
import cycleDayModule from '../../lib/get-cycle-day-number'
import { bleedingDaysSortedByDate } from '../../db'
@@ -39,7 +42,7 @@ export default class DayView extends Component {
const bleedingValue = this.cycleDay.bleeding && this.cycleDay.bleeding.value
let bleedingLabel
if (typeof bleedingValue === 'number') {
- bleedingLabel = `${labels[bleedingValue]}`
+ bleedingLabel = `${bleedingLabels[bleedingValue]}`
if (this.cycleDay.bleeding.exclude) bleedingLabel = "( " + bleedingLabel + " )"
} else {
bleedingLabel = 'edit'
@@ -55,6 +58,15 @@ export default class DayView extends Component {
temperatureLabel = 'edit'
}
+ const mucusFeelingValue = this.cycleDay.mucus && this.cycleDay.mucus.value
+ let mucusFeelingLabel
+ if (typeof mucusFeelingValue === 'number') {
+ mucusFeelingLabel = `${feelingLabels[mucusFeelingValue]}`
+ if (this.cycleDay.mucus.exclude) mucusFeelingLabel = "( " + mucusFeelingLabel + " )"
+ } else {
+ mucusFeelingLabel = 'edit'
+ }
+
return (
@@ -75,7 +87,18 @@ export default class DayView extends Component {
+
+
+ Mucus
+
+
+
+
+
)
}
-}
\ No newline at end of file
+}
diff --git a/components/cycle-day/index.js b/components/cycle-day/index.js
index bcd8465..3d63466 100644
--- a/components/cycle-day/index.js
+++ b/components/cycle-day/index.js
@@ -7,6 +7,7 @@ import cycleDayModule from '../../lib/get-cycle-day-number'
import DayView from './cycle-day-overview'
import BleedingEditView from './symptoms/bleeding'
import TemperatureEditView from './symptoms/temperature'
+import MucusEditView from './symptoms/mucus'
import { formatDateForViewHeader } from './labels/format'
import styles from '../../styles'
import actionButtonModule from './action-buttons'
@@ -44,12 +45,13 @@ export default class Day extends Component {
{
{ dayView: ,
- bleedingEditView: ,
- temperatureEditView:
+ bleedingEditView: ,
+ temperatureEditView: ,
+ mucusEditView:
}[this.state.visibleComponent]
}
)
}
-}
\ No newline at end of file
+}
diff --git a/components/cycle-day/labels/labels.js b/components/cycle-day/labels/labels.js
index a5ed61a..83c1afe 100644
--- a/components/cycle-day/labels/labels.js
+++ b/components/cycle-day/labels/labels.js
@@ -1,5 +1,9 @@
const bleeding = ['spotting', 'light', 'medium', 'heavy']
+const mucusFeeling = ['dry', 'nothing', 'wet', 'slippery']
+const mucusTexture = ['nothing', 'creamy', 'egg white']
export {
- bleeding
-}
\ No newline at end of file
+ bleeding,
+ mucusFeeling,
+ mucusTexture
+}
diff --git a/components/cycle-day/symptoms/mucus.js b/components/cycle-day/symptoms/mucus.js
new file mode 100644
index 0000000..38489cf
--- /dev/null
+++ b/components/cycle-day/symptoms/mucus.js
@@ -0,0 +1,107 @@
+import React, { Component } from 'react'
+import {
+ View,
+ Button,
+ Text,
+ Switch
+} from 'react-native'
+import RadioForm from 'react-native-simple-radio-button'
+import styles from '../../../styles'
+import { saveSymptom } from '../../../db'
+import {
+ mucusFeeling as feelingLabels,
+ mucusTexture as textureLabels
+} from '../labels/labels'
+
+export default class Mucus extends Component {
+ constructor(props) {
+ super(props)
+ this.cycleDay = props.cycleDay
+ this.showView = props.showView
+
+ this.currentFeelingValue = this.cycleDay.mucus && this.cycleDay.mucus.feeling
+ if (typeof this.currentFeelingValue !== 'number') {
+ this.currentFeelingValue = -1
+ }
+
+ this.currentTextureValue = this.cycleDay.mucus && this.cycleDay.mucus.texture
+ if (typeof this.currentTextureValue !== 'number') {
+ this.currentTextureValue = -1
+ }
+ this.state = {
+ exclude: this.cycleDay.mucus ? this.cycleDay.mucus.exclude : false
+ }
+ }
+
+ render() {
+ const mucusFeelingRadioProps = [
+ {label: feelingLabels[0], value: 0 },
+ {label: feelingLabels[1], value: 1 },
+ {label: feelingLabels[2], value: 2 },
+ {label: feelingLabels[3], value: 3 }
+ ]
+ const mucusTextureRadioProps = [
+ {label: textureLabels[0], value: 0 },
+ {label: textureLabels[1], value: 1 },
+ {label: textureLabels[2], value: 2 }
+ ]
+ return(
+
+ Mucus
+ Feeling
+
+ {
+ this.currentFeelingValue = itemValue
+ }}
+ />
+
+ Texture
+
+ {
+ this.currentTextureValue = itemValue
+ }}
+ />
+
+
+ Exclude
+ {
+ this.setState({ exclude: val })
+ }}
+ value={this.state.exclude}
+ />
+
+
+
+ {this.makeActionButtons(
+ {
+ symptom: 'mucus',
+ cycleDay: this.cycleDay,
+ saveAction: () => {
+ saveSymptom('mucus', this.cycleDay, {
+ feeling: this.currentFeelingValue,
+ texture: this.currentTextureValue,
+ exclude: this.state.exclude
+ })
+ },
+ saveDisabled: this.state.currentFeelingValue === -1 || this.state.currentTextureValue === -1
+ }
+ )}
+
+
+
+ )
+ }
+}
diff --git a/db.js b/db.js
index 00e1d94..455acd8 100644
--- a/db.js
+++ b/db.js
@@ -18,6 +18,15 @@ const BleedingSchema = {
}
}
+const MucusSchema = {
+ name: 'Mucus',
+ properties: {
+ feeling: 'int',
+ texture: 'int',
+ exclude: 'bool'
+ }
+}
+
const CycleDaySchema = {
name: 'CycleDay',
primaryKey: 'date',
@@ -30,6 +39,10 @@ const CycleDaySchema = {
bleeding: {
type: 'Bleeding',
optional: true
+ },
+ mucus: {
+ type: 'Mucus',
+ optional: true
}
}
}
@@ -38,7 +51,8 @@ const db = new Realm({
schema: [
CycleDaySchema,
TemperatureSchema,
- BleedingSchema
+ BleedingSchema,
+ MucusSchema
],
// we only want this in dev mode
deleteRealmIfMigrationNeeded: true