@hedia/recommendation-screen 1.1.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.idea/codeStyles/Project.xml +8 -8
- package/.idea/workspace.xml +130 -56
- package/package.json +1 -1
- package/src/RecommendationScreen.d.ts +7 -2
- package/src/RecommendationScreen.jsx +29 -9
- package/src/RecommendationScreen.tsx +40 -11
- package/src/components/ExitModal.d.ts +11 -0
- package/src/components/ExitModal.jsx +87 -0
- package/src/components/ExitModal.tsx +85 -0
- package/src/components/Header.jsx +1 -1
- package/src/components/Header.tsx +1 -0
- package/src/components/RecommendationModal.d.ts +180 -0
- package/src/components/{HediaRecommendationModal.jsx → RecommendationModal.jsx} +50 -47
- package/src/components/{HediaRecommendationModal.tsx → RecommendationModal.tsx} +48 -46
- package/src/locale/da/messages.js +1 -1
- package/src/locale/da/messages.po +81 -64
- package/src/locale/en/messages.js +1 -1
- package/src/locale/en/messages.po +73 -56
- package/src/utils/AttentionMessages.d.ts +1 -1
- package/src/utils/AttentionMessages.jsx +6 -5
- package/src/utils/AttentionMessages.tsx +6 -5
- package/src/utils/Constants.ts +1 -0
- package/src/utils/RecommendationError.jsx +22 -4
- package/src/utils/RecommendationError.tsx +5 -4
- package/App.jsx +0 -94
- package/src/components/HediaRecommendationModal.d.ts +0 -26
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
const macro_1 = require("@lingui/macro");
|
|
26
|
+
const React = __importStar(require("react"));
|
|
27
|
+
const react_native_1 = require("react-native");
|
|
28
|
+
const i18nUtils_1 = require("../locale/i18nUtils");
|
|
29
|
+
const Constants_1 = require("../utils/Constants");
|
|
30
|
+
const Icon_1 = __importDefault(require("./Icon"));
|
|
31
|
+
const RecommendationModal_1 = require("./RecommendationModal");
|
|
32
|
+
class ExitModal extends React.Component {
|
|
33
|
+
constructor(props) {
|
|
34
|
+
super(props);
|
|
35
|
+
}
|
|
36
|
+
render() {
|
|
37
|
+
return (<react_native_1.View style={[react_native_1.StyleSheet.absoluteFillObject, styles.container]}>
|
|
38
|
+
<react_native_1.View style={styles.modalContainer}>
|
|
39
|
+
<Icon_1.default accessibilityLabel="ModalExitIcon" iconIdentifier={`Ionicons/ios-close-circle-outline`} style={styles.icon} onPress={this.props.onClose}/>
|
|
40
|
+
<react_native_1.View style={styles.textContainer}>
|
|
41
|
+
<react_native_1.Text style={styles.title}>{i18nUtils_1.i18n._(macro_1.t `Save data before closing?`)}</react_native_1.Text>
|
|
42
|
+
<react_native_1.Text style={styles.message}>
|
|
43
|
+
{i18nUtils_1.i18n._(macro_1.t `Your saved data will be used for future calculations.`)}
|
|
44
|
+
</react_native_1.Text>
|
|
45
|
+
</react_native_1.View>
|
|
46
|
+
<react_native_1.View style={styles.buttonContainer}>
|
|
47
|
+
<react_native_1.TouchableOpacity accessibilityLabel="SaveToLogbook" onPress={this.props.onSave} style={styles.button}>
|
|
48
|
+
<react_native_1.Text style={styles.textButton}>{i18nUtils_1.i18n._(macro_1.t `Save to logbook`)}</react_native_1.Text>
|
|
49
|
+
</react_native_1.TouchableOpacity>
|
|
50
|
+
<react_native_1.TouchableOpacity accessibilityLabel="CloseCalculation" onPress={this.props.onCloseCalculation} style={styles.button}>
|
|
51
|
+
<react_native_1.Text style={styles.textButton}>{i18nUtils_1.i18n._(macro_1.t `Close calculation`)}</react_native_1.Text>
|
|
52
|
+
</react_native_1.TouchableOpacity>
|
|
53
|
+
</react_native_1.View>
|
|
54
|
+
</react_native_1.View>
|
|
55
|
+
</react_native_1.View>);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.default = ExitModal;
|
|
59
|
+
const { height, width } = react_native_1.Dimensions.get(`screen`);
|
|
60
|
+
const styles = react_native_1.StyleSheet.create({
|
|
61
|
+
container: { justifyContent: `center`, backgroundColor: `rgba(0, 0, 0, 0.9)` },
|
|
62
|
+
modalContainer: { margin: `4%`, backgroundColor: Constants_1.BACKGROUND_COLOUR_PURPLE, borderRadius: width / 25 },
|
|
63
|
+
icon: {
|
|
64
|
+
color: Constants_1.BORDER_COLOUR_GREY,
|
|
65
|
+
fontSize: width / 12,
|
|
66
|
+
textAlign: `right`,
|
|
67
|
+
marginRight: `4%`,
|
|
68
|
+
marginTop: `3%`,
|
|
69
|
+
},
|
|
70
|
+
textContainer: { marginHorizontal: `4%`, marginBottom: `5%`, alignSelf: `flex-start` },
|
|
71
|
+
title: {
|
|
72
|
+
color: `rgba(139, 144, 196, 1)`,
|
|
73
|
+
fontSize: width / 17,
|
|
74
|
+
fontWeight: `bold`,
|
|
75
|
+
textAlign: `center`,
|
|
76
|
+
marginBottom: `5%`,
|
|
77
|
+
},
|
|
78
|
+
message: { color: `rgba(245, 242, 242, 1)`, fontSize: width / 21, textAlign: `center` },
|
|
79
|
+
buttonContainer: {
|
|
80
|
+
flexDirection: `row`,
|
|
81
|
+
justifyContent: `space-around`,
|
|
82
|
+
marginHorizontal: `4%`,
|
|
83
|
+
marginVertical: `6%`,
|
|
84
|
+
},
|
|
85
|
+
button: { ...RecommendationModal_1.stylesModal.okButton, height: height / 17, marginTop: 0 },
|
|
86
|
+
textButton: { textAlign: `center`, fontSize: width / 24, color: `white` },
|
|
87
|
+
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { t } from "@lingui/macro";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Dimensions, StyleSheet, Text, TouchableOpacity, View } from "react-native";
|
|
4
|
+
import { i18n } from "../locale/i18nUtils";
|
|
5
|
+
import { BACKGROUND_COLOUR_PURPLE, BORDER_COLOUR_GREY } from "../utils/Constants";
|
|
6
|
+
import Icon from "./Icon";
|
|
7
|
+
import { stylesModal } from "./RecommendationModal";
|
|
8
|
+
|
|
9
|
+
interface IModalProps {
|
|
10
|
+
onSave(): void;
|
|
11
|
+
onCloseCalculation(): void;
|
|
12
|
+
onClose(): void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default class ExitModal extends React.Component<IModalProps> {
|
|
16
|
+
constructor(props: IModalProps) {
|
|
17
|
+
super(props);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public render(): JSX.Element {
|
|
21
|
+
return (
|
|
22
|
+
<View style={[StyleSheet.absoluteFillObject, styles.container]}>
|
|
23
|
+
<View style={styles.modalContainer}>
|
|
24
|
+
<Icon
|
|
25
|
+
accessibilityLabel="ModalExitIcon"
|
|
26
|
+
iconIdentifier={`Ionicons/ios-close-circle-outline`}
|
|
27
|
+
style={styles.icon}
|
|
28
|
+
onPress={this.props.onClose}
|
|
29
|
+
/>
|
|
30
|
+
<View style={styles.textContainer}>
|
|
31
|
+
<Text style={styles.title}>{i18n._(t`Save data before closing?`)}</Text>
|
|
32
|
+
<Text style={styles.message}>
|
|
33
|
+
{i18n._(t`Your saved data will be used for future calculations.`)}
|
|
34
|
+
</Text>
|
|
35
|
+
</View>
|
|
36
|
+
<View style={styles.buttonContainer}>
|
|
37
|
+
<TouchableOpacity
|
|
38
|
+
accessibilityLabel="SaveToLogbook"
|
|
39
|
+
onPress={this.props.onSave}
|
|
40
|
+
style={styles.button}
|
|
41
|
+
>
|
|
42
|
+
<Text style={styles.textButton}>{i18n._(t`Save to logbook`)}</Text>
|
|
43
|
+
</TouchableOpacity>
|
|
44
|
+
<TouchableOpacity
|
|
45
|
+
accessibilityLabel="CloseCalculation"
|
|
46
|
+
onPress={this.props.onCloseCalculation}
|
|
47
|
+
style={styles.button}
|
|
48
|
+
>
|
|
49
|
+
<Text style={styles.textButton}>{i18n._(t`Close calculation`)}</Text>
|
|
50
|
+
</TouchableOpacity>
|
|
51
|
+
</View>
|
|
52
|
+
</View>
|
|
53
|
+
</View>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const { height, width } = Dimensions.get(`screen`);
|
|
58
|
+
const styles = StyleSheet.create({
|
|
59
|
+
container: { justifyContent: `center`, backgroundColor: `rgba(0, 0, 0, 0.9)` },
|
|
60
|
+
modalContainer: { margin: `4%`, backgroundColor: BACKGROUND_COLOUR_PURPLE, borderRadius: width / 25 },
|
|
61
|
+
icon: {
|
|
62
|
+
color: BORDER_COLOUR_GREY,
|
|
63
|
+
fontSize: width / 12,
|
|
64
|
+
textAlign: `right`,
|
|
65
|
+
marginRight: `4%`,
|
|
66
|
+
marginTop: `3%`,
|
|
67
|
+
},
|
|
68
|
+
textContainer: { marginHorizontal: `4%`, marginBottom: `5%`, alignSelf: `flex-start` },
|
|
69
|
+
title: {
|
|
70
|
+
color: `rgba(139, 144, 196, 1)`,
|
|
71
|
+
fontSize: width / 17,
|
|
72
|
+
fontWeight: `bold`,
|
|
73
|
+
textAlign: `center`,
|
|
74
|
+
marginBottom: `5%`,
|
|
75
|
+
},
|
|
76
|
+
message: { color: `rgba(245, 242, 242, 1)`, fontSize: width / 21, textAlign: `center` },
|
|
77
|
+
buttonContainer: {
|
|
78
|
+
flexDirection: `row`,
|
|
79
|
+
justifyContent: `space-around`,
|
|
80
|
+
marginHorizontal: `4%`,
|
|
81
|
+
marginVertical: `6%`,
|
|
82
|
+
},
|
|
83
|
+
button: { ...stylesModal.okButton, height: height / 17, marginTop: 0 },
|
|
84
|
+
textButton: { textAlign: `center`, fontSize: width / 24, color: `white` },
|
|
85
|
+
});
|
|
@@ -18,7 +18,7 @@ class Header extends react_1.default.Component {
|
|
|
18
18
|
<react_native_1.View style={exports.headerStyles.margin}>
|
|
19
19
|
<react_native_1.View style={exports.headerStyles.exitButtonContainer}>
|
|
20
20
|
<react_native_1.View style={exports.headerStyles.exitButton}>
|
|
21
|
-
<react_native_1.TouchableOpacity accessibilityLabel="exitButton" style={exports.headerStyles.exitButton} onPress={this.props.exitCallback}>
|
|
21
|
+
<react_native_1.TouchableOpacity testID="closeCalc" accessibilityLabel="exitButton" style={exports.headerStyles.exitButton} onPress={this.props.exitCallback}>
|
|
22
22
|
<Icon_1.default iconIdentifier={`Ionicons/ios-close-circle-outline`} style={exports.headerStyles.iconStyle}/>
|
|
23
23
|
</react_native_1.TouchableOpacity>
|
|
24
24
|
<react_native_1.View style={exports.headerStyles.headerFiller}/>
|
|
@@ -19,6 +19,7 @@ export default class Header extends React.Component<IProps> {
|
|
|
19
19
|
<View style={headerStyles.exitButtonContainer}>
|
|
20
20
|
<View style={headerStyles.exitButton}>
|
|
21
21
|
<TouchableOpacity
|
|
22
|
+
testID="closeCalc"
|
|
22
23
|
accessibilityLabel="exitButton"
|
|
23
24
|
style={headerStyles.exitButton}
|
|
24
25
|
onPress={this.props.exitCallback}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { AttentionMessage } from "../utils/AttentionMessages";
|
|
3
|
+
interface IModalProps {
|
|
4
|
+
isVisible: boolean;
|
|
5
|
+
suggestedCarbohydrates?: number;
|
|
6
|
+
attentionMessage: AttentionMessage;
|
|
7
|
+
limitationMessage: AttentionMessage;
|
|
8
|
+
onClickOkButton(): void;
|
|
9
|
+
onAcceptCarbohydrates(): void;
|
|
10
|
+
onDeclineCarbohydrates(): void;
|
|
11
|
+
}
|
|
12
|
+
interface IModalState {
|
|
13
|
+
firstPageVisible: boolean;
|
|
14
|
+
}
|
|
15
|
+
export default class RecommendationModal extends React.Component<IModalProps, IModalState> {
|
|
16
|
+
constructor(props: IModalProps);
|
|
17
|
+
okayButton(): JSX.Element;
|
|
18
|
+
nextButton(): JSX.Element;
|
|
19
|
+
onPressNextButton: () => void;
|
|
20
|
+
recommendationButtons: () => JSX.Element;
|
|
21
|
+
recommendCarbohydrates: () => JSX.Element;
|
|
22
|
+
secondPage: () => JSX.Element;
|
|
23
|
+
firstPage: () => JSX.Element;
|
|
24
|
+
render(): JSX.Element;
|
|
25
|
+
}
|
|
26
|
+
export declare const stylesModal: {
|
|
27
|
+
modalStyle: {
|
|
28
|
+
margin: number;
|
|
29
|
+
};
|
|
30
|
+
flex1: {
|
|
31
|
+
flex: number;
|
|
32
|
+
};
|
|
33
|
+
container: {
|
|
34
|
+
flex: number;
|
|
35
|
+
backgroundColor: string;
|
|
36
|
+
};
|
|
37
|
+
marginHorizontal: {
|
|
38
|
+
marginHorizontal: string;
|
|
39
|
+
};
|
|
40
|
+
marginVertical: {
|
|
41
|
+
marginVertical: string;
|
|
42
|
+
};
|
|
43
|
+
flexStart: {
|
|
44
|
+
flex: number;
|
|
45
|
+
justifyContent: "flex-start";
|
|
46
|
+
};
|
|
47
|
+
center: {
|
|
48
|
+
justifyContent: "center";
|
|
49
|
+
flex: number;
|
|
50
|
+
};
|
|
51
|
+
recommendationRow: {
|
|
52
|
+
flex: number;
|
|
53
|
+
justifyContent: "center";
|
|
54
|
+
alignContent: "center";
|
|
55
|
+
};
|
|
56
|
+
textContainer: {
|
|
57
|
+
flex: number;
|
|
58
|
+
justifyContent: "center";
|
|
59
|
+
marginHorizontal: string;
|
|
60
|
+
};
|
|
61
|
+
textContainerIfCarbs: {
|
|
62
|
+
flex: number;
|
|
63
|
+
justifyContent: "flex-end";
|
|
64
|
+
marginHorizontal: string;
|
|
65
|
+
};
|
|
66
|
+
textTittleMessage: {
|
|
67
|
+
color: string;
|
|
68
|
+
fontSize: number;
|
|
69
|
+
textAlign: "center";
|
|
70
|
+
};
|
|
71
|
+
textMessage: {
|
|
72
|
+
color: string;
|
|
73
|
+
fontSize: number;
|
|
74
|
+
textAlign: "center";
|
|
75
|
+
};
|
|
76
|
+
buttonText: {
|
|
77
|
+
color: string;
|
|
78
|
+
fontSize: number;
|
|
79
|
+
textAlign: "center";
|
|
80
|
+
};
|
|
81
|
+
okayButtonContainer: {
|
|
82
|
+
justifyContent: "center";
|
|
83
|
+
alignSelf: "center";
|
|
84
|
+
flexDirection: "row";
|
|
85
|
+
marginTop: string;
|
|
86
|
+
};
|
|
87
|
+
recommendationContainer: {
|
|
88
|
+
flex: number;
|
|
89
|
+
justifyContent: "flex-start";
|
|
90
|
+
marginHorizontal: string;
|
|
91
|
+
};
|
|
92
|
+
addToCalculationContainer: {
|
|
93
|
+
flex: number;
|
|
94
|
+
justifyContent: "flex-start";
|
|
95
|
+
marginVertical: string;
|
|
96
|
+
};
|
|
97
|
+
innerView: {
|
|
98
|
+
flex: number;
|
|
99
|
+
alignContent: "center";
|
|
100
|
+
paddingVertical: string;
|
|
101
|
+
paddingHorizontal: string;
|
|
102
|
+
marginVertical: string;
|
|
103
|
+
borderRadius: number;
|
|
104
|
+
borderWidth: number;
|
|
105
|
+
borderColor: string;
|
|
106
|
+
};
|
|
107
|
+
suggestedView: {
|
|
108
|
+
flexDirection: "row";
|
|
109
|
+
justifyContent: "center";
|
|
110
|
+
};
|
|
111
|
+
suggestedCarbs: {
|
|
112
|
+
color: string;
|
|
113
|
+
fontSize: number;
|
|
114
|
+
fontWeight: "bold";
|
|
115
|
+
textAlign: "center";
|
|
116
|
+
};
|
|
117
|
+
recommendEatingText: {
|
|
118
|
+
color: string;
|
|
119
|
+
fontSize: number;
|
|
120
|
+
textAlign: "center";
|
|
121
|
+
};
|
|
122
|
+
carbohydrateText: {
|
|
123
|
+
color: string;
|
|
124
|
+
fontSize: number;
|
|
125
|
+
textAlign: "center";
|
|
126
|
+
};
|
|
127
|
+
addToCalculation: {
|
|
128
|
+
color: string;
|
|
129
|
+
fontSize: number;
|
|
130
|
+
textAlign: "center";
|
|
131
|
+
};
|
|
132
|
+
recommendationButtonsContainer: {
|
|
133
|
+
justifyContent: "center";
|
|
134
|
+
flexDirection: "row";
|
|
135
|
+
marginTop: string;
|
|
136
|
+
};
|
|
137
|
+
affirmativeCarbsText: {
|
|
138
|
+
color: string;
|
|
139
|
+
fontSize: number;
|
|
140
|
+
textAlign: "center";
|
|
141
|
+
};
|
|
142
|
+
negativeCarbsText: {
|
|
143
|
+
color: string;
|
|
144
|
+
fontSize: number;
|
|
145
|
+
textAlign: "center";
|
|
146
|
+
};
|
|
147
|
+
affirmativeCarbsButton: {
|
|
148
|
+
marginTop: string;
|
|
149
|
+
borderRadius: number;
|
|
150
|
+
borderWidth: number;
|
|
151
|
+
borderColor: string;
|
|
152
|
+
width: number;
|
|
153
|
+
height: number;
|
|
154
|
+
alignSelf: "center";
|
|
155
|
+
justifyContent: "center";
|
|
156
|
+
marginRight: string;
|
|
157
|
+
};
|
|
158
|
+
negativeCarbsButton: {
|
|
159
|
+
marginTop: string;
|
|
160
|
+
borderRadius: number;
|
|
161
|
+
borderWidth: number;
|
|
162
|
+
borderColor: string;
|
|
163
|
+
width: number;
|
|
164
|
+
height: number;
|
|
165
|
+
alignSelf: "center";
|
|
166
|
+
justifyContent: "center";
|
|
167
|
+
marginLeft: string;
|
|
168
|
+
};
|
|
169
|
+
okButton: {
|
|
170
|
+
marginTop: string;
|
|
171
|
+
borderRadius: number;
|
|
172
|
+
borderWidth: number;
|
|
173
|
+
borderColor: string;
|
|
174
|
+
width: number;
|
|
175
|
+
height: number;
|
|
176
|
+
alignSelf: "center";
|
|
177
|
+
justifyContent: "center";
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
export {};
|
|
@@ -22,12 +22,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.stylesModal = void 0;
|
|
25
26
|
const macro_1 = require("@lingui/macro");
|
|
26
27
|
const React = __importStar(require("react"));
|
|
27
28
|
const react_native_1 = require("react-native");
|
|
28
29
|
const react_native_modal_1 = __importDefault(require("react-native-modal"));
|
|
29
30
|
const i18nUtils_1 = require("../locale/i18nUtils");
|
|
30
|
-
|
|
31
|
+
const Constants_1 = require("../utils/Constants");
|
|
32
|
+
class RecommendationModal extends React.Component {
|
|
31
33
|
constructor(props) {
|
|
32
34
|
super(props);
|
|
33
35
|
this.onPressNextButton = () => {
|
|
@@ -36,67 +38,69 @@ class HediaRecommendationModal extends React.Component {
|
|
|
36
38
|
return isPageVisible ? this.setState({ firstPageVisible: false }) : this.props.onClickOkButton();
|
|
37
39
|
};
|
|
38
40
|
this.recommendationButtons = () => {
|
|
39
|
-
return (<react_native_1.View style={
|
|
40
|
-
<react_native_1.TouchableOpacity accessibilityLabel="yesButtonModal" style={
|
|
41
|
-
<react_native_1.Text style={
|
|
41
|
+
return (<react_native_1.View style={exports.stylesModal.recommendationButtonsContainer}>
|
|
42
|
+
<react_native_1.TouchableOpacity accessibilityLabel="yesButtonModal" style={exports.stylesModal.affirmativeCarbsButton} onPress={this.props.onAcceptCarbohydrates}>
|
|
43
|
+
<react_native_1.Text style={exports.stylesModal.affirmativeCarbsText}>{i18nUtils_1.i18n._(macro_1.t `OK`)}</react_native_1.Text>
|
|
42
44
|
</react_native_1.TouchableOpacity>
|
|
43
|
-
<react_native_1.TouchableOpacity accessibilityLabel="noButtonModal" style={
|
|
44
|
-
<react_native_1.Text style={
|
|
45
|
+
<react_native_1.TouchableOpacity accessibilityLabel="noButtonModal" style={exports.stylesModal.negativeCarbsButton} onPress={this.props.onDeclineCarbohydrates}>
|
|
46
|
+
<react_native_1.Text style={exports.stylesModal.negativeCarbsText}>{i18nUtils_1.i18n._(macro_1.t `NO`)}</react_native_1.Text>
|
|
45
47
|
</react_native_1.TouchableOpacity>
|
|
46
48
|
</react_native_1.View>);
|
|
47
49
|
};
|
|
48
50
|
this.recommendCarbohydrates = () => {
|
|
49
51
|
const { suggestedCarbohydrates } = this.props;
|
|
50
|
-
return (<react_native_1.View style={
|
|
51
|
-
<react_native_1.View style={
|
|
52
|
-
<react_native_1.View style={
|
|
53
|
-
<react_native_1.Text style={
|
|
52
|
+
return (<react_native_1.View style={exports.stylesModal.flex1}>
|
|
53
|
+
<react_native_1.View style={exports.stylesModal.innerView}>
|
|
54
|
+
<react_native_1.View style={exports.stylesModal.recommendationRow}>
|
|
55
|
+
<react_native_1.Text style={exports.stylesModal.recommendEatingText}>
|
|
56
|
+
{i18nUtils_1.i18n._(macro_1.t `We recommend eating an additional:`)}
|
|
57
|
+
</react_native_1.Text>
|
|
54
58
|
</react_native_1.View>
|
|
55
|
-
<react_native_1.View style={
|
|
56
|
-
<react_native_1.View style={
|
|
57
|
-
<react_native_1.Text style={
|
|
58
|
-
<react_native_1.Text style={
|
|
59
|
+
<react_native_1.View style={exports.stylesModal.center}>
|
|
60
|
+
<react_native_1.View style={exports.stylesModal.suggestedView}>
|
|
61
|
+
<react_native_1.Text style={exports.stylesModal.suggestedCarbs}>{`${Math.round(suggestedCarbohydrates)} `}</react_native_1.Text>
|
|
62
|
+
<react_native_1.Text style={exports.stylesModal.carbohydrateText}>{i18nUtils_1.i18n._(macro_1.t `grams of carbohydrates`)}</react_native_1.Text>
|
|
59
63
|
</react_native_1.View>
|
|
60
64
|
</react_native_1.View>
|
|
61
|
-
<react_native_1.View style={
|
|
62
|
-
<react_native_1.Text style={
|
|
65
|
+
<react_native_1.View style={exports.stylesModal.recommendationRow}>
|
|
66
|
+
<react_native_1.Text style={exports.stylesModal.recommendEatingText}>{i18nUtils_1.i18n._(macro_1.t `Instead of taking insulin`)}</react_native_1.Text>
|
|
63
67
|
</react_native_1.View>
|
|
64
68
|
</react_native_1.View>
|
|
65
|
-
<react_native_1.View style={
|
|
66
|
-
<react_native_1.View style={
|
|
67
|
-
<react_native_1.Text style={
|
|
69
|
+
<react_native_1.View style={exports.stylesModal.addToCalculationContainer}>
|
|
70
|
+
<react_native_1.View style={exports.stylesModal.center}>
|
|
71
|
+
<react_native_1.Text style={exports.stylesModal.addToCalculation}>
|
|
68
72
|
{i18nUtils_1.i18n._(macro_1.t `Would you like to add this to your current calculation?`)}
|
|
69
73
|
</react_native_1.Text>
|
|
70
74
|
</react_native_1.View>
|
|
71
|
-
<react_native_1.View style={{ ...
|
|
75
|
+
<react_native_1.View style={{ ...exports.stylesModal.flexStart, flex: 2 }}>{this.recommendationButtons()}</react_native_1.View>
|
|
72
76
|
</react_native_1.View>
|
|
73
77
|
</react_native_1.View>);
|
|
74
78
|
};
|
|
75
79
|
this.secondPage = () => {
|
|
76
80
|
const { attentionMessage, suggestedCarbohydrates } = this.props;
|
|
77
81
|
const areCarbs = suggestedCarbohydrates && suggestedCarbohydrates > 0;
|
|
78
|
-
return (<react_native_1.View style={
|
|
79
|
-
<react_native_1.View style={areCarbs ?
|
|
80
|
-
<react_native_1.View style={
|
|
81
|
-
<react_native_1.Text style={
|
|
82
|
+
return (<react_native_1.View style={exports.stylesModal.container}>
|
|
83
|
+
<react_native_1.View style={areCarbs ? exports.stylesModal.textContainerIfCarbs : exports.stylesModal.textContainer}>
|
|
84
|
+
<react_native_1.View style={exports.stylesModal.marginVertical}>
|
|
85
|
+
<react_native_1.Text style={exports.stylesModal.textTittleMessage}>{i18nUtils_1.i18n._(macro_1.t `Attention`)}</react_native_1.Text>
|
|
82
86
|
</react_native_1.View>
|
|
83
|
-
<react_native_1.Text style={
|
|
87
|
+
<react_native_1.Text style={exports.stylesModal.textMessage}>{attentionMessage}</react_native_1.Text>
|
|
84
88
|
</react_native_1.View>
|
|
85
|
-
<react_native_1.View style={areCarbs ?
|
|
89
|
+
<react_native_1.View style={areCarbs ? exports.stylesModal.recommendationContainer : exports.stylesModal.flexStart}>
|
|
86
90
|
{areCarbs ? this.recommendCarbohydrates() : this.okayButton()}
|
|
87
91
|
</react_native_1.View>
|
|
88
92
|
</react_native_1.View>);
|
|
89
93
|
};
|
|
90
94
|
this.firstPage = () => {
|
|
91
95
|
const { limitationMessage } = this.props;
|
|
92
|
-
return (<react_native_1.View style={
|
|
93
|
-
<react_native_1.View style={
|
|
94
|
-
<react_native_1.View style={
|
|
95
|
-
<react_native_1.Text style={
|
|
96
|
+
return (<react_native_1.View style={exports.stylesModal.container}>
|
|
97
|
+
<react_native_1.View style={exports.stylesModal.textContainer}>
|
|
98
|
+
<react_native_1.View style={exports.stylesModal.marginVertical}>
|
|
99
|
+
<react_native_1.Text style={exports.stylesModal.textTittleMessage}>{i18nUtils_1.i18n._(macro_1.t `Attention`)}</react_native_1.Text>
|
|
96
100
|
</react_native_1.View>
|
|
97
|
-
<react_native_1.Text style={
|
|
101
|
+
<react_native_1.Text style={exports.stylesModal.textMessage}>{limitationMessage}</react_native_1.Text>
|
|
98
102
|
</react_native_1.View>
|
|
99
|
-
<react_native_1.View style={
|
|
103
|
+
<react_native_1.View style={exports.stylesModal.flexStart}>{this.nextButton()}</react_native_1.View>
|
|
100
104
|
</react_native_1.View>);
|
|
101
105
|
};
|
|
102
106
|
this.state = {
|
|
@@ -104,40 +108,39 @@ class HediaRecommendationModal extends React.Component {
|
|
|
104
108
|
};
|
|
105
109
|
}
|
|
106
110
|
okayButton() {
|
|
107
|
-
return (<react_native_1.View style={
|
|
108
|
-
<react_native_1.TouchableOpacity accessibilityLabel="okayButtonModal" style={
|
|
109
|
-
<react_native_1.Text style={
|
|
111
|
+
return (<react_native_1.View style={exports.stylesModal.okayButtonContainer}>
|
|
112
|
+
<react_native_1.TouchableOpacity accessibilityLabel="okayButtonModal" style={exports.stylesModal.okButton} onPress={this.props.onClickOkButton}>
|
|
113
|
+
<react_native_1.Text style={exports.stylesModal.buttonText}>{i18nUtils_1.i18n._(macro_1.t `OK`)}</react_native_1.Text>
|
|
110
114
|
</react_native_1.TouchableOpacity>
|
|
111
115
|
</react_native_1.View>);
|
|
112
116
|
}
|
|
113
117
|
nextButton() {
|
|
114
|
-
return (<react_native_1.View style={
|
|
115
|
-
<react_native_1.TouchableOpacity accessibilityLabel="nextButtonModal" style={
|
|
116
|
-
<react_native_1.Text style={
|
|
118
|
+
return (<react_native_1.View style={exports.stylesModal.okayButtonContainer}>
|
|
119
|
+
<react_native_1.TouchableOpacity accessibilityLabel="nextButtonModal" style={exports.stylesModal.okButton} onPress={this.onPressNextButton}>
|
|
120
|
+
<react_native_1.Text style={exports.stylesModal.buttonText}>{i18nUtils_1.i18n._(macro_1.t `OK`)}</react_native_1.Text>
|
|
117
121
|
</react_native_1.TouchableOpacity>
|
|
118
122
|
</react_native_1.View>);
|
|
119
123
|
}
|
|
120
124
|
render() {
|
|
121
125
|
const { isVisible } = this.props;
|
|
122
126
|
const { firstPageVisible } = this.state;
|
|
123
|
-
return (<react_native_modal_1.default isVisible={isVisible} style={
|
|
127
|
+
return (<react_native_modal_1.default isVisible={isVisible} style={exports.stylesModal.modalStyle}>
|
|
124
128
|
{firstPageVisible ? this.firstPage() : this.secondPage()}
|
|
125
129
|
</react_native_modal_1.default>);
|
|
126
130
|
}
|
|
127
131
|
}
|
|
128
|
-
exports.default =
|
|
132
|
+
exports.default = RecommendationModal;
|
|
129
133
|
const { height, width } = react_native_1.Dimensions.get(`screen`);
|
|
130
134
|
const buttonHeight = height / 20;
|
|
131
135
|
const buttonWidth = width / 2.5;
|
|
132
136
|
const buttonFontSize = height / 45;
|
|
133
137
|
const buttonBorderRadius = height / 30;
|
|
134
138
|
const buttonBorderWidth = height / 500;
|
|
135
|
-
const tealColor = `rgba(73, 255, 252, 1)`;
|
|
136
139
|
const sugestionFontSize = height / 35;
|
|
137
140
|
const recommendEatingFontSize = height / 45;
|
|
138
141
|
const textFontSize = height / 42;
|
|
139
142
|
const titleFontSize = height / 30;
|
|
140
|
-
|
|
143
|
+
exports.stylesModal = react_native_1.StyleSheet.create({
|
|
141
144
|
modalStyle: { margin: 0 },
|
|
142
145
|
flex1: { flex: 1 },
|
|
143
146
|
container: { flex: 1, backgroundColor: `rgba(30, 35, 87, 0.9)` },
|
|
@@ -150,7 +153,7 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
150
153
|
textContainerIfCarbs: { flex: 3, justifyContent: `flex-end`, marginHorizontal: `6%` },
|
|
151
154
|
textTittleMessage: { color: `white`, fontSize: titleFontSize, textAlign: `center` },
|
|
152
155
|
textMessage: { color: `white`, fontSize: textFontSize, textAlign: `center` },
|
|
153
|
-
buttonText: { color:
|
|
156
|
+
buttonText: { color: Constants_1.BORDER_COLOUR_TEAL, fontSize: buttonFontSize, textAlign: `center` },
|
|
154
157
|
okayButtonContainer: { justifyContent: `center`, alignSelf: `center`, flexDirection: `row`, marginTop: `2%` },
|
|
155
158
|
recommendationContainer: { flex: 6, justifyContent: `flex-start`, marginHorizontal: `5%` },
|
|
156
159
|
addToCalculationContainer: { flex: 2, justifyContent: `flex-start`, marginVertical: `10%` },
|
|
@@ -162,7 +165,7 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
162
165
|
marginVertical: `8%`,
|
|
163
166
|
borderRadius: height / 80,
|
|
164
167
|
borderWidth: height / 300,
|
|
165
|
-
borderColor:
|
|
168
|
+
borderColor: Constants_1.BORDER_COLOUR_TEAL,
|
|
166
169
|
},
|
|
167
170
|
suggestedView: { flexDirection: `row`, justifyContent: `center` },
|
|
168
171
|
suggestedCarbs: { color: `white`, fontSize: sugestionFontSize, fontWeight: `bold`, textAlign: `center` },
|
|
@@ -170,13 +173,13 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
170
173
|
carbohydrateText: { color: `white`, fontSize: sugestionFontSize, textAlign: `center` },
|
|
171
174
|
addToCalculation: { color: `white`, fontSize: textFontSize, textAlign: `center` },
|
|
172
175
|
recommendationButtonsContainer: { justifyContent: `center`, flexDirection: `row`, marginTop: `3%` },
|
|
173
|
-
affirmativeCarbsText: { color:
|
|
176
|
+
affirmativeCarbsText: { color: Constants_1.BORDER_COLOUR_TEAL, fontSize: buttonFontSize, textAlign: `center` },
|
|
174
177
|
negativeCarbsText: { color: `white`, fontSize: buttonFontSize, textAlign: `center` },
|
|
175
178
|
affirmativeCarbsButton: {
|
|
176
179
|
marginTop: `2%`,
|
|
177
180
|
borderRadius: buttonBorderRadius,
|
|
178
181
|
borderWidth: buttonBorderWidth,
|
|
179
|
-
borderColor:
|
|
182
|
+
borderColor: Constants_1.BORDER_COLOUR_TEAL,
|
|
180
183
|
width: buttonWidth,
|
|
181
184
|
height: buttonHeight,
|
|
182
185
|
alignSelf: `center`,
|
|
@@ -198,7 +201,7 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
198
201
|
marginTop: `6%`,
|
|
199
202
|
borderRadius: buttonBorderRadius,
|
|
200
203
|
borderWidth: buttonBorderWidth,
|
|
201
|
-
borderColor:
|
|
204
|
+
borderColor: Constants_1.BORDER_COLOUR_TEAL,
|
|
202
205
|
width: buttonWidth,
|
|
203
206
|
height: buttonHeight,
|
|
204
207
|
alignSelf: `center`,
|