little improvements after review

This commit is contained in:
tina
2018-09-26 11:02:40 +02:00
parent 545c334654
commit cdef99d616
5 changed files with 48 additions and 59 deletions
+12 -38
View File
@@ -10,6 +10,7 @@ import styles from './styles'
import { scaleObservable } from '../../local-storage' import { scaleObservable } from '../../local-storage'
import config from '../../config' import config from '../../config'
import { AppText } from '../app-text' import { AppText } from '../app-text'
import { shared as labels } from '../labels'
export default class CycleChart extends Component { export default class CycleChart extends Component {
constructor(props) { constructor(props) {
@@ -137,7 +138,6 @@ export default class CycleChart extends Component {
} }
render() { render() {
console.log(this.symptomRowSymptoms)
return ( return (
<View <View
onLayout={this.onLayout} onLayout={this.onLayout}
@@ -145,55 +145,29 @@ export default class CycleChart extends Component {
> >
{!this.state.chartLoaded && {!this.state.chartLoaded &&
<View style={{width: '100%', justifyContent: 'center', alignItems: 'center'}}> <View style={{width: '100%', justifyContent: 'center', alignItems: 'center'}}>
<AppText>Loading...</AppText> <AppText>{labels.loading}</AppText>
</View> </View>
} }
{this.state.chartHeight && this.state.chartLoaded && {this.state.chartHeight && this.state.chartLoaded &&
<View> <View>
<View <View style={[styles.yAxis, {height: this.symptomRowHeight}]}>
style={[
styles.yAxis,
{
height: this.symptomRowHeight,
}
]}
>
{this.symptomRowSymptoms.map(symptomName => { {this.symptomRowSymptoms.map(symptomName => {
return <View key={symptomName} style={{flex: 1}}> return <View key={symptomName} style={{flex: 1}}>
<AppText>{symptomName[0]}</AppText> <AppText>{symptomName[0]}</AppText>
</View> </View>
}) })}
}
</View> </View>
<View <View style={[styles.yAxis, {height: this.columnHeight}]}>
style={[styles.yAxis, {
height: this.columnHeight,
}]}
>
{makeYAxisLabels(this.columnHeight)} {makeYAxisLabels(this.columnHeight)}
</View> </View>
<View style={[ <View style={[styles.yAxis, {height: this.xAxisHeight}]}>
styles.yAxis, <AppText style = {[styles.column.label.number, styles.yAxisLabels.cycleDayLabel]}>
{ {labels.cycleDayWithLinebreak}
height: this.xAxisHeight </AppText>
} <AppText style={[styles.column.label.date,styles.yAxisLabels.dateLabel]}>
]}> {labels.date}
<AppText style = {[ </AppText>
styles.column.label.number,
{
textAlign: 'center',
justifyContent: 'center',
fontSize: Math.ceil(styles.column.label.number.fontSize / 2)
}
]}>{'Cycle\nday'}</AppText>
<AppText style={[
styles.column.label.date,
{
textAlign: 'center',
justifyContent: 'center'
}
]}>{'Date'}</AppText>
</View> </View>
</View>} </View>}
+1 -1
View File
@@ -149,7 +149,7 @@ export default class DayColumn extends Component {
<View <View
{...styles.symptomIcon} {...styles.symptomIcon}
// 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={this.props.cervix > 0 ? styles.iconShades.cervix[1] : styles.iconShades.cervix[0]} backgroundColor={this.props.cervix > 0 ? styles.iconShades.cervix[2] : styles.iconShades.cervix[0]}
/> />
</SymptomIconView> </SymptomIconView>
), ),
+25 -13
View File
@@ -8,6 +8,7 @@ const lineWidth = 1.5
const colorLtl = '#feb47b' const colorLtl = '#feb47b'
const gridColor = 'lightgrey' const gridColor = 'lightgrey'
const gridLineWidth = 0.5 const gridLineWidth = 0.5
const numberLabelFontSize = 13
const styles = { const styles = {
curve: { curve: {
@@ -36,7 +37,7 @@ const styles = {
}, },
number: { number: {
color: primaryColor, color: primaryColor,
fontSize: 13, fontSize: numberLabelFontSize,
textAlign: 'center', textAlign: 'center',
} }
}, },
@@ -57,11 +58,11 @@ const styles = {
iconShades: { iconShades: {
'bleeding': shadesOfRed, 'bleeding': shadesOfRed,
'mucus': [ 'mucus': [
'#e8f6a4', '#e3e7ed',
'#bccd67', '#c8cfdc',
'#91a437', '#acb8cb',
'#6a7b15', '#91a0ba',
'#445200', '#7689a9'
], ],
'cervix': [ 'cervix': [
'#f0e19d', '#f0e19d',
@@ -70,16 +71,16 @@ const styles = {
'#dbb40c', '#dbb40c',
], ],
'sex': [ 'sex': [
'#A66FA6', '#a87ca2',
'#8A458A', '#8b5083',
'#6f2565', '#6f2565',
], ],
'desire': [ 'desire': [
'#68113f', '#c485a6',
'#8b2e5f', '#b15c89',
'#ad5784', '#9e346c',
], ],
'pain': ['#7689A9'], 'pain': ['#bccd67'],
'note': ['#6CA299'] 'note': ['#6CA299']
}, },
yAxis: { yAxis: {
@@ -88,13 +89,24 @@ const styles = {
borderColor: 'lightgrey', borderColor: 'lightgrey',
borderStyle: 'solid' borderStyle: 'solid'
}, },
yAxisLabel: { yAxisLabels: {
tempScale: {
position: 'absolute', position: 'absolute',
right: 2, right: 2,
color: 'grey', color: 'grey',
fontSize: 9, fontSize: 9,
textAlign: 'left' textAlign: 'left'
}, },
cycleDayLabel: {
textAlign: 'center',
justifyContent: 'center',
fontSize: Math.ceil(numberLabelFontSize / 2)
},
dateLabel: {
textAlign: 'center',
justifyContent: 'center'
}
},
horizontalGrid: { horizontalGrid: {
position:'absolute', position:'absolute',
borderColor: gridColor, borderColor: gridColor,
+1 -1
View File
@@ -8,7 +8,7 @@ import { AppText } from '../app-text'
export function makeYAxisLabels(columnHeight) { export function makeYAxisLabels(columnHeight) {
const units = unitObservable.value const units = unitObservable.value
const scaleMax = scaleObservable.value.max const scaleMax = scaleObservable.value.max
const style = styles.yAxisLabel const style = styles.yAxisLabels.tempScale
return getTickPositions(columnHeight).map((y, i) => { return getTickPositions(columnHeight).map((y, i) => {
const tick = scaleMax - i * units const tick = scaleMax - i * units
+4 -1
View File
@@ -8,7 +8,10 @@ export const shared = {
incorrectPasswordMessage: 'That password is incorrect.', incorrectPasswordMessage: 'That password is incorrect.',
tryAgain: 'Try again', tryAgain: 'Try again',
ok: 'OK', ok: 'OK',
unlock: 'Unlock' unlock: 'Unlock',
date: 'Date',
cycleDayWithLinebreak: 'Cycle\nday',
loading: 'Loading ...'
} }
export const settings = { export const settings = {