@hedia/recommendation-screen 2.1.1 → 2.1.3-beta.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/coverage/clover.xml +378 -367
- package/coverage/coverage-final.json +18 -18
- package/coverage/lcov-report/index.html +15 -15
- package/coverage/lcov-report/src/RecommendationScreen.tsx.html +112 -67
- package/coverage/lcov-report/src/__tests__/index.html +1 -1
- package/coverage/lcov-report/src/__tests__/utils.tsx.html +11 -11
- package/coverage/lcov-report/src/components/Header.tsx.html +2 -2
- package/coverage/lcov-report/src/components/InfoBars.tsx.html +49 -19
- package/coverage/lcov-report/src/components/InvisibleNumberInput.tsx.html +1 -1
- package/coverage/lcov-report/src/components/LimitationMessage.tsx.html +1 -1
- package/coverage/lcov-report/src/components/LineSeparator.tsx.html +2 -2
- package/coverage/lcov-report/src/components/RecentInsulin.tsx.html +1 -1
- package/coverage/lcov-report/src/components/RecommendationModal.tsx.html +17 -17
- package/coverage/lcov-report/src/components/RecommendedCarbs.tsx.html +13 -13
- package/coverage/lcov-report/src/components/RecommendedInsulin.tsx.html +11 -11
- package/coverage/lcov-report/src/components/Remeasure.tsx.html +12 -12
- package/coverage/lcov-report/src/components/TransferToLogbook.tsx.html +5 -5
- package/coverage/lcov-report/src/components/TwoOptionModal.tsx.html +1 -1
- package/coverage/lcov-report/src/components/activity/Activity.tsx.html +1 -1
- package/coverage/lcov-report/src/components/activity/ActivityIcon.tsx.html +1 -1
- package/coverage/lcov-report/src/components/activity/ActivityIntensity.tsx.html +1 -1
- package/coverage/lcov-report/src/components/activity/index.html +1 -1
- package/coverage/lcov-report/src/components/index.html +7 -7
- package/coverage/lcov-report/src/components/mood/Emotion.tsx.html +8 -8
- package/coverage/lcov-report/src/components/mood/MoodIcon.tsx.html +8 -8
- package/coverage/lcov-report/src/components/mood/index.html +1 -1
- package/coverage/lcov-report/src/index.html +7 -7
- package/coverage/lcov-report/src/locale/i18nUtils.ts.html +5 -5
- package/coverage/lcov-report/src/locale/index.html +1 -1
- package/coverage/lcov-report/src/utils/AttentionMessages.tsx.html +5 -5
- package/coverage/lcov-report/src/utils/Constants.ts.html +1 -1
- package/coverage/lcov-report/src/utils/RecommendationError.tsx.html +41 -8
- package/coverage/lcov-report/src/utils/RecommendationUtils.ts.html +33 -33
- package/coverage/lcov-report/src/utils/Translations.ts.html +1 -1
- package/coverage/lcov-report/src/utils/Utils.ts.html +23 -17
- package/coverage/lcov-report/src/utils/Validations.ts.html +77 -50
- package/coverage/lcov-report/src/utils/index.html +12 -12
- package/coverage/lcov.info +821 -794
- package/ios/Podfile.lock +1 -1
- package/package.json +6 -5
- package/src/RecommendationScreen.d.ts +2 -2
- package/src/{RecommendationScreen.jsx → RecommendationScreen.js} +35 -38
- package/src/__tests__/{RecommendationScreen.test.jsx → RecommendationScreen.test.js} +94 -75
- package/src/__tests__/Validations.test.js +18 -0
- package/src/__tests__/components/{Activity.test.jsx → Activity.test.js} +7 -8
- package/src/__tests__/components/{Emotion.test.jsx → Emotion.test.js} +5 -5
- package/src/__tests__/components/{Header.test.jsx → Header.test.js} +3 -4
- package/src/__tests__/components/{InfoBars.test.jsx → InfoBars.test.js} +8 -8
- package/src/__tests__/components/{InvisibleNumberInput.test.jsx → InvisibleNumberInput.test.js} +8 -8
- package/src/__tests__/components/{LimitationMessage.test.jsx → LimitationMessage.test.js} +4 -4
- package/src/__tests__/components/{MoodIcon.test.jsx → MoodIcon.test.js} +2 -2
- package/src/__tests__/components/{RecommendationModal.test.jsx → RecommendationModal.test.js} +8 -9
- package/src/__tests__/components/{RecommendedCarbs.test.jsx → RecommendedCarbs.test.js} +12 -12
- package/src/__tests__/components/{RecommendedInsulin.test.jsx → RecommendedInsulin.test.js} +10 -10
- package/src/__tests__/components/{Remeasure.test.jsx → Remeasure.test.js} +7 -7
- package/src/__tests__/components/{TransferToLogbook.test.jsx → TransferToLogbook.test.js} +3 -3
- package/src/__tests__/components/{TwoOptionModal.test.jsx → TwoOptionModal.test.js} +3 -3
- package/src/__tests__/{utils.jsx → utils.js} +1 -3
- package/src/components/Header.js +71 -0
- package/src/components/{Icon.jsx → Icon.js} +1 -1
- package/src/components/InfoBars.d.ts +7 -2
- package/src/components/{InfoBars.jsx → InfoBars.js} +16 -20
- package/src/components/{InvisibleNumberInput.jsx → InvisibleNumberInput.js} +5 -5
- package/src/components/{LimitationMessage.jsx → LimitationMessage.js} +8 -13
- package/src/components/{LineSeparator.jsx → LineSeparator.js} +2 -3
- package/src/components/{RecentInsulin.jsx → RecentInsulin.js} +12 -20
- package/src/components/{RecommendationModal.jsx → RecommendationModal.js} +29 -50
- package/src/components/RecommendedCarbs.js +176 -0
- package/src/components/{RecommendedInsulin.jsx → RecommendedInsulin.js} +11 -21
- package/src/components/{Remeasure.jsx → Remeasure.js} +14 -20
- package/src/components/{TransferToLogbook.jsx → TransferToLogbook.js} +5 -9
- package/src/components/{TwoOptionModal.jsx → TwoOptionModal.js} +13 -27
- package/src/components/activity/Activity.js +60 -0
- package/src/components/activity/{ActivityIcon.jsx → ActivityIcon.js} +3 -4
- package/src/components/activity/{ActivityIntensity.jsx → ActivityIntensity.js} +5 -8
- package/src/components/mood/{Emotion.jsx → Emotion.js} +5 -7
- package/src/components/mood/{MoodIcon.jsx → MoodIcon.js} +2 -3
- package/src/locale/da/messages.js +1 -1
- package/src/locale/da/messages.po +31 -27
- package/src/locale/de/messages.js +1 -1
- package/src/locale/de/messages.po +31 -27
- package/src/locale/en/messages.js +1 -1
- package/src/locale/en/messages.po +31 -27
- package/src/locale/es/messages.js +1 -1
- package/src/locale/es/messages.po +31 -27
- package/src/locale/fr/messages.js +1 -1
- package/src/locale/fr/messages.po +31 -27
- package/src/locale/it/messages.js +1 -1
- package/src/locale/it/messages.po +31 -27
- package/src/types/enum.d.ts +20 -2
- package/src/types/enum.js +23 -1
- package/src/utils/RecommendationError.d.ts +1 -0
- package/src/utils/{RecommendationError.jsx → RecommendationError.js} +3 -1
- package/src/utils/RecommendationUtils.d.ts +1 -1
- package/src/utils/Utils.d.ts +2 -2
- package/src/utils/Utils.js +2 -2
- package/src/utils/Validations.d.ts +4 -3
- package/src/utils/Validations.js +13 -4
- package/tsconfig.json +1 -1
- package/src/components/Header.jsx +0 -80
- package/src/components/RecommendedCarbs.jsx +0 -200
- package/src/components/activity/Activity.jsx +0 -72
- /package/src/__tests__/{Translate.test.jsx → Translate.test.js} +0 -0
- /package/src/utils/{AttentionMessages.jsx → AttentionMessages.js} +0 -0
package/ios/Podfile.lock
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hedia/recommendation-screen",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.3-beta.0",
|
|
4
4
|
"description": "Hedia Recommendation Screen for Bolus and Carbohydrates",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"prepublish": "npm run lint && npm run lint-pkg && npm run test-coverage && npm run tsc",
|
|
19
19
|
"add-locale": "lingui add-locale",
|
|
20
20
|
"extract": "lingui extract",
|
|
21
|
+
"extract-clean": "lingui extract --clean",
|
|
21
22
|
"compile": "npm run cleanLanguage && lingui compile",
|
|
22
|
-
"cleanLanguage": "node ./src/locale/CleanLanguage.ts"
|
|
23
|
-
"upgrade": "npm i --save-exact @hedia/types@latest @hedia/recommendation-calculator@latest"
|
|
23
|
+
"cleanLanguage": "node ./src/locale/CleanLanguage.ts"
|
|
24
24
|
},
|
|
25
25
|
"keywords": [
|
|
26
26
|
"Hedia",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@babel/core": "7.10.3",
|
|
37
37
|
"@babel/plugin-proposal-decorators": "7.8.3",
|
|
38
|
+
"@babel/plugin-transform-typescript": "7.13.0",
|
|
38
39
|
"@babel/preset-env": "7.10.2",
|
|
39
40
|
"@babel/preset-react": "7.10.1",
|
|
40
41
|
"@babel/preset-typescript": "7.10.1",
|
|
41
|
-
"@hedia/recommendation-calculator": "2.0.
|
|
42
|
-
"@hedia/types": "2.1.9",
|
|
42
|
+
"@hedia/recommendation-calculator": "2.0.3",
|
|
43
43
|
"@lingui/babel-preset-react": "2.9.1",
|
|
44
44
|
"@lingui/cli": "2.9.1",
|
|
45
45
|
"@lingui/macro": "2.9.1",
|
|
@@ -71,6 +71,7 @@
|
|
|
71
71
|
"typescript": "4.1.5"
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
+
"@hedia/types": "2.1.14",
|
|
74
75
|
"moment": "2.27.0",
|
|
75
76
|
"react-native-modal": "11.5.6"
|
|
76
77
|
}
|
|
@@ -13,8 +13,8 @@ export interface IRecommendationProps {
|
|
|
13
13
|
userReminder: number;
|
|
14
14
|
calculatorParams: IRecommendationParams;
|
|
15
15
|
injectionMethod: UserSettings.Enums.InjectionMethod;
|
|
16
|
-
currentBKL: number;
|
|
17
|
-
bloodKetoneUnit: BloodKetonesUnit;
|
|
16
|
+
currentBKL: number | null;
|
|
17
|
+
bloodKetoneUnit: BloodKetonesUnit | null;
|
|
18
18
|
latestLogbookFrom6Hours: logbookEntry | null;
|
|
19
19
|
activityDisplayProps: IActivityDisplayProps | null;
|
|
20
20
|
carbRecommendationAnswer(carbRecommendationAnswer: boolean): void;
|
|
@@ -42,6 +42,7 @@ const LimitationMessage_1 = __importDefault(require("./components/LimitationMess
|
|
|
42
42
|
const RecommendationModal_1 = __importDefault(require("./components/RecommendationModal"));
|
|
43
43
|
const TwoOptionModal_1 = __importStar(require("./components/TwoOptionModal"));
|
|
44
44
|
const i18nUtils_1 = require("./locale/i18nUtils");
|
|
45
|
+
const enum_1 = require("./types/enum");
|
|
45
46
|
const AttentionMessages_1 = require("./utils/AttentionMessages");
|
|
46
47
|
const RecommendationUtils_1 = require("./utils/RecommendationUtils");
|
|
47
48
|
const Utils_1 = require("./utils/Utils");
|
|
@@ -199,50 +200,46 @@ class RecommendationScreen extends react_1.default.Component {
|
|
|
199
200
|
}
|
|
200
201
|
render() {
|
|
201
202
|
if (this.hasError) {
|
|
202
|
-
return
|
|
203
|
+
return react_1.default.createElement(react_native_1.View, { style: containerStyles.container });
|
|
203
204
|
}
|
|
204
205
|
const { activeInsulin, recommendationModal, carbRecommendation: carbRecommendationProp, enteredCarbs, enteredInsulin, insulinRecommendation, activityReduction, isRecommendationDisplayed, } = this.state;
|
|
206
|
+
const { BloodGlucose: BGValueTestID, BloodKetone: BKValueTestID, ActiveInsulin: ActiveInsulinValueTestID, } = enum_1.InfoBarTestIds.Value;
|
|
207
|
+
const { ActiveInsulin: ActiveInsulinUnitTestID, BloodGlucose: BGUnitTestID, BloodKetone: BKUnitTestID, } = enum_1.InfoBarTestIds.Unit;
|
|
205
208
|
const carbRecommendation = carbRecommendationProp !== null ? Math.round(carbRecommendationProp) : null;
|
|
206
209
|
const recommendedCarbs = enteredCarbs ?? carbRecommendation;
|
|
207
210
|
const { calculatorParams, bloodGlucoseUnit, currentBKL, bloodKetoneUnit } = this.props;
|
|
208
211
|
const { currentBGL, carbohydrates: providedCarbs } = calculatorParams;
|
|
209
|
-
const displayedBGL = Utils_1.Utils.displayedBGLValue(currentBGL, bloodGlucoseUnit);
|
|
210
|
-
const displayedBKL = Utils_1.Utils.displayedBKLValue(currentBKL, bloodKetoneUnit);
|
|
211
|
-
return (
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
{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}
|
|
241
|
-
{this.state.showLimitationMessage ? (<react_native_1.View style={TwoOptionModal_1.modalStyle.container}>
|
|
242
|
-
<LimitationMessage_1.default limitationMessage={this.getLimitationAttentionMessage()} onPressNextButton={this.hideLimitationMessage}/>
|
|
243
|
-
</react_native_1.View>) : null}
|
|
244
|
-
{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}
|
|
245
|
-
</react_2.I18nProvider>);
|
|
212
|
+
const displayedBGL = currentBGL ? Utils_1.Utils.displayedBGLValue(currentBGL, bloodGlucoseUnit) : null;
|
|
213
|
+
const displayedBKL = currentBKL !== null && bloodKetoneUnit ? Utils_1.Utils.displayedBKLValue(currentBKL, bloodKetoneUnit) : null;
|
|
214
|
+
return (react_1.default.createElement(react_2.I18nProvider, { language: this.props.language, i18n: i18nUtils_1.i18n },
|
|
215
|
+
react_1.default.createElement(react_native_1.ScrollView, { style: containerStyles.container, ref: (view) => {
|
|
216
|
+
if (view !== null) {
|
|
217
|
+
this.scrollView = view;
|
|
218
|
+
}
|
|
219
|
+
} },
|
|
220
|
+
react_1.default.createElement(Header_1.default, { exitCallback: this.onExit }),
|
|
221
|
+
react_1.default.createElement(InfoBars_1.default, { label: i18nUtils_1.i18n._(macro_1.t `Active Insulin`), value: activeInsulin ? `${activeInsulin.toFixed(1)}` : null, unit: i18nUtils_1.i18n._(macro_1.t `units`), showNullAsDash: false, testID: { unitID: ActiveInsulinUnitTestID, valueID: ActiveInsulinValueTestID } }),
|
|
222
|
+
react_1.default.createElement(InfoBars_1.default, { label: i18nUtils_1.i18n._(macro_1.t `Blood Glucose Level`), value: displayedBGL, unit: this.props.bloodGlucoseUnit, showNullAsDash: true, testID: { unitID: BGUnitTestID, valueID: BGValueTestID } }),
|
|
223
|
+
react_1.default.createElement(InfoBars_1.default, { label: i18nUtils_1.i18n._(macro_1.t `Blood Ketone Level`), value: displayedBKL, unit: this.props.bloodKetoneUnit, showNullAsDash: true, testID: { unitID: BKUnitTestID, valueID: BKValueTestID } }),
|
|
224
|
+
react_1.default.createElement(react_native_1.View, { style: containerStyles.calcContainer },
|
|
225
|
+
react_1.default.createElement(react_native_1.View, { style: containerStyles.calcMargin },
|
|
226
|
+
react_1.default.createElement(react_native_1.View, { style: [
|
|
227
|
+
containerStyles.calcBorder,
|
|
228
|
+
{
|
|
229
|
+
borderColor: recommendedCarbs ? Constants_1.BORDER_COLOUR_TEAL : Constants_1.BORDER_COLOUR_GREY,
|
|
230
|
+
},
|
|
231
|
+
] },
|
|
232
|
+
react_1.default.createElement(RecommendedCarbs_1.default, { enteredCarbs: `${providedCarbs}`, changedRecommendedCarbs: this.updateCarbRecommendation, recommendedCarbs: `${recommendedCarbs}`, removeRecommendedCarbs: this.removeCarbRecommendation })))),
|
|
233
|
+
this.props.calculatorParams.activity && this.props.activityDisplayProps ? (react_1.default.createElement(Activity_1.default, { activity: this.props.calculatorParams.activity, activityType: this.props.activityDisplayProps.activityType, activityTitle: this.props.activityDisplayProps.activityTitle, activityReduction: this.state.activityReduction })) : null,
|
|
234
|
+
react_1.default.createElement(Remeasure_1.default, { onSliderChange: this.updateRemeasureTime, remeasureTime: this.state.remeasureTime }),
|
|
235
|
+
!this.state.isRecommendationDisplayed ? (react_1.default.createElement(RecentInsulin_1.default, { onRecentInsulinYes: this.props.onRecentInsulinYes, onRecentInsulinNo: this.handleNoRecentInsulin })) : (react_1.default.createElement(RecommendedInsulin_1.default, { injectionMethod: this.props.injectionMethod, insulinRecommendation: insulinRecommendation, enteredInsulin: enteredInsulin, activityReduction: activityReduction, updateRecommendedInsulin: this.updateInsulinRecommendation })),
|
|
236
|
+
react_1.default.createElement(Emotion_1.default, { moodSelected: this.handleMoodSelected, currentMood: this.state.selectedMood }),
|
|
237
|
+
react_1.default.createElement(TransferToLogbook_1.default, { visible: isRecommendationDisplayed, transfer: this.handleTransfer }),
|
|
238
|
+
react_1.default.createElement(RecommendationModal_1.default, { isVisible: recommendationModal, suggestedCarbohydrates: carbRecommendationProp, attentionMessage: this.getBGLevelAttentionMessage(), limitationMessage: this.getLimitationAttentionMessage(), onClickOkButton: this.hideAttentionModal, onAcceptCarbohydrates: this.acceptCarbRecommendation, onDeclineCarbohydrates: this.declineCarbRecommendation })),
|
|
239
|
+
this.state.showExitModal ? (react_1.default.createElement(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,
|
|
240
|
+
this.state.showLimitationMessage ? (react_1.default.createElement(react_native_1.View, { style: TwoOptionModal_1.modalStyle.container },
|
|
241
|
+
react_1.default.createElement(LimitationMessage_1.default, { limitationMessage: this.getLimitationAttentionMessage(), onPressNextButton: this.hideLimitationMessage }))) : null,
|
|
242
|
+
this.state.showTimeoutModal ? (this.state.isRecommendationDisplayed ? (react_1.default.createElement(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 })) : (react_1.default.createElement(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));
|
|
246
243
|
}
|
|
247
244
|
}
|
|
248
245
|
exports.default = RecommendationScreen;
|