Improve symptom data display
This commit is contained in:
@@ -121,33 +121,28 @@ function getLabel(symptomName, symptom) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mucus: mucus => {
|
mucus: mucus => {
|
||||||
if (
|
const categories = ['feeling', 'texture', 'value']
|
||||||
typeof mucus.feeling === 'number' &&
|
if (categories.every(c => typeof mucus[c] === 'number')) {
|
||||||
typeof mucus.texture === 'number' &&
|
let mucusLabel = [feelingLabels[mucus.feeling], textureLabels[mucus.texture]].join(', ')
|
||||||
typeof mucus.value === 'number'
|
mucusLabel += `\n${computeSensiplanMucusLabels[mucus.value]}`
|
||||||
) {
|
if (mucus.exclude) mucusLabel = `(${mucusLabel})`
|
||||||
let mucusLabel =
|
|
||||||
`${feelingLabels[mucus.feeling]} +
|
|
||||||
${textureLabels[mucus.texture]}
|
|
||||||
( ${computeSensiplanMucusLabels[mucus.value]} )`
|
|
||||||
if (mucus.exclude) mucusLabel = "( " + mucusLabel + " )"
|
|
||||||
return mucusLabel
|
return mucusLabel
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cervix: cervix => {
|
cervix: cervix => {
|
||||||
|
let cervixLabel = []
|
||||||
if (cervix.opening > -1 && cervix.firmness > -1) {
|
if (cervix.opening > -1 && cervix.firmness > -1) {
|
||||||
let cervixLabel =
|
cervixLabel.push(openingLabels[cervix.opening], firmnessLabels[cervix.firmness])
|
||||||
`${openingLabels[cervix.opening]} +
|
|
||||||
${firmnessLabels[cervix.firmness]}`
|
|
||||||
if (cervix.position > -1) {
|
if (cervix.position > -1) {
|
||||||
cervixLabel += `+ ${positionLabels[cervix.position]}`
|
cervixLabel.push(positionLabels[cervix.position])
|
||||||
}
|
}
|
||||||
if (cervix.exclude) cervixLabel = "( " + cervixLabel + " )"
|
cervixLabel = cervixLabel.join(', ')
|
||||||
|
if (cervix.exclude) cervixLabel = `(${cervixLabel})`
|
||||||
return cervixLabel
|
return cervixLabel
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
note: note => {
|
note: note => {
|
||||||
return note.value.slice(0, 12) + '...'
|
return note.value
|
||||||
},
|
},
|
||||||
desire: desire => {
|
desire: desire => {
|
||||||
if (typeof desire.value === 'number') {
|
if (typeof desire.value === 'number') {
|
||||||
@@ -156,20 +151,22 @@ function getLabel(symptomName, symptom) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
sex: sex => {
|
sex: sex => {
|
||||||
let sexLabel = ''
|
const sexLabel = []
|
||||||
if ( sex.solo || sex.partner ) {
|
if ( sex.solo || sex.partner ) {
|
||||||
sexLabel += 'Activity '
|
sexLabel.push('activity')
|
||||||
}
|
}
|
||||||
if (sex.condom || sex.pill || sex.iud ||
|
if (sex.condom || sex.pill || sex.iud ||
|
||||||
sex.patch || sex.ring || sex.implant || sex.other) {
|
sex.patch || sex.ring || sex.implant || sex.other) {
|
||||||
sexLabel += 'Contraceptive'
|
sexLabel.push('contraceptive')
|
||||||
}
|
}
|
||||||
return sexLabel ? sexLabel : undefined
|
return sexLabel.join(', ')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!symptom) return
|
if (!symptom) return
|
||||||
return labels[symptomName](symptom)
|
const label = labels[symptomName](symptom)
|
||||||
|
if (label.length < 50) return label
|
||||||
|
return label.slice(0, 47) + '...'
|
||||||
}
|
}
|
||||||
|
|
||||||
class SymptomBox extends Component {
|
class SymptomBox extends Component {
|
||||||
@@ -190,7 +187,9 @@ class SymptomBox extends Component {
|
|||||||
{...iconStyle}
|
{...iconStyle}
|
||||||
/>
|
/>
|
||||||
<Text style={textStyle}>{this.props.title}</Text>
|
<Text style={textStyle}>{this.props.title}</Text>
|
||||||
<Text style={textStyle}>{this.props.data}</Text>
|
</View>
|
||||||
|
<View style={styles.symptomDataBox}>
|
||||||
|
<Text style={styles.symptomDataText}>{this.props.data}</Text>
|
||||||
</View>
|
</View>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
)
|
)
|
||||||
@@ -199,12 +198,12 @@ class SymptomBox extends Component {
|
|||||||
|
|
||||||
class FillerBoxes extends Component {
|
class FillerBoxes extends Component {
|
||||||
render() {
|
render() {
|
||||||
const n = Dimensions.get('window').width / styles.symptomBox.minHeight
|
const n = Dimensions.get('window').width / styles.symptomBox.width
|
||||||
const fillerBoxes = []
|
const fillerBoxes = []
|
||||||
for (let i = 0; i < Math.ceil(n); i++) {
|
for (let i = 0; i < Math.ceil(n); i++) {
|
||||||
fillerBoxes.push(
|
fillerBoxes.push(
|
||||||
<View
|
<View
|
||||||
width={styles.symptomBox.minHeight}
|
width={styles.symptomBox.width}
|
||||||
height={0}
|
height={0}
|
||||||
key={i.toString()}
|
key={i.toString()}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
export const bleeding = ['spotting', 'light', 'medium', 'heavy']
|
export const bleeding = ['spotting', 'light', 'medium', 'heavy']
|
||||||
export const mucusFeeling = ['dry', 'nothing', 'wet', 'slippery']
|
export const mucusFeeling = ['dry', 'nothing', 'wet', 'slippery']
|
||||||
export const mucusTexture = ['nothing', 'creamy', 'egg white']
|
export const mucusTexture = ['nothing', 'creamy', 'egg white']
|
||||||
export const mucusNFP = ['t', 'Ø', 'f', 'S', '+S']
|
export const mucusNFP = ['t', 'Ø', 'f', 'S', 'S+']
|
||||||
export const cervixOpening = ['closed', 'medium', 'open']
|
export const cervixOpening = ['closed', 'medium', 'open']
|
||||||
export const cervixFirmness = ['hard', 'soft']
|
export const cervixFirmness = ['hard', 'soft']
|
||||||
export const cervixPosition = ['low', 'medium', 'high']
|
export const cervixPosition = ['low', 'medium', 'high']
|
||||||
|
|||||||
+24
-5
@@ -50,13 +50,14 @@ export default StyleSheet.create({
|
|||||||
borderColor: secondaryColor,
|
borderColor: secondaryColor,
|
||||||
borderStyle: 'solid',
|
borderStyle: 'solid',
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
borderRadius: 10,
|
borderTopLeftRadius: 10,
|
||||||
justifyContent: 'center',
|
borderTopRightRadius: 10,
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
marginTop: '20%',
|
marginTop: '10%',
|
||||||
|
paddingVertical: '6%',
|
||||||
marginHorizontal: 1,
|
marginHorizontal: 1,
|
||||||
minWidth: 100,
|
width: 110,
|
||||||
minHeight: 100,
|
height: 80,
|
||||||
},
|
},
|
||||||
symptomBoxActive: {
|
symptomBoxActive: {
|
||||||
backgroundColor: secondaryColor,
|
backgroundColor: secondaryColor,
|
||||||
@@ -64,6 +65,24 @@ export default StyleSheet.create({
|
|||||||
symptomTextActive: {
|
symptomTextActive: {
|
||||||
color: fontOnPrimaryColor
|
color: fontOnPrimaryColor
|
||||||
},
|
},
|
||||||
|
symptomDataBox: {
|
||||||
|
borderColor: secondaryColor,
|
||||||
|
borderStyle: 'solid',
|
||||||
|
borderLeftWidth: 1,
|
||||||
|
borderRightWidth: 1,
|
||||||
|
borderBottomWidth: 1,
|
||||||
|
borderBottomLeftRadius: 10,
|
||||||
|
borderBottomRightRadius: 10,
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
padding: '3%',
|
||||||
|
marginHorizontal: 1,
|
||||||
|
width: 110,
|
||||||
|
height: 50,
|
||||||
|
},
|
||||||
|
symptomDataText: {
|
||||||
|
fontSize: 12
|
||||||
|
},
|
||||||
symptomEditRow: {
|
symptomEditRow: {
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
marginBottom: 10,
|
marginBottom: 10,
|
||||||
|
|||||||
Reference in New Issue
Block a user