@hedia/recommendation-screen 1.4.4 → 1.5.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/workspace.xml +38 -137
- package/android/app/src/main/assets/fonts/AntDesign.ttf +0 -0
- package/android/app/src/main/assets/fonts/Entypo.ttf +0 -0
- package/android/app/src/main/assets/fonts/EvilIcons.ttf +0 -0
- package/android/app/src/main/assets/fonts/Feather.ttf +0 -0
- package/android/app/src/main/assets/fonts/FontAwesome.ttf +0 -0
- package/android/app/src/main/assets/fonts/FontAwesome5_Brands.ttf +0 -0
- package/android/app/src/main/assets/fonts/FontAwesome5_Regular.ttf +0 -0
- package/android/app/src/main/assets/fonts/FontAwesome5_Solid.ttf +0 -0
- package/android/app/src/main/assets/fonts/Fontisto.ttf +0 -0
- package/android/app/src/main/assets/fonts/Foundation.ttf +0 -0
- package/android/app/src/main/assets/fonts/Ionicons.ttf +0 -0
- package/android/app/src/main/assets/fonts/MaterialCommunityIcons.ttf +0 -0
- package/android/app/src/main/assets/fonts/MaterialIcons.ttf +0 -0
- package/android/app/src/main/assets/fonts/Octicons.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-Black.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-BlackItalic.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-Bold.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-BoldItalic.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-Italic.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-Light.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-LightItalic.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-Medium.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-MediumItalic.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-Regular.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-Thin.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-ThinItalic.ttf +0 -0
- package/android/app/src/main/assets/fonts/SimpleLineIcons.ttf +0 -0
- package/android/app/src/main/assets/fonts/Zocial.ttf +0 -0
- package/assets/fonts/Roboto/LICENSE.txt +202 -0
- package/assets/fonts/Roboto/Roboto-Black.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-BlackItalic.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-Bold.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-BoldItalic.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-Italic.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-Light.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-LightItalic.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-Medium.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-MediumItalic.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-Regular.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-Thin.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-ThinItalic.ttf +0 -0
- package/ios/HediaRecommendationScreen/Info.plist +18 -6
- package/ios/HediaRecommendationScreen.xcodeproj/project.pbxproj +48 -0
- package/package.json +1 -1
- package/react-native.config.js +7 -0
- package/src/RecommendationScreen.d.ts +11 -4
- package/src/RecommendationScreen.jsx +47 -24
- package/src/RecommendationScreen.tsx +94 -34
- package/src/components/InfoBars.d.ts +2 -4
- package/src/components/InfoBars.jsx +8 -8
- package/src/components/InfoBars.tsx +9 -10
- package/src/components/LimitationMessage.d.ts +10 -0
- package/src/components/LimitationMessage.jsx +50 -0
- package/src/components/LimitationMessage.tsx +42 -0
- package/src/components/LineSeparator.d.ts +8 -0
- package/src/components/LineSeparator.jsx +22 -0
- package/src/components/LineSeparator.tsx +24 -0
- package/src/components/RecommendationModal.d.ts +5 -1
- package/src/components/RecommendationModal.jsx +15 -24
- package/src/components/RecommendationModal.tsx +26 -36
- package/src/components/RecommendedCarbs.d.ts +0 -1
- package/src/components/RecommendedCarbs.jsx +44 -45
- package/src/components/RecommendedCarbs.tsx +45 -47
- package/src/components/RecommendedInsulin.jsx +2 -2
- package/src/components/RecommendedInsulin.tsx +2 -2
- package/src/components/Remeasure.jsx +1 -0
- package/src/components/Remeasure.tsx +1 -0
- package/src/components/TwoOptionModal.d.ts +130 -0
- package/src/components/TwoOptionModal.jsx +135 -0
- package/src/components/TwoOptionModal.tsx +144 -0
- package/src/components/activity/Activity.jsx +1 -0
- package/src/components/activity/Activity.tsx +1 -0
- package/src/locale/da/messages.js +1 -1
- package/src/locale/da/messages.po +112 -76
- package/src/locale/en/messages.js +1 -1
- package/src/locale/en/messages.po +91 -55
- package/src/types/enum.d.ts +1 -2
- package/src/types/enum.js +0 -1
- package/src/types/enum.ts +0 -1
- package/src/utils/AttentionMessages.d.ts +6 -1
- package/src/utils/AttentionMessages.jsx +22 -5
- package/src/utils/AttentionMessages.tsx +24 -3
- package/src/utils/RecommendationError.d.ts +0 -1
- package/src/utils/RecommendationError.jsx +1 -2
- package/src/utils/RecommendationError.tsx +0 -8
- package/src/utils/RecommendationUtils.js +1 -1
- package/src/utils/RecommendationUtils.ts +2 -2
- package/src/components/ExitModal.d.ts +0 -11
- package/src/components/ExitModal.jsx +0 -87
- package/src/components/ExitModal.tsx +0 -85
|
@@ -20,6 +20,18 @@
|
|
|
20
20
|
67B736B68E6CE9470594F423 /* libPods-HediaRecommendationScreen-tvOSTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0C6208DA582D28E78321BE4C /* libPods-HediaRecommendationScreen-tvOSTests.a */; };
|
|
21
21
|
7B5B860F1F9B42AA34AC5152 /* libPods-HediaRecommendationScreen-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EFC57BC9FB3B2C296DEE36A4 /* libPods-HediaRecommendationScreen-tvOS.a */; };
|
|
22
22
|
9EC25A0760FAC772A9BD725C /* libPods-HediaRecommendationScreen-HediaRecommendationScreenTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5EDA6B8933B78062F35AD378 /* libPods-HediaRecommendationScreen-HediaRecommendationScreenTests.a */; };
|
|
23
|
+
072C9E3B51DA436C891218B1 /* Roboto-Black.ttf in Resources */ = {isa = PBXBuildFile; fileRef = A825F67CF7F84470A6CA153E /* Roboto-Black.ttf */; };
|
|
24
|
+
22573CC8B7CE4FF1BD10295D /* Roboto-BlackItalic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 292E9B7C9CC34528A189562E /* Roboto-BlackItalic.ttf */; };
|
|
25
|
+
7A871848483F435B9A0BEA2C /* Roboto-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = BB57D47699604DFAA6805BA9 /* Roboto-Bold.ttf */; };
|
|
26
|
+
E61177AB81304E969ADEED74 /* Roboto-BoldItalic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 02F7D2222CF04F1080EC856D /* Roboto-BoldItalic.ttf */; };
|
|
27
|
+
054F998137774421AE47012A /* Roboto-Italic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = A40E87F3A8C2414EAFEB6561 /* Roboto-Italic.ttf */; };
|
|
28
|
+
F761ADFC0F1D40219F84BC4E /* Roboto-Light.ttf in Resources */ = {isa = PBXBuildFile; fileRef = E61EBECE6F704FA9B6A0A0A2 /* Roboto-Light.ttf */; };
|
|
29
|
+
E250F52F03C348DEB792BFA7 /* Roboto-LightItalic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 525CDCD5B0F548FBB616CEE7 /* Roboto-LightItalic.ttf */; };
|
|
30
|
+
729B270E7FF74717B643ED72 /* Roboto-Medium.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 07CB8191B5BD449ABE77A9E4 /* Roboto-Medium.ttf */; };
|
|
31
|
+
79BF34167F0341D784C2AB24 /* Roboto-MediumItalic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 5D4A4DBD26164962A8597BE7 /* Roboto-MediumItalic.ttf */; };
|
|
32
|
+
12D08CCEE9074DA9ABC5CBE3 /* Roboto-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 7A22FC8F689C40349AD97898 /* Roboto-Regular.ttf */; };
|
|
33
|
+
293D0A9D749748C09992BD81 /* Roboto-Thin.ttf in Resources */ = {isa = PBXBuildFile; fileRef = B8AB50A0130D4104AE2EEC01 /* Roboto-Thin.ttf */; };
|
|
34
|
+
F4F44066504F4C7EA1C5B3E9 /* Roboto-ThinItalic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 5C1C36955725451281090FA0 /* Roboto-ThinItalic.ttf */; };
|
|
23
35
|
/* End PBXBuildFile section */
|
|
24
36
|
|
|
25
37
|
/* Begin PBXContainerItemProxy section */
|
|
@@ -83,6 +95,18 @@
|
|
|
83
95
|
EE8FB5191C77428097063908 /* AntDesign.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = AntDesign.ttf; path = "../node_modules/react-native-vector-icons/Fonts/AntDesign.ttf"; sourceTree = "<group>"; };
|
|
84
96
|
EFC57BC9FB3B2C296DEE36A4 /* libPods-HediaRecommendationScreen-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-HediaRecommendationScreen-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
85
97
|
FC979D0C4CEB472E8E6FB497 /* SimpleLineIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = SimpleLineIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/SimpleLineIcons.ttf"; sourceTree = "<group>"; };
|
|
98
|
+
A825F67CF7F84470A6CA153E /* Roboto-Black.ttf */ = {isa = PBXFileReference; name = "Roboto-Black.ttf"; path = "../assets/fonts/Roboto/Roboto-Black.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
|
|
99
|
+
292E9B7C9CC34528A189562E /* Roboto-BlackItalic.ttf */ = {isa = PBXFileReference; name = "Roboto-BlackItalic.ttf"; path = "../assets/fonts/Roboto/Roboto-BlackItalic.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
|
|
100
|
+
BB57D47699604DFAA6805BA9 /* Roboto-Bold.ttf */ = {isa = PBXFileReference; name = "Roboto-Bold.ttf"; path = "../assets/fonts/Roboto/Roboto-Bold.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
|
|
101
|
+
02F7D2222CF04F1080EC856D /* Roboto-BoldItalic.ttf */ = {isa = PBXFileReference; name = "Roboto-BoldItalic.ttf"; path = "../assets/fonts/Roboto/Roboto-BoldItalic.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
|
|
102
|
+
A40E87F3A8C2414EAFEB6561 /* Roboto-Italic.ttf */ = {isa = PBXFileReference; name = "Roboto-Italic.ttf"; path = "../assets/fonts/Roboto/Roboto-Italic.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
|
|
103
|
+
E61EBECE6F704FA9B6A0A0A2 /* Roboto-Light.ttf */ = {isa = PBXFileReference; name = "Roboto-Light.ttf"; path = "../assets/fonts/Roboto/Roboto-Light.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
|
|
104
|
+
525CDCD5B0F548FBB616CEE7 /* Roboto-LightItalic.ttf */ = {isa = PBXFileReference; name = "Roboto-LightItalic.ttf"; path = "../assets/fonts/Roboto/Roboto-LightItalic.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
|
|
105
|
+
07CB8191B5BD449ABE77A9E4 /* Roboto-Medium.ttf */ = {isa = PBXFileReference; name = "Roboto-Medium.ttf"; path = "../assets/fonts/Roboto/Roboto-Medium.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
|
|
106
|
+
5D4A4DBD26164962A8597BE7 /* Roboto-MediumItalic.ttf */ = {isa = PBXFileReference; name = "Roboto-MediumItalic.ttf"; path = "../assets/fonts/Roboto/Roboto-MediumItalic.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
|
|
107
|
+
7A22FC8F689C40349AD97898 /* Roboto-Regular.ttf */ = {isa = PBXFileReference; name = "Roboto-Regular.ttf"; path = "../assets/fonts/Roboto/Roboto-Regular.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
|
|
108
|
+
B8AB50A0130D4104AE2EEC01 /* Roboto-Thin.ttf */ = {isa = PBXFileReference; name = "Roboto-Thin.ttf"; path = "../assets/fonts/Roboto/Roboto-Thin.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
|
|
109
|
+
5C1C36955725451281090FA0 /* Roboto-ThinItalic.ttf */ = {isa = PBXFileReference; name = "Roboto-ThinItalic.ttf"; path = "../assets/fonts/Roboto/Roboto-ThinItalic.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
|
|
86
110
|
/* End PBXFileReference section */
|
|
87
111
|
|
|
88
112
|
/* Begin PBXFrameworksBuildPhase section */
|
|
@@ -157,6 +181,18 @@
|
|
|
157
181
|
B766079F5D3B4E2DA1F1D2FA /* Octicons.ttf */,
|
|
158
182
|
FC979D0C4CEB472E8E6FB497 /* SimpleLineIcons.ttf */,
|
|
159
183
|
A147DC8C00E94433B8826100 /* Zocial.ttf */,
|
|
184
|
+
A825F67CF7F84470A6CA153E /* Roboto-Black.ttf */,
|
|
185
|
+
292E9B7C9CC34528A189562E /* Roboto-BlackItalic.ttf */,
|
|
186
|
+
BB57D47699604DFAA6805BA9 /* Roboto-Bold.ttf */,
|
|
187
|
+
02F7D2222CF04F1080EC856D /* Roboto-BoldItalic.ttf */,
|
|
188
|
+
A40E87F3A8C2414EAFEB6561 /* Roboto-Italic.ttf */,
|
|
189
|
+
E61EBECE6F704FA9B6A0A0A2 /* Roboto-Light.ttf */,
|
|
190
|
+
525CDCD5B0F548FBB616CEE7 /* Roboto-LightItalic.ttf */,
|
|
191
|
+
07CB8191B5BD449ABE77A9E4 /* Roboto-Medium.ttf */,
|
|
192
|
+
5D4A4DBD26164962A8597BE7 /* Roboto-MediumItalic.ttf */,
|
|
193
|
+
7A22FC8F689C40349AD97898 /* Roboto-Regular.ttf */,
|
|
194
|
+
B8AB50A0130D4104AE2EEC01 /* Roboto-Thin.ttf */,
|
|
195
|
+
5C1C36955725451281090FA0 /* Roboto-ThinItalic.ttf */,
|
|
160
196
|
);
|
|
161
197
|
name = Resources;
|
|
162
198
|
sourceTree = "<group>";
|
|
@@ -381,6 +417,18 @@
|
|
|
381
417
|
files = (
|
|
382
418
|
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
|
|
383
419
|
13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */,
|
|
420
|
+
072C9E3B51DA436C891218B1 /* Roboto-Black.ttf in Resources */,
|
|
421
|
+
22573CC8B7CE4FF1BD10295D /* Roboto-BlackItalic.ttf in Resources */,
|
|
422
|
+
7A871848483F435B9A0BEA2C /* Roboto-Bold.ttf in Resources */,
|
|
423
|
+
E61177AB81304E969ADEED74 /* Roboto-BoldItalic.ttf in Resources */,
|
|
424
|
+
054F998137774421AE47012A /* Roboto-Italic.ttf in Resources */,
|
|
425
|
+
F761ADFC0F1D40219F84BC4E /* Roboto-Light.ttf in Resources */,
|
|
426
|
+
E250F52F03C348DEB792BFA7 /* Roboto-LightItalic.ttf in Resources */,
|
|
427
|
+
729B270E7FF74717B643ED72 /* Roboto-Medium.ttf in Resources */,
|
|
428
|
+
79BF34167F0341D784C2AB24 /* Roboto-MediumItalic.ttf in Resources */,
|
|
429
|
+
12D08CCEE9074DA9ABC5CBE3 /* Roboto-Regular.ttf in Resources */,
|
|
430
|
+
293D0A9D749748C09992BD81 /* Roboto-Thin.ttf in Resources */,
|
|
431
|
+
F4F44066504F4C7EA1C5B3E9 /* Roboto-ThinItalic.ttf in Resources */,
|
|
384
432
|
);
|
|
385
433
|
runOnlyForDeploymentPostprocessing = 0;
|
|
386
434
|
};
|
package/package.json
CHANGED
|
@@ -20,9 +20,10 @@ export interface IRecommendationProps {
|
|
|
20
20
|
closeCalculationCallback(): void;
|
|
21
21
|
exitCallback(): void;
|
|
22
22
|
onRecentInsulinYes(): void;
|
|
23
|
-
transferToLogbook(carbs: IResult, insulin: IResult, reminder: number): void;
|
|
23
|
+
transferToLogbook(carbs: IResult, insulin: IResult, reminder: number, recommendationDate: Date): void;
|
|
24
24
|
onError(error: RecommendationError): void;
|
|
25
25
|
showBolusBar(toggle: boolean): void;
|
|
26
|
+
restartCalculation(): void;
|
|
26
27
|
}
|
|
27
28
|
interface IState {
|
|
28
29
|
remeasureTime: number;
|
|
@@ -36,26 +37,32 @@ interface IState {
|
|
|
36
37
|
enteredCarbs?: number;
|
|
37
38
|
enteredInsulin?: number;
|
|
38
39
|
recommendationModal: boolean;
|
|
39
|
-
|
|
40
|
+
showExitModal: boolean;
|
|
41
|
+
showLimitationMessage: boolean;
|
|
42
|
+
showTimeoutModal: boolean;
|
|
40
43
|
}
|
|
41
44
|
export default class RecommendationScreen extends React.Component<IRecommendationProps, IState> {
|
|
42
45
|
private readonly timer;
|
|
43
46
|
private readonly suggestedCarbs;
|
|
44
47
|
private readonly hasError;
|
|
48
|
+
private readonly recommendationDate;
|
|
45
49
|
private scrollView;
|
|
46
50
|
constructor(props: IRecommendationProps);
|
|
47
51
|
componentWillUnmount(): void;
|
|
48
52
|
recalculateInsulin: (calculatorParams: Calculator.IRecommendationParams) => void;
|
|
49
53
|
onExit: () => void;
|
|
54
|
+
hideAttentionModal: () => void;
|
|
55
|
+
hideLimitationMessage: () => void;
|
|
56
|
+
hideExitModal: () => void;
|
|
57
|
+
hideTimeoutModal: () => void;
|
|
50
58
|
updateRemeasureTime: (remeasureTime: number) => void;
|
|
51
59
|
handleNoRecentInsulin: () => void;
|
|
52
60
|
updateCarbRecommendation: (enteredCarbs: number) => void;
|
|
53
61
|
removeCarbRecommendation: () => void;
|
|
54
62
|
declineCarbRecommendation: () => void;
|
|
55
63
|
acceptCarbRecommendation: () => void;
|
|
56
|
-
hideAttentionModal: () => void;
|
|
57
|
-
hideExitModal: () => void;
|
|
58
64
|
closeCalculation: () => void;
|
|
65
|
+
restartCalculation: () => void;
|
|
59
66
|
handleMoodSelected: (selectedMood: IState["selectedMood"]) => void;
|
|
60
67
|
updateInsulinRecommendation: (enteredInsulin: number) => void;
|
|
61
68
|
handleTransfer: () => void;
|
|
@@ -36,12 +36,13 @@ const Calculator = __importStar(require("@hedia/recommendation-calculator"));
|
|
|
36
36
|
const react_2 = require("@lingui/react");
|
|
37
37
|
const Emotion_1 = __importDefault(require("./components/mood/Emotion"));
|
|
38
38
|
const TransferToLogbook_1 = __importDefault(require("./components/TransferToLogbook"));
|
|
39
|
-
const RecommendationError_1 = require("./utils/RecommendationError");
|
|
40
39
|
const macro_1 = require("@lingui/macro");
|
|
41
40
|
const Activity_1 = __importDefault(require("./components/activity/Activity"));
|
|
42
|
-
const
|
|
41
|
+
const LimitationMessage_1 = __importDefault(require("./components/LimitationMessage"));
|
|
43
42
|
const RecommendationModal_1 = __importDefault(require("./components/RecommendationModal"));
|
|
43
|
+
const TwoOptionModal_1 = __importStar(require("./components/TwoOptionModal"));
|
|
44
44
|
const i18nUtils_1 = require("./locale/i18nUtils");
|
|
45
|
+
const AttentionMessages_1 = require("./utils/AttentionMessages");
|
|
45
46
|
const RecommendationUtils_1 = require("./utils/RecommendationUtils");
|
|
46
47
|
const Utils_1 = require("./utils/Utils");
|
|
47
48
|
const Validations_1 = require("./utils/Validations");
|
|
@@ -53,20 +54,35 @@ class RecommendationScreen extends react_1.default.Component {
|
|
|
53
54
|
super(props);
|
|
54
55
|
this.hasError = false;
|
|
55
56
|
this.recalculateInsulin = (calculatorParams) => {
|
|
56
|
-
const { bolus } = Calculator.calculateRecommendation(calculatorParams);
|
|
57
|
+
const { bolus, wasLimited, activityReduction } = Calculator.calculateRecommendation(calculatorParams);
|
|
57
58
|
this.setState({
|
|
58
59
|
insulinRecommendation: Utils_1.Utils.roundValue(bolus, this.props.injectionMethod),
|
|
59
60
|
enteredInsulin: undefined,
|
|
61
|
+
wasLimited,
|
|
62
|
+
activityReduction,
|
|
63
|
+
showLimitationMessage: wasLimited,
|
|
60
64
|
});
|
|
61
65
|
};
|
|
62
66
|
this.onExit = () => {
|
|
63
67
|
if (this.state.isRecommendationDisplayed) {
|
|
64
|
-
this.setState({
|
|
68
|
+
this.setState({ showExitModal: true }, () => this.props.showBolusBar(!this.state.showExitModal));
|
|
65
69
|
}
|
|
66
70
|
else {
|
|
67
71
|
this.props.exitCallback();
|
|
68
72
|
}
|
|
69
73
|
};
|
|
74
|
+
this.hideAttentionModal = () => {
|
|
75
|
+
this.setState({ recommendationModal: false });
|
|
76
|
+
};
|
|
77
|
+
this.hideLimitationMessage = () => {
|
|
78
|
+
this.setState({ showLimitationMessage: false });
|
|
79
|
+
};
|
|
80
|
+
this.hideExitModal = () => {
|
|
81
|
+
this.setState({ showExitModal: false }, () => this.props.showBolusBar(!this.state.showExitModal));
|
|
82
|
+
};
|
|
83
|
+
this.hideTimeoutModal = () => {
|
|
84
|
+
this.setState({ showTimeoutModal: false }, () => this.props.showBolusBar(!this.state.showTimeoutModal));
|
|
85
|
+
};
|
|
70
86
|
this.updateRemeasureTime = (remeasureTime) => {
|
|
71
87
|
this.setState({ remeasureTime });
|
|
72
88
|
};
|
|
@@ -93,16 +109,14 @@ class RecommendationScreen extends react_1.default.Component {
|
|
|
93
109
|
this.hideAttentionModal();
|
|
94
110
|
this.props.carbRecommendationAnswer(true);
|
|
95
111
|
};
|
|
96
|
-
this.hideAttentionModal = () => {
|
|
97
|
-
this.setState({ recommendationModal: false });
|
|
98
|
-
};
|
|
99
|
-
this.hideExitModal = () => {
|
|
100
|
-
this.setState({ exitModal: false }, () => this.props.showBolusBar(!this.state.exitModal));
|
|
101
|
-
};
|
|
102
112
|
this.closeCalculation = () => {
|
|
103
|
-
this.hideExitModal();
|
|
113
|
+
this.state.showExitModal ? this.hideExitModal() : this.hideTimeoutModal();
|
|
104
114
|
this.props.closeCalculationCallback();
|
|
105
115
|
};
|
|
116
|
+
this.restartCalculation = () => {
|
|
117
|
+
this.hideTimeoutModal();
|
|
118
|
+
this.props.restartCalculation();
|
|
119
|
+
};
|
|
106
120
|
this.handleMoodSelected = (selectedMood) => {
|
|
107
121
|
this.setState({ selectedMood });
|
|
108
122
|
};
|
|
@@ -110,12 +124,11 @@ class RecommendationScreen extends react_1.default.Component {
|
|
|
110
124
|
this.setState({ enteredInsulin });
|
|
111
125
|
};
|
|
112
126
|
this.handleTransfer = () => {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
this.props.transferToLogbook(carbs, insulin, this.state.remeasureTime);
|
|
127
|
+
const { enteredCarbs, enteredInsulin, insulinRecommendation, remeasureTime, showExitModal } = this.state;
|
|
128
|
+
const carbs = { suggested: this.suggestedCarbs, entered: enteredCarbs };
|
|
129
|
+
const insulin = { suggested: insulinRecommendation, entered: enteredInsulin };
|
|
130
|
+
showExitModal ? this.hideExitModal() : this.hideTimeoutModal();
|
|
131
|
+
this.props.transferToLogbook(carbs, insulin, remeasureTime, this.recommendationDate);
|
|
119
132
|
};
|
|
120
133
|
this.getBGLevelAttentionMessage = () => {
|
|
121
134
|
const { calculatorParams, latestLogbookFrom6Hours } = this.props;
|
|
@@ -136,6 +149,7 @@ class RecommendationScreen extends react_1.default.Component {
|
|
|
136
149
|
try {
|
|
137
150
|
Validations_1.validateParams(props);
|
|
138
151
|
i18nUtils_1.changeLanguage(props.language);
|
|
152
|
+
this.recommendationDate = new Date(global.Date.now());
|
|
139
153
|
const { recentBoluses } = props.calculatorParams;
|
|
140
154
|
const { bolus, carbRecommendation, activityReduction, wasLimited, activeInsulin, } = Calculator.calculateRecommendation(props.calculatorParams);
|
|
141
155
|
this.suggestedCarbs = carbRecommendation;
|
|
@@ -149,10 +163,12 @@ class RecommendationScreen extends react_1.default.Component {
|
|
|
149
163
|
activeInsulin,
|
|
150
164
|
selectedMood: null,
|
|
151
165
|
recommendationModal: wasLimited || !!Math.round(carbRecommendation) || !!this.getBGLevelAttentionMessage(),
|
|
152
|
-
|
|
166
|
+
showExitModal: false,
|
|
167
|
+
showLimitationMessage: false,
|
|
168
|
+
showTimeoutModal: false,
|
|
153
169
|
};
|
|
154
170
|
this.timer = setTimeout(() => {
|
|
155
|
-
props.
|
|
171
|
+
this.setState({ showTimeoutModal: true }, () => this.props.showBolusBar(!this.state.showTimeoutModal));
|
|
156
172
|
}, enum_1.Milliseconds.Minute * 15);
|
|
157
173
|
}
|
|
158
174
|
catch (error) {
|
|
@@ -174,28 +190,34 @@ class RecommendationScreen extends react_1.default.Component {
|
|
|
174
190
|
return (<react_2.I18nProvider language={this.props.language} i18n={i18nUtils_1.i18n}>
|
|
175
191
|
<react_native_1.ScrollView style={containerStyles.container} ref={(view) => (this.scrollView = view)}>
|
|
176
192
|
<Header_1.default exitCallback={this.onExit}/>
|
|
177
|
-
<InfoBars_1.default
|
|
193
|
+
<InfoBars_1.default label={i18nUtils_1.i18n._(macro_1.t `Active Insulin`)} value={activeInsulin ? `${activeInsulin.toFixed(1)}` : null} units={i18nUtils_1.i18n._(macro_1.t `units`)} showNullAsDash={false}/>
|
|
178
194
|
<InfoBars_1.default label={i18nUtils_1.i18n._(macro_1.t `Blood Glucose Level`)} value={currentBGL ? `${displayedBGL}` : null} units={this.props.units} showNullAsDash={true}/>
|
|
179
195
|
<react_native_1.View style={containerStyles.calcContainer}>
|
|
180
196
|
<react_native_1.View style={containerStyles.calcMargin}>
|
|
181
197
|
<react_native_1.View style={[
|
|
182
198
|
containerStyles.calcBorder,
|
|
183
199
|
{
|
|
184
|
-
borderColor: carbRecommendation
|
|
200
|
+
borderColor: Math.round(carbRecommendation)
|
|
201
|
+
? Constants_1.BORDER_COLOUR_TEAL
|
|
202
|
+
: Constants_1.BORDER_COLOUR_GREY,
|
|
185
203
|
},
|
|
186
204
|
]}>
|
|
187
205
|
<RecommendedCarbs_1.default enteredCarbs={`${carbohydrates}`} changedRecommendedCarbs={this.updateCarbRecommendation} recommendedCarbs={`${enteredCarbs ?? Math.round(carbRecommendation)}`} removeRecommendedCarbs={this.removeCarbRecommendation}/>
|
|
188
|
-
<Remeasure_1.default onSliderChange={this.updateRemeasureTime} remeasureTime={this.state.remeasureTime}/>
|
|
189
206
|
</react_native_1.View>
|
|
190
207
|
</react_native_1.View>
|
|
191
208
|
</react_native_1.View>
|
|
192
209
|
{this.props.calculatorParams.activity && this.props.activityDisplayProps ? (<Activity_1.default activity={this.props.calculatorParams.activity} activityType={this.props.activityDisplayProps.activityType} activityTitle={this.props.activityDisplayProps.activityTitle} activityReduction={this.state.activityReduction}/>) : null}
|
|
210
|
+
<Remeasure_1.default onSliderChange={this.updateRemeasureTime} remeasureTime={this.state.remeasureTime}/>
|
|
193
211
|
{!this.state.isRecommendationDisplayed ? (<RecentInsulin_1.default onRecentInsulinYes={this.props.onRecentInsulinYes} onRecentInsulinNo={this.handleNoRecentInsulin}/>) : (<RecommendedInsulin_1.default injectionMethod={this.props.injectionMethod} insulinRecommendation={insulinRecommendation} enteredInsulin={enteredInsulin} activityReduction={activityReduction} updateRecommendedInsulin={this.updateInsulinRecommendation}/>)}
|
|
194
212
|
<Emotion_1.default moodSelected={this.handleMoodSelected} currentMood={this.state.selectedMood}/>
|
|
195
213
|
<TransferToLogbook_1.default visible={isRecommendationDisplayed} transfer={this.handleTransfer}/>
|
|
196
|
-
<RecommendationModal_1.default isVisible={recommendationModal} suggestedCarbohydrates={carbRecommendation} attentionMessage={this.getBGLevelAttentionMessage()} limitationMessage={this.getLimitationAttentionMessage()} onClickOkButton={this.hideAttentionModal} onAcceptCarbohydrates={this.acceptCarbRecommendation} onDeclineCarbohydrates={this.declineCarbRecommendation}/>
|
|
214
|
+
<RecommendationModal_1.default isVisible={recommendationModal} suggestedCarbohydrates={Math.round(carbRecommendation)} attentionMessage={this.getBGLevelAttentionMessage()} limitationMessage={this.getLimitationAttentionMessage()} onClickOkButton={this.hideAttentionModal} onAcceptCarbohydrates={this.acceptCarbRecommendation} onDeclineCarbohydrates={this.declineCarbRecommendation}/>
|
|
197
215
|
</react_native_1.ScrollView>
|
|
198
|
-
{this.state.
|
|
216
|
+
{this.state.showExitModal ? (<TwoOptionModal_1.default title={i18nUtils_1.i18n._(macro_1.t `Save data before closing?`)} message={i18nUtils_1.i18n._(macro_1.t `Your saved data will be used for future calculations.`)} textFirstOption={i18nUtils_1.i18n._(macro_1.t `Save to logbook`)} textSecondOption={i18nUtils_1.i18n._(macro_1.t `Close calculation`)} isCancelable={true} rowAsButtonLayout={true} firstOption={this.handleTransfer} secondOption={this.closeCalculation} onClose={this.hideExitModal}/>) : null}
|
|
217
|
+
{this.state.showLimitationMessage ? (<react_native_1.View style={TwoOptionModal_1.modalStyle.container}>
|
|
218
|
+
<LimitationMessage_1.default limitationMessage={this.getLimitationAttentionMessage()} onPressNextButton={this.hideLimitationMessage}/>
|
|
219
|
+
</react_native_1.View>) : null}
|
|
220
|
+
{this.state.showTimeoutModal ? (this.state.isRecommendationDisplayed ? (<TwoOptionModal_1.default title={AttentionMessages_1.Messages.TimeoutPrompTitle()} message={AttentionMessages_1.Messages.TimeoutRecommendationVisible(this.recommendationDate)} textFirstOption={i18nUtils_1.i18n._(macro_1.t `Yes, save to logbook`)} textSecondOption={i18nUtils_1.i18n._(macro_1.t `No, return to dashboard`)} rowAsButtonLayout={false} firstOption={this.handleTransfer} secondOption={this.closeCalculation}/>) : (<TwoOptionModal_1.default title={AttentionMessages_1.Messages.TimeoutPrompTitle()} message={AttentionMessages_1.Messages.TimeoutRecommendationNotVisible()} textFirstOption={i18nUtils_1.i18n._(macro_1.t `Start new calculation`)} textSecondOption={i18nUtils_1.i18n._(macro_1.t `Return to dashboard`)} rowAsButtonLayout={false} firstOption={this.restartCalculation} secondOption={this.closeCalculation}/>)) : null}
|
|
199
221
|
</react_2.I18nProvider>);
|
|
200
222
|
}
|
|
201
223
|
}
|
|
@@ -210,6 +232,7 @@ const containerStyles = react_native_1.StyleSheet.create({
|
|
|
210
232
|
},
|
|
211
233
|
calcMargin: {
|
|
212
234
|
flex: 1,
|
|
235
|
+
marginBottom: 0,
|
|
213
236
|
margin: Header_1.headerStyles.margin.margin,
|
|
214
237
|
},
|
|
215
238
|
calcBorder: {
|
|
@@ -15,15 +15,16 @@ import * as Calculator from "@hedia/recommendation-calculator";
|
|
|
15
15
|
import { I18nProvider } from "@lingui/react";
|
|
16
16
|
import Emotion from "./components/mood/Emotion";
|
|
17
17
|
import TransferToLogbook from "./components/TransferToLogbook";
|
|
18
|
-
import { RecommendationError
|
|
18
|
+
import { RecommendationError } from "./utils/RecommendationError";
|
|
19
19
|
|
|
20
20
|
import { t } from "@lingui/macro";
|
|
21
21
|
import Activity from "./components/activity/Activity";
|
|
22
|
-
import
|
|
22
|
+
import LimitationMessage from "./components/LimitationMessage";
|
|
23
23
|
import RecommendationModal from "./components/RecommendationModal";
|
|
24
|
+
import TwoOptionModal, { modalStyle } from "./components/TwoOptionModal";
|
|
24
25
|
import { changeLanguage, i18n } from "./locale/i18nUtils";
|
|
25
26
|
import { IActivityDisplayProps, logbookEntry } from "./types/types";
|
|
26
|
-
import { AttentionMessage } from "./utils/AttentionMessages";
|
|
27
|
+
import { AttentionMessage, Messages } from "./utils/AttentionMessages";
|
|
27
28
|
import { getAttentionMessage, getBGLevel, getLimitationMessage, getReminder } from "./utils/RecommendationUtils";
|
|
28
29
|
import { Utils } from "./utils/Utils";
|
|
29
30
|
import { validateParams } from "./utils/Validations";
|
|
@@ -52,9 +53,10 @@ export interface IRecommendationProps {
|
|
|
52
53
|
closeCalculationCallback(): void;
|
|
53
54
|
exitCallback(): void;
|
|
54
55
|
onRecentInsulinYes(): void;
|
|
55
|
-
transferToLogbook(carbs: IResult, insulin: IResult, reminder: number): void;
|
|
56
|
+
transferToLogbook(carbs: IResult, insulin: IResult, reminder: number, recommendationDate: Date): void;
|
|
56
57
|
onError(error: RecommendationError): void;
|
|
57
58
|
showBolusBar(toggle: boolean): void;
|
|
59
|
+
restartCalculation(): void;
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
interface IState {
|
|
@@ -69,13 +71,16 @@ interface IState {
|
|
|
69
71
|
enteredCarbs?: number;
|
|
70
72
|
enteredInsulin?: number;
|
|
71
73
|
recommendationModal: boolean;
|
|
72
|
-
|
|
74
|
+
showExitModal: boolean;
|
|
75
|
+
showLimitationMessage: boolean;
|
|
76
|
+
showTimeoutModal: boolean;
|
|
73
77
|
}
|
|
74
78
|
|
|
75
79
|
export default class RecommendationScreen extends React.Component<IRecommendationProps, IState> {
|
|
76
80
|
private readonly timer: ReturnType<typeof setTimeout>;
|
|
77
81
|
private readonly suggestedCarbs: number;
|
|
78
82
|
private readonly hasError: boolean = false;
|
|
83
|
+
private readonly recommendationDate: Date;
|
|
79
84
|
private scrollView: ScrollView;
|
|
80
85
|
|
|
81
86
|
constructor(props: IRecommendationProps) {
|
|
@@ -84,7 +89,7 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
84
89
|
validateParams(props);
|
|
85
90
|
|
|
86
91
|
changeLanguage(props.language);
|
|
87
|
-
|
|
92
|
+
this.recommendationDate = new Date(global.Date.now());
|
|
88
93
|
const { recentBoluses } = props.calculatorParams;
|
|
89
94
|
const {
|
|
90
95
|
bolus,
|
|
@@ -107,11 +112,15 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
107
112
|
selectedMood: null,
|
|
108
113
|
recommendationModal:
|
|
109
114
|
wasLimited || !!Math.round(carbRecommendation) || !!this.getBGLevelAttentionMessage(),
|
|
110
|
-
|
|
115
|
+
showExitModal: false,
|
|
116
|
+
showLimitationMessage: false,
|
|
117
|
+
showTimeoutModal: false,
|
|
111
118
|
};
|
|
112
119
|
|
|
113
120
|
this.timer = setTimeout((): void => {
|
|
114
|
-
|
|
121
|
+
this.setState({ showTimeoutModal: true }, (): void =>
|
|
122
|
+
this.props.showBolusBar(!this.state.showTimeoutModal),
|
|
123
|
+
);
|
|
115
124
|
}, Milliseconds.Minute * 15);
|
|
116
125
|
} catch (error) {
|
|
117
126
|
this.hasError = true;
|
|
@@ -124,21 +133,37 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
124
133
|
}
|
|
125
134
|
|
|
126
135
|
public recalculateInsulin = (calculatorParams: Calculator.IRecommendationParams): void => {
|
|
127
|
-
const { bolus } = Calculator.calculateRecommendation(calculatorParams);
|
|
136
|
+
const { bolus, wasLimited, activityReduction } = Calculator.calculateRecommendation(calculatorParams);
|
|
128
137
|
this.setState({
|
|
129
138
|
insulinRecommendation: Utils.roundValue(bolus, this.props.injectionMethod),
|
|
130
139
|
enteredInsulin: undefined,
|
|
140
|
+
wasLimited,
|
|
141
|
+
activityReduction,
|
|
142
|
+
showLimitationMessage: wasLimited,
|
|
131
143
|
});
|
|
132
144
|
};
|
|
133
145
|
|
|
134
146
|
public onExit = (): void => {
|
|
135
147
|
if (this.state.isRecommendationDisplayed) {
|
|
136
|
-
this.setState({
|
|
148
|
+
this.setState({ showExitModal: true }, (): void => this.props.showBolusBar(!this.state.showExitModal));
|
|
137
149
|
} else {
|
|
138
150
|
this.props.exitCallback();
|
|
139
151
|
}
|
|
140
152
|
};
|
|
141
153
|
|
|
154
|
+
public hideAttentionModal = (): void => {
|
|
155
|
+
this.setState({ recommendationModal: false });
|
|
156
|
+
};
|
|
157
|
+
public hideLimitationMessage = (): void => {
|
|
158
|
+
this.setState({ showLimitationMessage: false });
|
|
159
|
+
};
|
|
160
|
+
public hideExitModal = (): void => {
|
|
161
|
+
this.setState({ showExitModal: false }, (): void => this.props.showBolusBar(!this.state.showExitModal));
|
|
162
|
+
};
|
|
163
|
+
public hideTimeoutModal = (): void => {
|
|
164
|
+
this.setState({ showTimeoutModal: false }, (): void => this.props.showBolusBar(!this.state.showTimeoutModal));
|
|
165
|
+
};
|
|
166
|
+
|
|
142
167
|
public updateRemeasureTime = (remeasureTime: number): void => {
|
|
143
168
|
this.setState({ remeasureTime });
|
|
144
169
|
};
|
|
@@ -173,17 +198,15 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
173
198
|
this.hideAttentionModal();
|
|
174
199
|
this.props.carbRecommendationAnswer(true);
|
|
175
200
|
};
|
|
176
|
-
public hideAttentionModal = (): void => {
|
|
177
|
-
this.setState({ recommendationModal: false });
|
|
178
|
-
};
|
|
179
201
|
|
|
180
|
-
public hideExitModal = (): void => {
|
|
181
|
-
this.setState({ exitModal: false }, (): void => this.props.showBolusBar(!this.state.exitModal));
|
|
182
|
-
};
|
|
183
202
|
public closeCalculation = (): void => {
|
|
184
|
-
this.hideExitModal();
|
|
203
|
+
this.state.showExitModal ? this.hideExitModal() : this.hideTimeoutModal();
|
|
185
204
|
this.props.closeCalculationCallback();
|
|
186
205
|
};
|
|
206
|
+
public restartCalculation = (): void => {
|
|
207
|
+
this.hideTimeoutModal();
|
|
208
|
+
this.props.restartCalculation();
|
|
209
|
+
};
|
|
187
210
|
|
|
188
211
|
public handleMoodSelected = (selectedMood: IState["selectedMood"]): void => {
|
|
189
212
|
this.setState({ selectedMood });
|
|
@@ -194,12 +217,12 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
194
217
|
};
|
|
195
218
|
|
|
196
219
|
public handleTransfer = (): void => {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
this.props.transferToLogbook(carbs, insulin, this.
|
|
220
|
+
const { enteredCarbs, enteredInsulin, insulinRecommendation, remeasureTime, showExitModal } = this.state;
|
|
221
|
+
const carbs: IResult = { suggested: this.suggestedCarbs, entered: enteredCarbs };
|
|
222
|
+
const insulin: IResult = { suggested: insulinRecommendation, entered: enteredInsulin };
|
|
223
|
+
|
|
224
|
+
showExitModal ? this.hideExitModal() : this.hideTimeoutModal();
|
|
225
|
+
this.props.transferToLogbook(carbs, insulin, remeasureTime, this.recommendationDate);
|
|
203
226
|
};
|
|
204
227
|
|
|
205
228
|
public getBGLevelAttentionMessage = (): AttentionMessage => {
|
|
@@ -215,6 +238,7 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
215
238
|
const bgLevel = getBGLevel(currentBGL, latestLogbookFrom6Hours);
|
|
216
239
|
return getReminder(bgLevel, carbohydrates, userReminder, activity);
|
|
217
240
|
};
|
|
241
|
+
|
|
218
242
|
public getLimitationAttentionMessage = (): AttentionMessage => {
|
|
219
243
|
const { wasLimited, activityReduction } = this.state;
|
|
220
244
|
return getLimitationMessage(wasLimited, activityReduction);
|
|
@@ -244,7 +268,6 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
244
268
|
<ScrollView style={containerStyles.container} ref={(view): ScrollView => (this.scrollView = view)}>
|
|
245
269
|
<Header exitCallback={this.onExit} />
|
|
246
270
|
<InfoBars
|
|
247
|
-
style={{ flex: 5 }}
|
|
248
271
|
label={i18n._(t`Active Insulin`)}
|
|
249
272
|
value={activeInsulin ? `${activeInsulin.toFixed(1)}` : null}
|
|
250
273
|
units={i18n._(t`units`)}
|
|
@@ -262,7 +285,9 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
262
285
|
style={[
|
|
263
286
|
containerStyles.calcBorder,
|
|
264
287
|
{
|
|
265
|
-
borderColor: carbRecommendation
|
|
288
|
+
borderColor: Math.round(carbRecommendation)
|
|
289
|
+
? BORDER_COLOUR_TEAL
|
|
290
|
+
: BORDER_COLOUR_GREY,
|
|
266
291
|
},
|
|
267
292
|
]}
|
|
268
293
|
>
|
|
@@ -272,10 +297,6 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
272
297
|
recommendedCarbs={`${enteredCarbs ?? Math.round(carbRecommendation)}`}
|
|
273
298
|
removeRecommendedCarbs={this.removeCarbRecommendation}
|
|
274
299
|
/>
|
|
275
|
-
<Remeasure
|
|
276
|
-
onSliderChange={this.updateRemeasureTime}
|
|
277
|
-
remeasureTime={this.state.remeasureTime}
|
|
278
|
-
/>
|
|
279
300
|
</View>
|
|
280
301
|
</View>
|
|
281
302
|
</View>
|
|
@@ -287,6 +308,7 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
287
308
|
activityReduction={this.state.activityReduction}
|
|
288
309
|
/>
|
|
289
310
|
) : null}
|
|
311
|
+
<Remeasure onSliderChange={this.updateRemeasureTime} remeasureTime={this.state.remeasureTime} />
|
|
290
312
|
{!this.state.isRecommendationDisplayed ? (
|
|
291
313
|
<RecentInsulin
|
|
292
314
|
onRecentInsulinYes={this.props.onRecentInsulinYes}
|
|
@@ -305,7 +327,7 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
305
327
|
<TransferToLogbook visible={isRecommendationDisplayed} transfer={this.handleTransfer} />
|
|
306
328
|
<RecommendationModal
|
|
307
329
|
isVisible={recommendationModal}
|
|
308
|
-
suggestedCarbohydrates={carbRecommendation}
|
|
330
|
+
suggestedCarbohydrates={Math.round(carbRecommendation)}
|
|
309
331
|
attentionMessage={this.getBGLevelAttentionMessage()}
|
|
310
332
|
limitationMessage={this.getLimitationAttentionMessage()}
|
|
311
333
|
onClickOkButton={this.hideAttentionModal}
|
|
@@ -313,13 +335,50 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
313
335
|
onDeclineCarbohydrates={this.declineCarbRecommendation}
|
|
314
336
|
/>
|
|
315
337
|
</ScrollView>
|
|
316
|
-
{this.state.
|
|
317
|
-
<
|
|
318
|
-
|
|
319
|
-
|
|
338
|
+
{this.state.showExitModal ? (
|
|
339
|
+
<TwoOptionModal
|
|
340
|
+
title={i18n._(t`Save data before closing?`)}
|
|
341
|
+
message={i18n._(t`Your saved data will be used for future calculations.`)}
|
|
342
|
+
textFirstOption={i18n._(t`Save to logbook`)}
|
|
343
|
+
textSecondOption={i18n._(t`Close calculation`)}
|
|
344
|
+
isCancelable={true}
|
|
345
|
+
rowAsButtonLayout={true}
|
|
346
|
+
firstOption={this.handleTransfer}
|
|
347
|
+
secondOption={this.closeCalculation}
|
|
320
348
|
onClose={this.hideExitModal}
|
|
321
349
|
/>
|
|
322
350
|
) : null}
|
|
351
|
+
{this.state.showLimitationMessage ? (
|
|
352
|
+
<View style={modalStyle.container}>
|
|
353
|
+
<LimitationMessage
|
|
354
|
+
limitationMessage={this.getLimitationAttentionMessage()}
|
|
355
|
+
onPressNextButton={this.hideLimitationMessage}
|
|
356
|
+
/>
|
|
357
|
+
</View>
|
|
358
|
+
) : null}
|
|
359
|
+
{this.state.showTimeoutModal ? (
|
|
360
|
+
this.state.isRecommendationDisplayed ? (
|
|
361
|
+
<TwoOptionModal
|
|
362
|
+
title={Messages.TimeoutPrompTitle()}
|
|
363
|
+
message={Messages.TimeoutRecommendationVisible(this.recommendationDate)}
|
|
364
|
+
textFirstOption={i18n._(t`Yes, save to logbook`)}
|
|
365
|
+
textSecondOption={i18n._(t`No, return to dashboard`)}
|
|
366
|
+
rowAsButtonLayout={false}
|
|
367
|
+
firstOption={this.handleTransfer}
|
|
368
|
+
secondOption={this.closeCalculation}
|
|
369
|
+
/>
|
|
370
|
+
) : (
|
|
371
|
+
<TwoOptionModal
|
|
372
|
+
title={Messages.TimeoutPrompTitle()}
|
|
373
|
+
message={Messages.TimeoutRecommendationNotVisible()}
|
|
374
|
+
textFirstOption={i18n._(t`Start new calculation`)}
|
|
375
|
+
textSecondOption={i18n._(t`Return to dashboard`)}
|
|
376
|
+
rowAsButtonLayout={false}
|
|
377
|
+
firstOption={this.restartCalculation}
|
|
378
|
+
secondOption={this.closeCalculation}
|
|
379
|
+
/>
|
|
380
|
+
)
|
|
381
|
+
) : null}
|
|
323
382
|
</I18nProvider>
|
|
324
383
|
);
|
|
325
384
|
}
|
|
@@ -335,6 +394,7 @@ const containerStyles = StyleSheet.create({
|
|
|
335
394
|
},
|
|
336
395
|
calcMargin: {
|
|
337
396
|
flex: 1,
|
|
397
|
+
marginBottom: 0,
|
|
338
398
|
margin: headerStyles.margin.margin,
|
|
339
399
|
},
|
|
340
400
|
calcBorder: {
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { StyleProp, ViewStyle } from "react-native";
|
|
3
2
|
export interface IProps {
|
|
4
3
|
label: string;
|
|
5
4
|
value?: string;
|
|
6
5
|
units: string;
|
|
7
6
|
showNullAsDash: boolean;
|
|
8
|
-
style?: StyleProp<ViewStyle>;
|
|
9
7
|
}
|
|
10
8
|
export default class InfoBars extends React.Component<IProps> {
|
|
11
9
|
render(): JSX.Element;
|
|
@@ -23,13 +21,13 @@ export declare const infoStyles: {
|
|
|
23
21
|
borderWidth: number;
|
|
24
22
|
borderColor: string;
|
|
25
23
|
borderRadius: number;
|
|
24
|
+
paddingVertical: string;
|
|
26
25
|
};
|
|
27
26
|
borderContainer: {
|
|
28
27
|
flex: number;
|
|
29
28
|
flexDirection: "row";
|
|
30
29
|
justifyContent: "space-between";
|
|
31
|
-
|
|
32
|
-
paddingRight: string;
|
|
30
|
+
paddingHorizontal: string;
|
|
33
31
|
};
|
|
34
32
|
labelContainer: {
|
|
35
33
|
flex: number;
|