Merge branch '76-change-day-view-layout' into 'master'
Resolve "change day view layout" Closes #76 See merge request bloodyhealth/drip!17
This commit is contained in:
+29
-5
@@ -33,34 +33,56 @@ export default class Bleeding extends Component {
|
|||||||
{label: labels[3], value: 3 },
|
{label: labels[3], value: 3 },
|
||||||
]
|
]
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={ styles.symptomEditView }>
|
||||||
<Text>Bleeding</Text>
|
<View style={ styles.symptomEditSplitSymptomsAndLastRowButtons }>
|
||||||
|
<View style={ styles.symptomEditListedSymptomView }>
|
||||||
|
<View style={{flex: 1}}>
|
||||||
|
<Text style={styles.symptomDayView}>Bleeding</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{flex: 1}}>
|
||||||
<RadioForm
|
<RadioForm
|
||||||
radio_props={bleedingRadioProps}
|
radio_props={bleedingRadioProps}
|
||||||
initial={this.state.currentValue}
|
initial={this.state.currentValue}
|
||||||
formHorizontal={true}
|
formHorizontal={true}
|
||||||
labelHorizontal={false}
|
labelHorizontal={false}
|
||||||
|
labelStyle={styles.radioButton}
|
||||||
onPress={(itemValue) => {
|
onPress={(itemValue) => {
|
||||||
this.setState({currentValue: itemValue})
|
this.setState({currentValue: itemValue})
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Text>Exclude</Text>
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={ styles.itemsInRowSeparatedView }>
|
||||||
|
<View style={ styles.singleButtonView }>
|
||||||
|
<Text style={ styles.symptomDayView }>Exclude</Text>
|
||||||
|
</View>
|
||||||
|
<View style={ styles.singleButtonView }>
|
||||||
<Switch
|
<Switch
|
||||||
onValueChange={(val) => {
|
onValueChange={(val) => {
|
||||||
this.setState({exclude: val})
|
this.setState({exclude: val})
|
||||||
}}
|
}}
|
||||||
value={this.state.exclude} />
|
value={this.state.exclude}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={ styles.itemsInRowSeparatedView }>
|
||||||
|
<View style={ styles.singleButtonView }>
|
||||||
<Button
|
<Button
|
||||||
onPress={() => this.showView('dayView')}
|
onPress={() => this.showView('dayView')}
|
||||||
title="Cancel">
|
title="Cancel">
|
||||||
</Button>
|
</Button>
|
||||||
|
</View>
|
||||||
|
<View style={ styles.singleButtonView }>
|
||||||
<Button
|
<Button
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
saveBleeding(this.cycleDay)
|
saveBleeding(this.cycleDay)
|
||||||
this.showView('dayView')
|
this.showView('dayView')
|
||||||
}}
|
}}
|
||||||
title="Delete entry">
|
title="Delete">
|
||||||
</Button>
|
</Button>
|
||||||
|
</View>
|
||||||
|
<View style={ styles.singleButtonView }>
|
||||||
<Button
|
<Button
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
saveBleeding(this.cycleDay, {
|
saveBleeding(this.cycleDay, {
|
||||||
@@ -73,6 +95,8 @@ export default class Bleeding extends Component {
|
|||||||
title="Save">
|
title="Save">
|
||||||
</Button>
|
</Button>
|
||||||
</View>
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+23
-11
@@ -39,32 +39,44 @@ export default class DayView extends Component {
|
|||||||
const bleedingValue = this.cycleDay.bleeding && this.cycleDay.bleeding.value
|
const bleedingValue = this.cycleDay.bleeding && this.cycleDay.bleeding.value
|
||||||
let bleedingLabel
|
let bleedingLabel
|
||||||
if (typeof bleedingValue === 'number') {
|
if (typeof bleedingValue === 'number') {
|
||||||
bleedingLabel = `Bleeding: ${labels[bleedingValue]}`
|
bleedingLabel = `${labels[bleedingValue]}`
|
||||||
if (this.cycleDay.bleeding.exclude) bleedingLabel += " (Excluded)"
|
if (this.cycleDay.bleeding.exclude) bleedingLabel = "( " + bleedingLabel + " )"
|
||||||
} else {
|
} else {
|
||||||
bleedingLabel = null
|
bleedingLabel = 'edit'
|
||||||
}
|
}
|
||||||
const temperatureValue = this.cycleDay.temperature && this.cycleDay.temperature.value
|
const temperatureValue = this.cycleDay.temperature && this.cycleDay.temperature.value
|
||||||
let temperatureLabel
|
let temperatureLabel
|
||||||
if (typeof temperatureValue === 'number') {
|
if (typeof temperatureValue === 'number') {
|
||||||
temperatureLabel = `Temperature: ${temperatureValue}`
|
temperatureLabel = `${temperatureValue} °C`
|
||||||
if (this.cycleDay.temperature.exclude) temperatureLabel += " (Excluded)"
|
if (this.cycleDay.temperature.exclude) temperatureLabel = "( " + temperatureLabel + " )"
|
||||||
} else {
|
} else {
|
||||||
temperatureLabel = null
|
temperatureLabel = 'edit'
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View>
|
<View style={ styles.symptomEditListedSymptomView }>
|
||||||
<Text style={styles.welcome}>{bleedingLabel}</Text>
|
<View style={ styles.itemsInRowSeparatedView }>
|
||||||
<Text style={styles.welcome}>{temperatureLabel}</Text>
|
<View style={{flex: 1}}>
|
||||||
|
<Text style={styles.symptomDayView}>Bleeding</Text>
|
||||||
|
</View>
|
||||||
|
<View style={ styles.singleButtonView }>
|
||||||
<Button
|
<Button
|
||||||
onPress={() => this.showView('bleedingEditView')}
|
onPress={() => this.showView('bleedingEditView')}
|
||||||
title="Edit bleeding">
|
title={bleedingLabel}>
|
||||||
</Button>
|
</Button>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={ styles.itemsInRowSeparatedView}>
|
||||||
|
<View style={{flex: 1}}>
|
||||||
|
<Text style={styles.symptomDayView}>Temperature</Text>
|
||||||
|
</View>
|
||||||
|
<View style={ styles.singleButtonView }>
|
||||||
<Button
|
<Button
|
||||||
onPress={() => this.showView('temperatureEditView')}
|
onPress={() => this.showView('temperatureEditView')}
|
||||||
title="Edit temperature">
|
title={temperatureLabel}>
|
||||||
</Button>
|
</Button>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
</View >
|
</View >
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-4
@@ -29,16 +29,23 @@ export default class Day extends Component {
|
|||||||
render() {
|
render() {
|
||||||
const cycleDayNumber = getCycleDayNumber(this.cycleDay.date)
|
const cycleDayNumber = getCycleDayNumber(this.cycleDay.date)
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={ styles.cycleDayOuterView }>
|
||||||
<Text style={styles.welcome}>{formatDateForViewHeader(this.cycleDay.date)}</Text>
|
<View style={ styles.cycleDayDateView }>
|
||||||
{ cycleDayNumber && <Text>Cycle day {cycleDayNumber}</Text> }
|
<Text style={styles.dateHeader}>
|
||||||
|
{formatDateForViewHeader(this.cycleDay.date)}
|
||||||
|
</Text>
|
||||||
|
</View >
|
||||||
|
<View style={ styles.cycleDayNumberView }>
|
||||||
|
{ cycleDayNumber && <Text style={styles.cycleDayNumber} >Cycle day {cycleDayNumber}</Text> }
|
||||||
|
</View >
|
||||||
|
<View style={ styles.cycleDaySymptomsView }>
|
||||||
{
|
{
|
||||||
{ dayView: <DayView cycleDay={this.cycleDay} showView={this.showView} />,
|
{ dayView: <DayView cycleDay={this.cycleDay} showView={this.showView} />,
|
||||||
bleedingEditView: <BleedingEditView cycleDay={this.cycleDay} showView={this.showView}/>,
|
bleedingEditView: <BleedingEditView cycleDay={this.cycleDay} showView={this.showView}/>,
|
||||||
temperatureEditView: <TemperatureEditView cycleDay={this.cycleDay} showView={this.showView}/>
|
temperatureEditView: <TemperatureEditView cycleDay={this.cycleDay} showView={this.showView}/>
|
||||||
}[this.state.visibleComponent]
|
}[this.state.visibleComponent]
|
||||||
}
|
}
|
||||||
|
</View >
|
||||||
</View >
|
</View >
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,21 +46,33 @@ export default class Home extends Component {
|
|||||||
render() {
|
render() {
|
||||||
const navigate = this.props.navigation.navigate
|
const navigate = this.props.navigation.navigate
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={ styles.homeContainerView }>
|
||||||
|
<View style={{flex: 2}}>
|
||||||
|
<View>
|
||||||
<Text style={styles.welcome}>{this.state.welcomeText}</Text>
|
<Text style={styles.welcome}>{this.state.welcomeText}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={ styles.homeButtonsView}>
|
||||||
|
<View>
|
||||||
<Button
|
<Button
|
||||||
onPress={() => this.passTodayToDayView()}
|
onPress={() => this.passTodayToDayView()}
|
||||||
title="Edit symptoms for today">
|
title="Edit symptoms for today">
|
||||||
</Button>
|
</Button>
|
||||||
|
</View>
|
||||||
|
<View>
|
||||||
<Button
|
<Button
|
||||||
onPress={() => navigate('calendar')}
|
onPress={() => navigate('calendar')}
|
||||||
title="Go to calendar">
|
title="Go to calendar">
|
||||||
</Button>
|
</Button>
|
||||||
|
</View>
|
||||||
|
<View>
|
||||||
<Button
|
<Button
|
||||||
onPress={() => deleteAll()}
|
onPress={() => deleteAll()}
|
||||||
title="delete everything">
|
title="delete everything">
|
||||||
</Button>
|
</Button>
|
||||||
</View>
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,97 @@ export default StyleSheet.create({
|
|||||||
welcome: {
|
welcome: {
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
margin: 30,
|
margin: 30,
|
||||||
textAlign: 'center'
|
textAlign: 'center',
|
||||||
|
textAlignVertical: 'center'
|
||||||
|
},
|
||||||
|
dateHeader: {
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: 'bold',
|
||||||
|
margin: 30,
|
||||||
|
color: 'white',
|
||||||
|
textAlign: 'center',
|
||||||
|
textAlignVertical: 'center'
|
||||||
|
},
|
||||||
|
cycleDayNumber: {
|
||||||
|
fontSize: 18,
|
||||||
|
margin: 20,
|
||||||
|
textAlign: 'center',
|
||||||
|
textAlignVertical: 'center'
|
||||||
|
},
|
||||||
|
symptomDayView: {
|
||||||
|
fontSize: 20,
|
||||||
|
margin: 30,
|
||||||
|
textAlign: 'left',
|
||||||
|
textAlignVertical: 'center'
|
||||||
|
},
|
||||||
|
radioButton: {
|
||||||
|
fontSize: 18,
|
||||||
|
margin: 5,
|
||||||
|
textAlign: 'center',
|
||||||
|
textAlignVertical: 'center'
|
||||||
|
},
|
||||||
|
singleButtonView: {
|
||||||
|
flex: 1,
|
||||||
|
margin: 5
|
||||||
|
},
|
||||||
|
itemsInRowView: {
|
||||||
|
flex: 1,
|
||||||
|
flexDirection: 'row',
|
||||||
|
justifyContent: 'flex-start',
|
||||||
|
alignItems: 'center'
|
||||||
|
},
|
||||||
|
itemsInRowSeparatedView: {
|
||||||
|
flex: 1,
|
||||||
|
flexDirection: 'row',
|
||||||
|
justifyContent: 'space-evenly',
|
||||||
|
alignItems: 'center'
|
||||||
|
},
|
||||||
|
symptomEditView: {
|
||||||
|
flex: 1,
|
||||||
|
flexDirection: 'column',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
alignItems: 'flex-start'
|
||||||
|
},
|
||||||
|
symptomEditSplitSymptomsAndLastRowButtons: {
|
||||||
|
flex: 4,
|
||||||
|
flexDirection: 'column',
|
||||||
|
justifyContent: 'flex-start',
|
||||||
|
alignItems: 'flex-start'
|
||||||
|
},
|
||||||
|
symptomEditListedSymptomView: {
|
||||||
|
flex: 1,
|
||||||
|
flexDirection: 'column',
|
||||||
|
justifyContent: 'flex-start',
|
||||||
|
alignItems: 'flex-start'
|
||||||
|
},
|
||||||
|
cycleDayOuterView: {
|
||||||
|
flex: 1,
|
||||||
|
flexDirection: 'column',
|
||||||
|
justifyContent: 'space-around'
|
||||||
|
},
|
||||||
|
cycleDayDateView: {
|
||||||
|
flex: 2,
|
||||||
|
justifyContent: 'center',
|
||||||
|
backgroundColor: 'steelblue'
|
||||||
|
},
|
||||||
|
cycleDayNumberView: {
|
||||||
|
flex: 1,
|
||||||
|
justifyContent: 'center',
|
||||||
|
backgroundColor: 'skyblue'
|
||||||
|
},
|
||||||
|
cycleDaySymptomsView: {
|
||||||
|
flex: 8,
|
||||||
|
justifyContent: 'center'
|
||||||
|
},
|
||||||
|
homeContainerView: {
|
||||||
|
flex: 0.5,
|
||||||
|
flexDirection: 'column',
|
||||||
|
justifyContent: 'space-around'
|
||||||
|
},
|
||||||
|
homeButtonsView: {
|
||||||
|
flex: 3,
|
||||||
|
flexDirection: 'column',
|
||||||
|
justifyContent: 'space-around',
|
||||||
|
margin: 5
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
+28
-5
@@ -8,6 +8,7 @@ import {
|
|||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
|
|
||||||
import { saveTemperature, getPreviousTemperature } from './db'
|
import { saveTemperature, getPreviousTemperature } from './db'
|
||||||
|
import styles from './styles'
|
||||||
|
|
||||||
export default class Temp extends Component {
|
export default class Temp extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@@ -32,36 +33,56 @@ export default class Temp extends Component {
|
|||||||
render() {
|
render() {
|
||||||
const cycleDay = this.cycleDay
|
const cycleDay = this.cycleDay
|
||||||
return (
|
return (
|
||||||
<View>
|
<View style={ styles.symptomEditView }>
|
||||||
<Text>Temperature</Text>
|
<View style={ styles.symptomEditSplitSymptomsAndLastRowButtons }>
|
||||||
|
<View style={ styles.itemsInRowView }>
|
||||||
|
<View style={{flex: 3, margin: 5}}>
|
||||||
|
<Text style={styles.symptomDayView}>Temperature (°C)</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{flex: 1, margin: 5}}>
|
||||||
<TextInput
|
<TextInput
|
||||||
placeholder="Enter temperature"
|
placeholder="Enter"
|
||||||
onChangeText={(val) => {
|
onChangeText={(val) => {
|
||||||
this.setState({currentValue: val})
|
this.setState({currentValue: val})
|
||||||
}}
|
}}
|
||||||
keyboardType='numeric'
|
keyboardType='numeric'
|
||||||
value = {this.state.currentValue}
|
value = {this.state.currentValue}
|
||||||
/>
|
/>
|
||||||
<Text>Exclude</Text>
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={ styles.itemsInRowSeparatedView }>
|
||||||
|
<View style={{flex: 1, margin: 5}}>
|
||||||
|
<Text style={styles.symptomDayView}>Exclude</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{flex: 1, margin: 5}}>
|
||||||
<Switch
|
<Switch
|
||||||
onValueChange = {(val) => {
|
onValueChange = {(val) => {
|
||||||
this.setState({ exclude: val })
|
this.setState({ exclude: val })
|
||||||
}}
|
}}
|
||||||
value = { this.state.exclude }
|
value = { this.state.exclude }
|
||||||
/>
|
/>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={ styles.itemsInRowSeparatedView }>
|
||||||
|
<View style={ styles.singleButtonView }>
|
||||||
<Button
|
<Button
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
this.showView('dayView')
|
this.showView('dayView')
|
||||||
}}
|
}}
|
||||||
title="Cancel">
|
title="Cancel">
|
||||||
</Button>
|
</Button>
|
||||||
|
</View>
|
||||||
|
<View style={ styles.singleButtonView }>
|
||||||
<Button
|
<Button
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
saveTemperature(cycleDay)
|
saveTemperature(cycleDay)
|
||||||
this.showView('dayView')
|
this.showView('dayView')
|
||||||
}}
|
}}
|
||||||
title="Delete entry">
|
title="Delete">
|
||||||
</Button>
|
</Button>
|
||||||
|
</View>
|
||||||
|
<View style={ styles.singleButtonView }>
|
||||||
<Button
|
<Button
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
saveTemperature(cycleDay, {
|
saveTemperature(cycleDay, {
|
||||||
@@ -74,6 +95,8 @@ export default class Temp extends Component {
|
|||||||
title="Save">
|
title="Save">
|
||||||
</Button>
|
</Button>
|
||||||
</View>
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user