Prettify rest of the components files except stats

This commit is contained in:
Sofiya Tepikin
2022-09-08 12:19:36 +02:00
parent 23549ee72d
commit 840fca5b9e
14 changed files with 208 additions and 226 deletions
+31 -31
View File
@@ -15,7 +15,7 @@ import CycleDayLabel from './cycle-day-label'
import {
symptomColorMethods,
getTemperatureProps,
isSymptomDataComplete
isSymptomDataComplete,
} from '../helpers/chart'
class DayColumn extends Component {
@@ -40,14 +40,17 @@ class DayColumn extends Component {
this.data = {}
if (cycleDayData) {
this.data = chartSymptoms.reduce((symptomDataToDisplay, symptom, ) => {
this.data = chartSymptoms.reduce((symptomDataToDisplay, symptom) => {
const symptomData = cycleDayData[symptom]
if (symptomData && symptom === 'temperature') {
symptomDataToDisplay[symptom] =
getTemperatureProps(symptomData, columnHeight, dateString)
symptomDataToDisplay[symptom] = getTemperatureProps(
symptomData,
columnHeight,
dateString
)
} else {
if (symptomData && ! symptomData.exclude) {
if (symptomData && !symptomData.exclude) {
// if symptomColorMethods entry doesn't exist for given symptom,
// use 'default'
const getSymptomColorIndex =
@@ -78,12 +81,13 @@ class DayColumn extends Component {
}
render() {
const { columnHeight,
const {
columnHeight,
dateString,
shouldShowTemperatureColumn,
symptomHeight,
symptomRowSymptoms,
xAxisHeight
xAxisHeight,
} = this.props
return (
@@ -91,22 +95,22 @@ class DayColumn extends Component {
onPress={() => this.onDaySelect(dateString)}
activeOpacity={1}
>
{shouldShowTemperatureColumn && (
<TemperatureColumn
horizontalLinePosition={this.fhmAndLtl.drawLtlAt}
isVerticalLine={this.fhmAndLtl.drawFhmLine}
data={this.data && this.data.temperature}
columnHeight={columnHeight}
/>
)}
{shouldShowTemperatureColumn && <TemperatureColumn
horizontalLinePosition={this.fhmAndLtl.drawLtlAt}
isVerticalLine={this.fhmAndLtl.drawFhmLine}
data={this.data && this.data.temperature}
columnHeight={columnHeight}
/>}
<CycleDayLabel height={xAxisHeight} date={dateString} />
<CycleDayLabel
height={xAxisHeight}
date={dateString}
/>
{ symptomRowSymptoms.map((symptom, i) => {
const hasSymptomData =
Object.prototype.hasOwnProperty.call(this.data, symptom)
{symptomRowSymptoms.map((symptom, i) => {
const hasSymptomData = Object.prototype.hasOwnProperty.call(
this.data,
symptom
)
return (
<SymptomCell
index={i}
@@ -117,23 +121,19 @@ class DayColumn extends Component {
hasSymptomData && isSymptomDataComplete(symptom, dateString)
}
height={symptomHeight}
/>)
}
)}
/>
)
})}
</TouchableOpacity>
)
}
}
const mapDispatchToProps = (dispatch) => {
return({
return {
setDate: (date) => dispatch(setDate(date)),
navigate: (page) => dispatch(navigate(page)),
})
}
}
export default connect(
null,
mapDispatchToProps,
)(DayColumn)
export default connect(null, mapDispatchToProps)(DayColumn)