@@ -5,7 +5,8 @@ import { Text, Row } from '@components';
55import { DivisionList } from '@lib/divisions' ;
66import { ProportionsList } from '@lib/proportions' ;
77import Actions from '@lib/actions' ;
8- import { ModalActions , ReducerAction } from '@lib/state' ;
8+ import { ModalActions } from '@lib/reducers' ;
9+ import { ReducerAction } from '@lib/state' ;
910import colours from '@res/colours' ;
1011
1112export const FooterButton = ( {
@@ -27,59 +28,62 @@ export const FooterButton = ({
2728type FooterButtonProps = {
2829 title : string ;
2930 value : string ;
30- short : boolean ;
31+ short ? : boolean ;
3132 onPress ?: ( ) => void ;
3233} ;
3334
3435export default ( {
35- division,
36- proportion,
37- selectedColours,
36+ flag : { division, proportion, selectedColours } ,
3837 dispatch,
39- } : OwnProps ) : JSX . Element => (
40- < View style = { styles . footer } >
41- < Row >
42- < FooterButton
43- title = "Division"
44- value = { DivisionList [ division ] }
45- short = { false }
46- onPress = { ( ) => dispatch ( { type : Actions . INCREMENT_DIVISION } ) }
47- />
48- < FooterButton
49- title = "Proportion"
50- value = { ProportionsList [ proportion ] . name }
51- onPress = { ( ) => dispatch ( { type : Actions . INCREMENT_PROPORTION } ) }
52- />
53- < FooterButton
54- title = "Colours"
55- value = { String ( selectedColours . length ) }
56- onPress = { ( ) =>
57- dispatch ( {
58- type : Actions . SET_MODAL_ACTION ,
59- payload : ModalActions . EditColours ,
60- } )
61- }
62- />
63- < FooterButton
64- title = "Charges"
65- value = "5"
66- onPress = { ( ) => dispatch ( { type : Actions . INCREMENT_PROPORTION } ) }
67- />
68- </ Row >
69- </ View >
70- ) ;
38+ } : OwnProps ) : JSX . Element => {
39+ const openModal = ( payload : ModalActions ) =>
40+ dispatch ( {
41+ type : Actions . SET_MODAL_ACTION ,
42+ payload,
43+ } ) ;
44+
45+ return (
46+ < View style = { styles . footer } >
47+ < Row >
48+ < FooterButton
49+ title = "Division"
50+ value = { DivisionList [ division ] }
51+ short = { false }
52+ onPress = { ( ) => dispatch ( { type : Actions . INCREMENT_DIVISION } ) }
53+ />
54+ < FooterButton
55+ title = "Proportion"
56+ value = { ProportionsList [ proportion ] . name }
57+ onPress = { ( ) => dispatch ( { type : Actions . INCREMENT_PROPORTION } ) }
58+ />
59+ < FooterButton
60+ title = "Colours"
61+ value = { String ( selectedColours . length ) }
62+ onPress = { ( ) => openModal ( ModalActions . EditColours ) }
63+ />
64+ < FooterButton
65+ title = "Charges"
66+ value = "0"
67+ onPress = { ( ) => openModal ( ModalActions . EditCharges ) }
68+ />
69+ </ Row >
70+ </ View >
71+ ) ;
72+ } ;
7173
7274type OwnProps = {
73- division : number ;
74- proportion : number ;
75- selectedColours : string [ ] ;
75+ flag : {
76+ division : number ;
77+ proportion : number ;
78+ selectedColours : string [ ] ;
79+ } ;
7680 dispatch : ( action : ReducerAction ) => void ;
7781} ;
7882
7983const styles = StyleSheet . create ( {
8084 footer : {
8185 alignSelf : 'stretch' ,
82- height : Platform . OS === 'android' ? 50 : 80 ,
86+ height : Platform . OS === 'android' ? 60 : 80 ,
8387 backgroundColor : colours . primaryBlue ,
8488 } ,
8589 footerButton : {
0 commit comments