Skip to content
Snippets Groups Projects
Commit e2abc4db authored by bl00dymarie's avatar bl00dymarie
Browse files

Merge branch 'marie-move-info-button-out-of-header-to-body' into 'master'

Move info button out of header to body

See merge request bloodyhealth/drip!217
parents ed38a5b4 0cfc8593
No related branches found
No related tags found
No related merge requests found
...@@ -11,7 +11,6 @@ import SettingsMenu from './settings/settings-menu' ...@@ -11,7 +11,6 @@ import SettingsMenu from './settings/settings-menu'
import settingsViews from './settings' import settingsViews from './settings'
import Stats from './stats' import Stats from './stats'
import {headerTitles, menuTitles} from '../i18n/en/labels' import {headerTitles, menuTitles} from '../i18n/en/labels'
import InfoSymptom from './cycle-day/symptoms/info-symptom'
import setupNotifications from '../lib/notifications' import setupNotifications from '../lib/notifications'
// design wants everyhting lowercased, but we don't // design wants everyhting lowercased, but we don't
...@@ -22,7 +21,6 @@ const headerTitlesLowerCase = Object.keys(headerTitles).reduce((acc, curr) => { ...@@ -22,7 +21,6 @@ const headerTitlesLowerCase = Object.keys(headerTitles).reduce((acc, curr) => {
}, {}) }, {})
const HOME_PAGE = 'Home' const HOME_PAGE = 'Home'
const INFO_SYMPTOM_PAGE = 'InfoSymptom'
const CYCLE_DAY_PAGE = 'CycleDay' const CYCLE_DAY_PAGE = 'CycleDay'
const SETTINGS_MENU_PAGE = 'SettingsMenu' const SETTINGS_MENU_PAGE = 'SettingsMenu'
...@@ -49,7 +47,7 @@ export default class App extends Component { ...@@ -49,7 +47,7 @@ export default class App extends Component {
if (this.isMenuItem()) { if (this.isMenuItem()) {
this.menuOrigin = currentPage this.menuOrigin = currentPage
} }
if (!this.isSymptomView() && !this.isInfoSymptomView()) { if (!this.isSymptomView()) {
this.originForSymptomView = currentPage this.originForSymptomView = currentPage
} }
this.setState({ currentPage: pageName, currentProps: props }) this.setState({ currentPage: pageName, currentProps: props })
...@@ -66,10 +64,6 @@ export default class App extends Component { ...@@ -66,10 +64,6 @@ export default class App extends Component {
this.navigate(SETTINGS_MENU_PAGE) this.navigate(SETTINGS_MENU_PAGE)
} else if (currentPage === CYCLE_DAY_PAGE) { } else if (currentPage === CYCLE_DAY_PAGE) {
this.navigate(this.menuOrigin) this.navigate(this.menuOrigin)
} else if (this.isInfoSymptomView()) {
const { date, cycleDay, symptomView } = currentProps
this.navigate(
symptomView, { date, cycleDay })
} else { } else {
this.navigate(HOME_PAGE) this.navigate(HOME_PAGE)
} }
...@@ -84,10 +78,6 @@ export default class App extends Component { ...@@ -84,10 +78,6 @@ export default class App extends Component {
return Object.keys(symptomViews).includes(this.state.currentPage) return Object.keys(symptomViews).includes(this.state.currentPage)
} }
isInfoSymptomView() {
return this.state.currentPage === INFO_SYMPTOM_PAGE
}
isSettingsView() { isSettingsView() {
return Object.keys(settingsViews).includes(this.state.currentPage) return Object.keys(settingsViews).includes(this.state.currentPage)
} }
...@@ -104,7 +94,6 @@ export default class App extends Component { ...@@ -104,7 +94,6 @@ export default class App extends Component {
Calendar, Calendar,
CycleDay, CycleDay,
Chart, Chart,
InfoSymptom,
SettingsMenu, SettingsMenu,
...settingsViews, ...settingsViews,
Stats, Stats,
...@@ -118,7 +107,7 @@ export default class App extends Component { ...@@ -118,7 +107,7 @@ export default class App extends Component {
{this.isDefaultView() && {this.isDefaultView() &&
<Header title={title} /> <Header title={title} />
} }
{(this.isInfoSymptomView() || this.isSettingsView()) && {(this.isSettingsView()) &&
<Header <Header
title={title} title={title}
showBackButton={true} showBackButton={true}
......
import React, { Component } from 'react' import React from 'react'
import { ScrollView } from 'react-native' import { ScrollView, View, TouchableOpacity } from 'react-native'
import Icon from 'react-native-vector-icons/SimpleLineIcons'
import AppText from '../../app-text' import AppText from '../../app-text'
import labels from '../../../i18n/en/symptom-info.js' import labels from '../../../i18n/en/symptom-info.js'
import FramedSegment from '../../framed-segment' import styles, {iconStyles} from '../../../styles/index'
import styles from '../../../styles/index'
export default class InfoSymptom extends Component { export default function InfoSymptom(props) {
render() { return (
const symptomView = this.props.symptomView <View style={styles.infoPopUpWrapper}>
const symptomMapping = { <View style={styles.dimmed}></View>
BleedingEditView: 'bleeding', <View style={styles.infoPopUp}>
CervixEditView: 'cervix', <TouchableOpacity onPress={props.close} style={styles.infoSymptomClose}>
DesireEditView: 'desire', <Icon name='close' {...iconStyles.infoPopUpClose}/>
MoodEditView: 'mood', </TouchableOpacity>
MucusEditView: 'mucus', <ScrollView style={styles.infoSymptomText}>
NoteEditView: 'note', <AppText>{labels[props.symptom].text}</AppText>
PainEditView: 'pain', </ScrollView>
SexEditView: 'sex', </View>
TemperatureEditView: 'temperature' </View>
} )
const currentSymptom = symptomMapping[symptomView]
return (
<ScrollView>
<FramedSegment
style={styles.framedSegmentLast}
title={labels[currentSymptom].title}
>
<AppText>{labels[currentSymptom].text}</AppText>
</FramedSegment>
</ScrollView>
)
}
} }
import React, { Component } from 'react' import React, { Component } from 'react'
import { View } from 'react-native' import { View } from 'react-native'
import AppText, { SymptomSectionHeader } from '../../app-text' import AppText, { SymptomSectionHeader } from '../../app-text'
import styles from '../../../styles'
export default class SymptomSection extends Component { export default class SymptomSection extends Component {
render() { render() {
...@@ -13,8 +14,10 @@ export default class SymptomSection extends Component { ...@@ -13,8 +14,10 @@ export default class SymptomSection extends Component {
} }
} }
return ( return (
<View style={placeHeadingInline}> <View style={[placeHeadingInline, styles.symptomSection]}>
<SymptomSectionHeader flex={1}>{p.header}</SymptomSectionHeader> { p.header &&
<SymptomSectionHeader flex={1}>{p.header}</SymptomSectionHeader>
}
<View <View
flexDirection={p.inline ? 'row' : null} flexDirection={p.inline ? 'row' : null}
flex={1} flex={1}
......
import React, { Component } from 'react' import React, { Component } from 'react'
import { BackHandler, View, Alert } from 'react-native' import {
BackHandler, View, Alert, TouchableOpacity
} from 'react-native'
import { saveSymptom } from '../../../db' import { saveSymptom } from '../../../db'
import InfoPopUp from './info-symptom'
import Header from '../../header/symptom-view' import Header from '../../header/symptom-view'
import { headerTitles } from '../../../i18n/en/labels' import { headerTitles } from '../../../i18n/en/labels'
import { sharedDialogs } from '../../../i18n/en/cycle-day' import { sharedDialogs } from '../../../i18n/en/cycle-day'
import FeatherIcon from 'react-native-vector-icons/Feather'
import styles, { iconStyles } from '../../../styles'
export default class SymptomView extends Component { export default class SymptomView extends Component {
constructor(props) { constructor(props) {
...@@ -14,6 +19,10 @@ export default class SymptomView extends Component { ...@@ -14,6 +19,10 @@ export default class SymptomView extends Component {
) )
this.globalBackhandler = props.handleBackButtonPress this.globalBackhandler = props.handleBackButtonPress
this.date = props.date this.date = props.date
this.navigate = props.navigate
this.state = {
showInfo: false
}
} }
async handleBackButtonPressOnSymptomView() { async handleBackButtonPressOnSymptomView() {
...@@ -35,10 +44,17 @@ export default class SymptomView extends Component { ...@@ -35,10 +44,17 @@ export default class SymptomView extends Component {
} }
isDeleteIconActive() { isDeleteIconActive() {
return Object.values(this.state).some(value => { const symptomValueHasBeenFilledOut = key => {
// the state tracks whether the symptom info should be shown,
// we ignore that property
if (key === 'showInfo') return
// is there any meaningful value in the current state? // is there any meaningful value in the current state?
return value || value === 0 return this.state[key] || this.state[key] === 0
}) }
const symptomValues = Object.keys(this.state)
return symptomValues.some(symptomValueHasBeenFilledOut)
} }
render() { render() {
...@@ -66,7 +82,27 @@ export default class SymptomView extends Component { ...@@ -66,7 +82,27 @@ export default class SymptomView extends Component {
) )
}} }}
/> />
{this.renderContent()} <View flex={1}>
{ this.renderContent() }
<TouchableOpacity
onPress={() => {
this.setState({showInfo: true})
}}
style={styles.infoButtonSymptomView}
>
<FeatherIcon
name="info"
{...iconStyles.infoInSymptomView}
style={iconStyles.symptomInfo}
/>
</TouchableOpacity>
{ this.state.showInfo &&
<InfoPopUp
symptom={this.symptomName}
close={() => this.setState({showInfo: false})}
/>
}
</View>
</View> </View>
) )
} }
......
...@@ -8,6 +8,10 @@ export default function NavigationArrow(props) { ...@@ -8,6 +8,10 @@ export default function NavigationArrow(props) {
left: 'chevron-thin-left', left: 'chevron-thin-left',
right: 'chevron-thin-right' right: 'chevron-thin-right'
}[props.direction] }[props.direction]
const iconPosition = {
left: 'navigationArrowLeft',
right: 'navigationArrowRight'
}[props.direction]
let pressHandler let pressHandler
if (props.goBack) { if (props.goBack) {
pressHandler = () => props.goBack() pressHandler = () => props.goBack()
...@@ -19,7 +23,7 @@ export default function NavigationArrow(props) { ...@@ -19,7 +23,7 @@ export default function NavigationArrow(props) {
} }
return ( return (
<TouchableOpacity <TouchableOpacity
style={styles.navigationArrow} style={[styles.navigationArrow, styles[iconPosition]]}
onPress={pressHandler} onPress={pressHandler}
> >
<Icon <Icon
......
...@@ -30,17 +30,19 @@ export default function SymptomViewHeader(props) { ...@@ -30,17 +30,19 @@ export default function SymptomViewHeader(props) {
{formatDate(props.date)} {formatDate(props.date)}
</Text> </Text>
</View > </View >
<TouchableOpacity { props.deleteIconActive &&
onPress={props.deleteEntry} <TouchableOpacity
style={[styles.infoButton, {opacity: props.deleteIconActive ? 1 : 0}]} onPress={props.deleteEntry}
disabled={!props.deleteIconActive} style={[
> styles.headerDeleteButton,
<Icon ]}
name="delete" >
style={styles.symptomDeleteIcon} <Icon
{...iconStyles.symptomHeaderIcons} name="delete"
/> {...iconStyles.symptomHeaderIcons}
</TouchableOpacity> />
</TouchableOpacity>
}
</View> </View>
) )
......
...@@ -159,12 +159,10 @@ export default StyleSheet.create({ ...@@ -159,12 +159,10 @@ export default StyleSheet.create({
}, },
symptomViewHeading: { symptomViewHeading: {
fontWeight: 'bold', fontWeight: 'bold',
fontFamily: textFontBold, fontFamily: textFontBold
marginTop: 10
}, },
symptomDeleteIcon: { symptomSection: {
marginRight: 20, marginBottom: 10
marginLeft: 20
}, },
symptomBoxImage: { symptomBoxImage: {
width: 50, width: 50,
...@@ -222,13 +220,12 @@ export default StyleSheet.create({ ...@@ -222,13 +220,12 @@ export default StyleSheet.create({
justifyContent: 'center', justifyContent: 'center',
height: 80 height: 80
}, },
headerCycleDay: {
flexDirection: 'row',
justifyContent: 'space-between',
},
navigationArrow: { navigationArrow: {
padding: 20 padding: 20,
position: 'absolute'
}, },
navigationArrowLeft: { left: 0 },
navigationArrowRight: { right: 0 },
menu: { menu: {
backgroundColor: primaryColor, backgroundColor: primaryColor,
alignItems: 'center', alignItems: 'center',
...@@ -258,20 +255,6 @@ export default StyleSheet.create({ ...@@ -258,20 +255,6 @@ export default StyleSheet.create({
temperatureTextInputSuggestion: { temperatureTextInputSuggestion: {
color: '#939393' color: '#939393'
}, },
actionButtonFooter: {
alignItems: 'center',
justifyContent: 'space-around',
flexDirection: 'row',
height: 60,
},
actionButtonItem: {
backgroundColor: secondaryColor,
alignItems: 'center',
flex: 1,
marginHorizontal: 5,
paddingVertical: 5,
borderRadius: 5,
},
symptomEditButton: { symptomEditButton: {
width: 130 width: 130
}, },
...@@ -296,6 +279,31 @@ export default StyleSheet.create({ ...@@ -296,6 +279,31 @@ export default StyleSheet.create({
flexDirection: 'row', flexDirection: 'row',
alignItems: 'center' alignItems: 'center'
}, },
infoPopUpWrapper: {
position: 'absolute',
width: '100%',
height: '100%'
},
infoPopUp: {
backgroundColor: 'white',
padding: 15,
marginHorizontal: 20,
marginTop: 20,
maxHeight: '92%'
},
dimmed: {
position: 'absolute',
backgroundColor: 'black',
opacity: 0.5,
width: '100%',
height: '100%'
},
infoSymptomClose: {
alignItems: 'flex-end'
},
infoSymptomText: {
marginTop: 10
},
settingsButton: { settingsButton: {
padding: 10, padding: 10,
alignItems: 'center', alignItems: 'center',
...@@ -372,7 +380,8 @@ export default StyleSheet.create({ ...@@ -372,7 +380,8 @@ export default StyleSheet.create({
borderLeftWidth: null borderLeftWidth: null
}, },
page: { page: {
marginHorizontal: 10 marginHorizontal: 10,
marginTop: 20,
}, },
calendarToday: { calendarToday: {
fontWeight: 'bold', fontWeight: 'bold',
...@@ -424,8 +433,16 @@ export default StyleSheet.create({ ...@@ -424,8 +433,16 @@ export default StyleSheet.create({
marginTop: 20, marginTop: 20,
color: 'grey' color: 'grey'
}, },
infoButton: { headerDeleteButton: {
paddingVertical: 20 paddingHorizontal: 20,
paddingVertical: 20,
position: 'absolute',
right: 0
},
infoButtonSymptomView: {
position: 'absolute',
padding: 15,
right: 0
}, },
licensePage: { licensePage: {
paddingVertical: 20, paddingVertical: 20,
...@@ -457,6 +474,10 @@ export const iconStyles = { ...@@ -457,6 +474,10 @@ export const iconStyles = {
symptomBoxActive: { symptomBoxActive: {
color: fontOnPrimaryColor color: fontOnPrimaryColor
}, },
symptomInfo: {
color: secondaryColor,
fontSize: 25
},
menuIcon: { menuIcon: {
size: 20, size: 20,
color: fontOnPrimaryColor color: fontOnPrimaryColor
...@@ -464,8 +485,7 @@ export const iconStyles = { ...@@ -464,8 +485,7 @@ export const iconStyles = {
menuIconInactive: { menuIconInactive: {
color: colorInActive, color: colorInActive,
}, },
infoInHeading: { infoPopUpClose: {
marginRight: 5, size: 25
color: 'black'
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment