Revert "Merge branch 'chore/cleanup-date-usage' into 'main'"

This reverts merge request !492
This commit is contained in:
Sofiya Tepikin
2022-08-20 14:03:43 +00:00
parent 84f72d74bf
commit 1ada7a0cde
13 changed files with 213 additions and 157 deletions
+33 -31
View File
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types'
import { TouchableOpacity } from 'react-native'
import { connect } from 'react-redux'
import { setDate } from '../../slices/date'
import { navigate } from '../../slices/navigation'
import { getCycleDay } from '../../db'
@@ -14,7 +15,7 @@ import CycleDayLabel from './cycle-day-label'
import {
symptomColorMethods,
getTemperatureProps,
isSymptomDataComplete,
isSymptomDataComplete
} from '../helpers/chart'
class DayColumn extends Component {
@@ -39,17 +40,14 @@ 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 =
@@ -80,13 +78,12 @@ class DayColumn extends Component {
}
render() {
const {
columnHeight,
const { columnHeight,
dateString,
shouldShowTemperatureColumn,
symptomHeight,
symptomRowSymptoms,
xAxisHeight,
xAxisHeight
} = this.props
return (
@@ -94,22 +91,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}
/>
)}
<CycleDayLabel height={xAxisHeight} date={dateString} />
{shouldShowTemperatureColumn && <TemperatureColumn
horizontalLinePosition={this.fhmAndLtl.drawLtlAt}
isVerticalLine={this.fhmAndLtl.drawFhmLine}
data={this.data && this.data.temperature}
columnHeight={columnHeight}
/>}
{symptomRowSymptoms.map((symptom, i) => {
const hasSymptomData = Object.prototype.hasOwnProperty.call(
this.data,
symptom
)
<CycleDayLabel
height={xAxisHeight}
date={dateString}
/>
{ symptomRowSymptoms.map((symptom, i) => {
const hasSymptomData =
Object.prototype.hasOwnProperty.call(this.data, symptom)
return (
<SymptomCell
index={i}
@@ -120,18 +117,23 @@ 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)