@hedia/recommendation-screen 1.1.2 → 1.2.1
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 +107 -71
- package/package.json +1 -1
- package/src/RecommendationScreen.d.ts +7 -2
- package/src/RecommendationScreen.jsx +30 -10
- package/src/RecommendationScreen.tsx +42 -12
- 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/InfoBars.d.ts +2 -0
- package/src/components/InfoBars.jsx +4 -4
- package/src/components/InfoBars.tsx +6 -6
- 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
|
@@ -18,7 +18,8 @@ import { RecommendationError, TimeoutLimitError } from "./utils/RecommendationEr
|
|
|
18
18
|
|
|
19
19
|
import { t } from "@lingui/macro";
|
|
20
20
|
import Activity from "./components/activity/Activity";
|
|
21
|
-
import
|
|
21
|
+
import ExitModal from "./components/ExitModal";
|
|
22
|
+
import RecommendationModal from "./components/RecommendationModal";
|
|
22
23
|
import { changeLanguage, i18n } from "./locale/i18nUtils";
|
|
23
24
|
import { IActivity, logbookEntry } from "./types/types";
|
|
24
25
|
import { AttentionMessage } from "./utils/AttentionMessages";
|
|
@@ -53,15 +54,17 @@ export interface IRecommendationProps {
|
|
|
53
54
|
|
|
54
55
|
// Callbacks
|
|
55
56
|
carbRecommendationAnswer(carbRecommendationAnswer: boolean): void;
|
|
56
|
-
|
|
57
|
+
closeCalculationCallback(): void;
|
|
58
|
+
exitCallback(): void;
|
|
57
59
|
onRecentInsulinYes(): void;
|
|
58
60
|
transferToLogbook(carbs: IResult, insulin: IResult, reminder: number): void;
|
|
59
61
|
onError(error: RecommendationError): void;
|
|
62
|
+
showBolusBar(toggle: boolean): void;
|
|
60
63
|
}
|
|
61
64
|
|
|
62
65
|
interface IState {
|
|
63
66
|
remeasureTime: number;
|
|
64
|
-
|
|
67
|
+
isRecommendationDisplayed: boolean;
|
|
65
68
|
insulinRecommendation: number;
|
|
66
69
|
activityReduction?: number;
|
|
67
70
|
wasLimited: boolean;
|
|
@@ -72,10 +75,11 @@ interface IState {
|
|
|
72
75
|
enteredCarbs?: number;
|
|
73
76
|
enteredInsulin?: number;
|
|
74
77
|
recommendationModal: boolean;
|
|
78
|
+
exitModal: boolean;
|
|
75
79
|
}
|
|
76
80
|
|
|
77
81
|
export default class RecommendationScreen extends React.Component<IRecommendationProps, IState> {
|
|
78
|
-
private readonly timer:
|
|
82
|
+
private readonly timer: ReturnType<typeof setTimeout>;
|
|
79
83
|
private readonly suggestedCarbs: number;
|
|
80
84
|
private scrollView: ScrollView;
|
|
81
85
|
|
|
@@ -100,7 +104,7 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
100
104
|
|
|
101
105
|
this.state = {
|
|
102
106
|
remeasureTime: this.getBGLevelRemeasurementReminder(),
|
|
103
|
-
|
|
107
|
+
isRecommendationDisplayed: recentBoluses?.length !== 0,
|
|
104
108
|
insulinRecommendation: Utils.roundValue(bolus, props.injectionMethod),
|
|
105
109
|
wasLimited,
|
|
106
110
|
activityReduction,
|
|
@@ -108,7 +112,8 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
108
112
|
carbRecommendation,
|
|
109
113
|
activeInsulin,
|
|
110
114
|
selectedMood: null,
|
|
111
|
-
recommendationModal: wasLimited || !!carbRecommendation || !!this.getBGLevelAttentionMessage(),
|
|
115
|
+
recommendationModal: wasLimited || !!Math.round(carbRecommendation) || !!this.getBGLevelAttentionMessage(),
|
|
116
|
+
exitModal: false,
|
|
112
117
|
};
|
|
113
118
|
|
|
114
119
|
this.timer = setTimeout((): void => {
|
|
@@ -117,7 +122,12 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
117
122
|
}
|
|
118
123
|
|
|
119
124
|
public onExit = (): void => {
|
|
120
|
-
|
|
125
|
+
if (this.state.isRecommendationDisplayed) {
|
|
126
|
+
this.setState({ exitModal: true }, (): void => this.props.showBolusBar(!this.state.exitModal));
|
|
127
|
+
} else {
|
|
128
|
+
this.props.exitCallback();
|
|
129
|
+
clearTimeout(this.timer);
|
|
130
|
+
}
|
|
121
131
|
};
|
|
122
132
|
|
|
123
133
|
public updateRemeasureTime = (remeasureTime: number): void => {
|
|
@@ -125,7 +135,7 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
125
135
|
};
|
|
126
136
|
|
|
127
137
|
public handleNoRecentInsulin = (): void => {
|
|
128
|
-
this.setState({
|
|
138
|
+
this.setState({ isRecommendationDisplayed: true }, (): void => {
|
|
129
139
|
setTimeout((): void => {
|
|
130
140
|
this.scrollView?.scrollToEnd({ animated: true });
|
|
131
141
|
}, 0);
|
|
@@ -153,6 +163,15 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
153
163
|
this.setState({ recommendationModal: false });
|
|
154
164
|
};
|
|
155
165
|
|
|
166
|
+
public hideExitModal = (): void => {
|
|
167
|
+
this.setState({ exitModal: false }, (): void => this.props.showBolusBar(!this.state.exitModal));
|
|
168
|
+
};
|
|
169
|
+
public closeCalculation = (): void => {
|
|
170
|
+
this.hideExitModal();
|
|
171
|
+
clearTimeout(this.timer);
|
|
172
|
+
this.props.closeCalculationCallback();
|
|
173
|
+
};
|
|
174
|
+
|
|
156
175
|
public handleMoodSelected = (selectedMood: IState["selectedMood"]): void => {
|
|
157
176
|
this.setState({ selectedMood });
|
|
158
177
|
};
|
|
@@ -162,6 +181,9 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
162
181
|
};
|
|
163
182
|
|
|
164
183
|
public handleTransfer = (): void => {
|
|
184
|
+
if (this.state.exitModal) {
|
|
185
|
+
this.hideExitModal();
|
|
186
|
+
}
|
|
165
187
|
this.props.transferToLogbook(
|
|
166
188
|
{
|
|
167
189
|
suggested: this.suggestedCarbs,
|
|
@@ -205,6 +227,7 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
205
227
|
<ScrollView style={containerStyles.container} ref={(view): ScrollView => (this.scrollView = view)}>
|
|
206
228
|
<Header exitCallback={this.onExit} />
|
|
207
229
|
<InfoBars
|
|
230
|
+
style={{ flex: 5 }}
|
|
208
231
|
label={i18n._(t`Active Insulin`)}
|
|
209
232
|
value={activeInsulin ? `${activeInsulin.toFixed(1)}` : null}
|
|
210
233
|
units={i18n._(t`units`)}
|
|
@@ -229,7 +252,7 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
229
252
|
<RecommendedCarbs
|
|
230
253
|
enteredCarbs={`${carbohydrates}`}
|
|
231
254
|
changedRecommendedCarbs={this.updateCarbRecommendation}
|
|
232
|
-
recommendedCarbs={`${enteredCarbs ?? carbRecommendation}`}
|
|
255
|
+
recommendedCarbs={`${enteredCarbs ?? Math.round(carbRecommendation)}`}
|
|
233
256
|
removeRecommendedCarbs={this.removeCarbRecommendation}
|
|
234
257
|
onError={this.props.onError}
|
|
235
258
|
/>
|
|
@@ -247,7 +270,7 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
247
270
|
activityReduction={this.state.activityReduction}
|
|
248
271
|
/>
|
|
249
272
|
) : null}
|
|
250
|
-
{this.state.
|
|
273
|
+
{!this.state.isRecommendationDisplayed ? (
|
|
251
274
|
<RecentInsulin
|
|
252
275
|
onRecentInsulinYes={this.props.onRecentInsulinYes}
|
|
253
276
|
onRecentInsulinNo={this.handleNoRecentInsulin}
|
|
@@ -262,8 +285,8 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
262
285
|
/>
|
|
263
286
|
)}
|
|
264
287
|
<Emotion moodSelected={this.handleMoodSelected} currentMood={this.state.selectedMood} />
|
|
265
|
-
<TransferToLogbook visible={
|
|
266
|
-
<
|
|
288
|
+
<TransferToLogbook visible={this.state.isRecommendationDisplayed} transfer={this.handleTransfer} />
|
|
289
|
+
<RecommendationModal
|
|
267
290
|
isVisible={recommendationModal}
|
|
268
291
|
suggestedCarbohydrates={carbRecommendation}
|
|
269
292
|
attentionMessage={this.getBGLevelAttentionMessage()}
|
|
@@ -273,6 +296,13 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
273
296
|
onDeclineCarbohydrates={this.declineCarbRecommendation}
|
|
274
297
|
/>
|
|
275
298
|
</ScrollView>
|
|
299
|
+
{this.state.exitModal ? (
|
|
300
|
+
<ExitModal
|
|
301
|
+
onSave={this.handleTransfer}
|
|
302
|
+
onCloseCalculation={this.closeCalculation}
|
|
303
|
+
onClose={this.hideExitModal}
|
|
304
|
+
/>
|
|
305
|
+
) : null}
|
|
276
306
|
</I18nProvider>
|
|
277
307
|
);
|
|
278
308
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
interface IModalProps {
|
|
3
|
+
onSave(): void;
|
|
4
|
+
onCloseCalculation(): void;
|
|
5
|
+
onClose(): void;
|
|
6
|
+
}
|
|
7
|
+
export default class ExitModal extends React.Component<IModalProps> {
|
|
8
|
+
constructor(props: IModalProps);
|
|
9
|
+
render(): JSX.Element;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -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}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
2
3
|
export interface IProps {
|
|
3
4
|
label: string;
|
|
4
5
|
value?: string;
|
|
5
6
|
units: string;
|
|
6
7
|
showZeroAsDash: boolean;
|
|
8
|
+
style?: StyleProp<ViewStyle>;
|
|
7
9
|
}
|
|
8
10
|
export default class InfoBars extends React.Component<IProps> {
|
|
9
11
|
render(): JSX.Element;
|
|
@@ -18,8 +18,8 @@ class InfoBars extends react_1.default.Component {
|
|
|
18
18
|
<react_native_1.View style={exports.infoStyles.labelContainer}>
|
|
19
19
|
<react_native_1.Text style={exports.infoStyles.label}>{this.props.label}</react_native_1.Text>
|
|
20
20
|
</react_native_1.View>
|
|
21
|
-
<react_native_1.View style={exports.infoStyles.valueUnitContainer}>
|
|
22
|
-
<react_native_1.View style={exports.infoStyles.valueContainer}>
|
|
21
|
+
<react_native_1.View style={[{ ...exports.infoStyles.valueUnitContainer }, this.props.style]}>
|
|
22
|
+
<react_native_1.View style={[{ ...exports.infoStyles.valueContainer }, this.props.style]}>
|
|
23
23
|
<react_native_1.Text style={exports.infoStyles.value}>{displayedValue}</react_native_1.Text>
|
|
24
24
|
</react_native_1.View>
|
|
25
25
|
<react_native_1.View style={exports.infoStyles.unitContainer}>
|
|
@@ -67,7 +67,7 @@ exports.infoStyles = react_native_1.StyleSheet.create({
|
|
|
67
67
|
flexDirection: `row`,
|
|
68
68
|
},
|
|
69
69
|
valueContainer: {
|
|
70
|
-
flex:
|
|
70
|
+
flex: 4,
|
|
71
71
|
justifyContent: `flex-end`,
|
|
72
72
|
},
|
|
73
73
|
value: {
|
|
@@ -77,7 +77,7 @@ exports.infoStyles = react_native_1.StyleSheet.create({
|
|
|
77
77
|
textAlign: `right`,
|
|
78
78
|
},
|
|
79
79
|
unitContainer: {
|
|
80
|
-
flex:
|
|
80
|
+
flex: 4,
|
|
81
81
|
justifyContent: `flex-end`,
|
|
82
82
|
paddingBottom: `3%`,
|
|
83
83
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Dimensions, StyleSheet, Text, View } from "react-native";
|
|
2
|
+
import { Dimensions, StyleProp, StyleSheet, Text, View, ViewStyle } from "react-native";
|
|
3
3
|
import { BORDER_COLOUR_GREY } from "../utils/Constants";
|
|
4
4
|
import { headerStyles } from "./Header";
|
|
5
5
|
|
|
@@ -8,12 +8,12 @@ export interface IProps {
|
|
|
8
8
|
value?: string;
|
|
9
9
|
units: string;
|
|
10
10
|
showZeroAsDash: boolean;
|
|
11
|
+
style?: StyleProp<ViewStyle>;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
export default class InfoBars extends React.Component<IProps> {
|
|
14
15
|
public render(): JSX.Element {
|
|
15
16
|
const displayedValue = this.props.value ?? (this.props.showZeroAsDash ? `-.-` : `0`);
|
|
16
|
-
|
|
17
17
|
return (
|
|
18
18
|
<View style={infoStyles.container}>
|
|
19
19
|
<View style={infoStyles.margin}>
|
|
@@ -22,8 +22,8 @@ export default class InfoBars extends React.Component<IProps> {
|
|
|
22
22
|
<View style={infoStyles.labelContainer}>
|
|
23
23
|
<Text style={infoStyles.label}>{this.props.label}</Text>
|
|
24
24
|
</View>
|
|
25
|
-
<View style={infoStyles.valueUnitContainer}>
|
|
26
|
-
<View style={infoStyles.valueContainer}>
|
|
25
|
+
<View style={[{ ...infoStyles.valueUnitContainer }, this.props.style]}>
|
|
26
|
+
<View style={[{ ...infoStyles.valueContainer }, this.props.style]}>
|
|
27
27
|
<Text style={infoStyles.value}>{displayedValue}</Text>
|
|
28
28
|
</View>
|
|
29
29
|
<View style={infoStyles.unitContainer}>
|
|
@@ -72,7 +72,7 @@ export const infoStyles = StyleSheet.create({
|
|
|
72
72
|
flexDirection: `row`,
|
|
73
73
|
},
|
|
74
74
|
valueContainer: {
|
|
75
|
-
flex:
|
|
75
|
+
flex: 4,
|
|
76
76
|
justifyContent: `flex-end`,
|
|
77
77
|
},
|
|
78
78
|
value: {
|
|
@@ -82,7 +82,7 @@ export const infoStyles = StyleSheet.create({
|
|
|
82
82
|
textAlign: `right`,
|
|
83
83
|
},
|
|
84
84
|
unitContainer: {
|
|
85
|
-
flex:
|
|
85
|
+
flex: 4,
|
|
86
86
|
justifyContent: `flex-end`,
|
|
87
87
|
paddingBottom: `3%`,
|
|
88
88
|
},
|
|
@@ -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 {};
|