Commit 8dbce82b authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Merge branch '34-order-pizza-in-event-view' into 'master'

Add pizza order button to the event detail

Closes #34

See merge request !129
parents e8c51fdc 36c42934
......@@ -13,6 +13,7 @@ import { colors } from '../style';
import * as eventActions from '../actions/event';
import * as registrationActions from '../actions/registration';
import * as pizzaActions from '../actions/pizza';
class Event extends Component {
cancelPrompt = (pk) => {
......@@ -115,6 +116,18 @@ class Event extends Component {
}
}
if (data.is_pizza_event) {
infoTexts.push(
<View key="pizza-holder" style={styles.pizzaHolder}>
<Text style={styles.pizzaText} key="pizza-title">Pizza:</Text>
<Button
color={colors.magenta}
title="Bestel"
onPress={this.props.retrievePizzaInfo}
/>
</View>,
);
}
return (
<View>
......@@ -331,6 +344,7 @@ Event.propTypes = {
is_late_cancellation: PropTypes.bool,
}),
no_registration_message: PropTypes.string,
is_pizza_event: PropTypes.bool.isRequired,
}).isRequired,
registrations: PropTypes.arrayOf(PropTypes.shape({
pk: PropTypes.number.isRequired,
......@@ -344,6 +358,7 @@ Event.propTypes = {
cancel: PropTypes.func.isRequired,
fields: PropTypes.func.isRequired,
openMaps: PropTypes.func.isRequired,
retrievePizzaInfo: PropTypes.func.isRequired,
};
const mapStateToProps = state => ({
......@@ -359,6 +374,7 @@ const mapDispatchToProps = dispatch => ({
cancel: registration => dispatch(registrationActions.cancel(registration)),
fields: registration => dispatch(registrationActions.retrieveFields(registration)),
openMaps: location => Linking.openURL(`https://maps.${Platform.OS === 'ios' ? 'apple' : 'google'}.com/maps?daddr=${location}`),
retrievePizzaInfo: () => dispatch(pizzaActions.retrievePizzaInfo()),
});
export default connect(mapStateToProps, mapDispatchToProps)(Event);
......@@ -62,6 +62,28 @@ const styles = create({
fontWeight: '300',
},
},
pizzaHolder: {
flexDirection: 'row',
alignItems: 'center',
marginTop: 16,
},
pizzaText: {
fontSize: 14,
lineHeight: 22.0,
color: colors.darkGrey,
width: '50%',
paddingRight: 8,
android: {
fontFamily: 'sans-serif-medium',
},
ios: {
fontFamily: 'System',
fontWeight: '600',
},
},
pizzaButton: {
flex: 1,
},
registrationText: {
marginTop: 16,
},
......
......@@ -13,6 +13,7 @@ const initialState = {
map_location: '',
registration_allowed: false,
has_fields: false,
is_pizza_event: false,
},
registrations: [],
status: 'initial',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment