@hedia/recommendation-screen 2.1.75 → 2.2.0-alpha.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/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/{lib/typescript → dist/src}/RecommendationScreen.d.ts +68 -82
- package/dist/src/RecommendationScreen.js +522 -0
- package/dist/src/assets/assets/activity/Cyclist.png +0 -0
- package/dist/src/assets/assets/activity/Other.png +0 -0
- package/dist/src/assets/assets/activity/Runner.png +0 -0
- package/dist/src/assets/assets/activity/Swimmer.png +0 -0
- package/dist/src/assets/assets/activity/Walk.png +0 -0
- package/dist/src/assets/assets/fonts/Poppins-Bold.ttf +0 -0
- package/dist/src/assets/assets/fonts/Poppins-SemiBold.ttf +0 -0
- package/dist/src/assets/assets/icons/Edit.tsx +22 -0
- package/dist/src/assets/assets/icons/X.tsx +14 -0
- package/dist/src/assets/assets/mood/happy.png +0 -0
- package/dist/src/assets/assets/mood/happy_active.png +0 -0
- package/dist/src/assets/assets/mood/neutral.png +0 -0
- package/dist/src/assets/assets/mood/neutral_active.png +0 -0
- package/dist/src/assets/assets/mood/sad.png +0 -0
- package/dist/src/assets/assets/mood/sad_active.png +0 -0
- package/dist/src/assets/assets/mood/semi_happy.png +0 -0
- package/dist/src/assets/assets/mood/semi_happy_active.png +0 -0
- package/dist/src/assets/assets/mood/semi_sad.png +0 -0
- package/dist/src/assets/assets/mood/semi_sad_active.png +0 -0
- package/dist/src/assets/icons/Edit.d.ts +4 -0
- package/dist/src/assets/icons/Edit.js +7 -0
- package/dist/src/assets/icons/X.d.ts +4 -0
- package/dist/src/assets/icons/X.js +6 -0
- package/dist/src/components/ForecastInfoBar.d.ts +109 -0
- package/dist/src/components/ForecastInfoBar.js +138 -0
- package/dist/src/components/Header.d.ts +8 -0
- package/dist/src/components/Header.js +54 -0
- package/dist/src/components/Icon.d.ts +20 -0
- package/dist/src/components/Icon.js +43 -0
- package/{lib/typescript → dist/src}/components/InfoBars.d.ts +28 -14
- package/dist/src/components/InfoBars.js +128 -0
- package/{lib/typescript → dist/src}/components/InvisibleNumberInput.d.ts +3 -9
- package/dist/src/components/InvisibleNumberInput.js +121 -0
- package/dist/src/components/LimitationMessage.d.ts +14 -0
- package/dist/src/components/LimitationMessage.js +30 -0
- package/{lib/typescript → dist/src}/components/LineSeparator.d.ts +1 -6
- package/dist/src/components/LineSeparator.js +18 -0
- package/{lib/typescript → dist/src}/components/RecentInsulin.d.ts +1 -3
- package/dist/src/components/RecentInsulin.js +73 -0
- package/{lib/typescript → dist/src}/components/RecommendationModal.d.ts +63 -63
- package/dist/src/components/RecommendationModal.js +226 -0
- package/{lib/typescript → dist/src}/components/RecommendedCarbs.d.ts +0 -3
- package/dist/src/components/RecommendedCarbs.js +251 -0
- package/{lib/typescript → dist/src}/components/RecommendedInsulin.d.ts +1 -2
- package/dist/src/components/RecommendedInsulin.js +180 -0
- package/{lib/typescript → dist/src}/components/Remeasure.d.ts +15 -6
- package/dist/src/components/Remeasure.js +130 -0
- package/{lib/typescript/components/TransferToLogbook.d.ts → dist/src/components/SaveButton.d.ts} +2 -3
- package/dist/src/components/SaveButton.js +71 -0
- package/dist/src/components/TwoOptionModal.d.ts +136 -0
- package/dist/src/components/TwoOptionModal.js +141 -0
- package/{lib/typescript → dist/src}/components/activity/Activity.d.ts +2 -3
- package/dist/src/components/activity/Activity.js +84 -0
- package/{lib/typescript → dist/src}/components/activity/ActivityIcon.d.ts +7 -8
- package/dist/src/components/activity/ActivityIcon.js +58 -0
- package/{lib/typescript → dist/src}/components/activity/ActivityIntensity.d.ts +1 -2
- package/dist/src/components/activity/ActivityIntensity.js +58 -0
- package/{lib/typescript → dist/src}/components/mood/Emotion.d.ts +1 -2
- package/dist/src/components/mood/Emotion.js +64 -0
- package/{lib/typescript → dist/src}/components/mood/MoodIcon.d.ts +5 -5
- package/dist/src/components/mood/MoodIcon.js +63 -0
- package/dist/src/components/text/TextBold.d.ts +8 -0
- package/dist/src/components/text/TextBold.js +12 -0
- package/dist/src/components/text/TextRegular.d.ts +8 -0
- package/dist/src/components/text/TextRegular.js +12 -0
- package/dist/src/locale/da/messages.js +1 -0
- package/dist/src/locale/da/messages.po +353 -0
- package/dist/src/locale/de/messages.js +1 -0
- package/dist/src/locale/de/messages.po +353 -0
- package/dist/src/locale/en/messages.js +1 -0
- package/dist/src/locale/en/messages.po +353 -0
- package/dist/src/locale/es/messages.js +1 -0
- package/dist/src/locale/es/messages.po +353 -0
- package/dist/src/locale/fr/messages.js +1 -0
- package/dist/src/locale/fr/messages.po +353 -0
- package/dist/src/locale/i18nUtils.d.ts +18 -0
- package/dist/src/locale/i18nUtils.js +39 -0
- package/dist/src/locale/it/messages.js +1 -0
- package/dist/src/locale/it/messages.po +353 -0
- package/{lib/typescript → dist/src}/types/enum.d.ts +15 -22
- package/dist/src/types/enum.js +145 -0
- package/{lib/typescript → dist/src}/types/types.d.ts +0 -1
- package/dist/src/types/types.js +1 -0
- package/{lib/typescript → dist/src}/utils/AttentionMessages.d.ts +0 -1
- package/dist/src/utils/AttentionMessages.js +118 -0
- package/{lib/typescript → dist/src}/utils/Constants.d.ts +3 -18
- package/{lib/module → dist/src}/utils/Constants.js +21 -79
- package/{lib/typescript → dist/src}/utils/RecommendationError.d.ts +0 -1
- package/dist/src/utils/RecommendationError.js +63 -0
- package/{lib/typescript → dist/src}/utils/RecommendationUtils.d.ts +0 -1
- package/{lib/module → dist/src}/utils/RecommendationUtils.js +88 -90
- package/{lib/typescript → dist/src}/utils/Translations.d.ts +0 -1
- package/{lib/module → dist/src}/utils/Translations.js +5 -7
- package/{lib/typescript → dist/src}/utils/Utils.d.ts +1 -2
- package/dist/src/utils/Utils.js +141 -0
- package/{lib/typescript → dist/src}/utils/Validations.d.ts +1 -2
- package/{lib/module → dist/src}/utils/Validations.js +128 -156
- package/package.json +96 -109
- package/lib/commonjs/RecommendationScreen.js +0 -778
- package/lib/commonjs/RecommendationScreen.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/Close.js +0 -20
- package/lib/commonjs/assets/IconsSVG/Close.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/CloseOutlined.js +0 -28
- package/lib/commonjs/assets/IconsSVG/CloseOutlined.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/Edit.js +0 -23
- package/lib/commonjs/assets/IconsSVG/Edit.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/activity/Cycling.js +0 -43
- package/lib/commonjs/assets/IconsSVG/activity/Cycling.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/activity/Running.js +0 -33
- package/lib/commonjs/assets/IconsSVG/activity/Running.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/activity/Stretching.js +0 -33
- package/lib/commonjs/assets/IconsSVG/activity/Stretching.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/activity/Swimming.js +0 -48
- package/lib/commonjs/assets/IconsSVG/activity/Swimming.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/activity/Walking.js +0 -38
- package/lib/commonjs/assets/IconsSVG/activity/Walking.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/mood/Happy.js +0 -34
- package/lib/commonjs/assets/IconsSVG/mood/Happy.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/mood/Neutral.js +0 -34
- package/lib/commonjs/assets/IconsSVG/mood/Neutral.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/mood/Sad.js +0 -34
- package/lib/commonjs/assets/IconsSVG/mood/Sad.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/mood/SemiHappy.js +0 -34
- package/lib/commonjs/assets/IconsSVG/mood/SemiHappy.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/mood/SemiSad.js +0 -34
- package/lib/commonjs/assets/IconsSVG/mood/SemiSad.js.map +0 -1
- package/lib/commonjs/components/ExitModal.js +0 -124
- package/lib/commonjs/components/ExitModal.js.map +0 -1
- package/lib/commonjs/components/InfoBars.js +0 -123
- package/lib/commonjs/components/InfoBars.js.map +0 -1
- package/lib/commonjs/components/InvisibleNumberInput.js +0 -150
- package/lib/commonjs/components/InvisibleNumberInput.js.map +0 -1
- package/lib/commonjs/components/LineSeparator.js +0 -27
- package/lib/commonjs/components/LineSeparator.js.map +0 -1
- package/lib/commonjs/components/RecentInsulin.js +0 -105
- package/lib/commonjs/components/RecentInsulin.js.map +0 -1
- package/lib/commonjs/components/RecommendationModal.js +0 -302
- package/lib/commonjs/components/RecommendationModal.js.map +0 -1
- package/lib/commonjs/components/RecommendedCarbs.js +0 -289
- package/lib/commonjs/components/RecommendedCarbs.js.map +0 -1
- package/lib/commonjs/components/RecommendedInsulin.js +0 -209
- package/lib/commonjs/components/RecommendedInsulin.js.map +0 -1
- package/lib/commonjs/components/Remeasure.js +0 -131
- package/lib/commonjs/components/Remeasure.js.map +0 -1
- package/lib/commonjs/components/Text.js +0 -25
- package/lib/commonjs/components/Text.js.map +0 -1
- package/lib/commonjs/components/TimeoutModal.js +0 -113
- package/lib/commonjs/components/TimeoutModal.js.map +0 -1
- package/lib/commonjs/components/TransferToLogbook.js +0 -83
- package/lib/commonjs/components/TransferToLogbook.js.map +0 -1
- package/lib/commonjs/components/activity/Activity.js +0 -112
- package/lib/commonjs/components/activity/Activity.js.map +0 -1
- package/lib/commonjs/components/activity/ActivityIcon.js +0 -86
- package/lib/commonjs/components/activity/ActivityIcon.js.map +0 -1
- package/lib/commonjs/components/activity/ActivityIntensity.js +0 -65
- package/lib/commonjs/components/activity/ActivityIntensity.js.map +0 -1
- package/lib/commonjs/components/mood/Emotion.js +0 -86
- package/lib/commonjs/components/mood/Emotion.js.map +0 -1
- package/lib/commonjs/components/mood/MoodIcon.js +0 -107
- package/lib/commonjs/components/mood/MoodIcon.js.map +0 -1
- package/lib/commonjs/components/styles/fonts.js +0 -160
- package/lib/commonjs/components/styles/fonts.js.map +0 -1
- package/lib/commonjs/index.js +0 -21
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/locales/da/translations.json +0 -82
- package/lib/commonjs/locales/de/translations.json +0 -81
- package/lib/commonjs/locales/en/translations.json +0 -84
- package/lib/commonjs/locales/es/translations.json +0 -81
- package/lib/commonjs/locales/fr/translations.json +0 -81
- package/lib/commonjs/locales/it/translations.json +0 -81
- package/lib/commonjs/locales/translate.js +0 -63
- package/lib/commonjs/locales/translate.js.map +0 -1
- package/lib/commonjs/types/enum.js +0 -179
- package/lib/commonjs/types/enum.js.map +0 -1
- package/lib/commonjs/types/types.js +0 -6
- package/lib/commonjs/types/types.js.map +0 -1
- package/lib/commonjs/utils/AttentionMessages.js +0 -141
- package/lib/commonjs/utils/AttentionMessages.js.map +0 -1
- package/lib/commonjs/utils/Constants.js +0 -138
- package/lib/commonjs/utils/Constants.js.map +0 -1
- package/lib/commonjs/utils/RecommendationError.js +0 -116
- package/lib/commonjs/utils/RecommendationError.js.map +0 -1
- package/lib/commonjs/utils/RecommendationUtils.js +0 -212
- package/lib/commonjs/utils/RecommendationUtils.js.map +0 -1
- package/lib/commonjs/utils/Translations.js +0 -22
- package/lib/commonjs/utils/Translations.js.map +0 -1
- package/lib/commonjs/utils/Utils.js +0 -162
- package/lib/commonjs/utils/Utils.js.map +0 -1
- package/lib/commonjs/utils/Validations.js +0 -468
- package/lib/commonjs/utils/Validations.js.map +0 -1
- package/lib/module/RecommendationScreen.js +0 -768
- package/lib/module/RecommendationScreen.js.map +0 -1
- package/lib/module/assets/IconsSVG/Close.js +0 -11
- package/lib/module/assets/IconsSVG/Close.js.map +0 -1
- package/lib/module/assets/IconsSVG/CloseOutlined.js +0 -19
- package/lib/module/assets/IconsSVG/CloseOutlined.js.map +0 -1
- package/lib/module/assets/IconsSVG/Edit.js +0 -14
- package/lib/module/assets/IconsSVG/Edit.js.map +0 -1
- package/lib/module/assets/IconsSVG/activity/Cycling.js +0 -34
- package/lib/module/assets/IconsSVG/activity/Cycling.js.map +0 -1
- package/lib/module/assets/IconsSVG/activity/Running.js +0 -24
- package/lib/module/assets/IconsSVG/activity/Running.js.map +0 -1
- package/lib/module/assets/IconsSVG/activity/Stretching.js +0 -24
- package/lib/module/assets/IconsSVG/activity/Stretching.js.map +0 -1
- package/lib/module/assets/IconsSVG/activity/Swimming.js +0 -39
- package/lib/module/assets/IconsSVG/activity/Swimming.js.map +0 -1
- package/lib/module/assets/IconsSVG/activity/Walking.js +0 -29
- package/lib/module/assets/IconsSVG/activity/Walking.js.map +0 -1
- package/lib/module/assets/IconsSVG/mood/Happy.js +0 -25
- package/lib/module/assets/IconsSVG/mood/Happy.js.map +0 -1
- package/lib/module/assets/IconsSVG/mood/Neutral.js +0 -25
- package/lib/module/assets/IconsSVG/mood/Neutral.js.map +0 -1
- package/lib/module/assets/IconsSVG/mood/Sad.js +0 -25
- package/lib/module/assets/IconsSVG/mood/Sad.js.map +0 -1
- package/lib/module/assets/IconsSVG/mood/SemiHappy.js +0 -25
- package/lib/module/assets/IconsSVG/mood/SemiHappy.js.map +0 -1
- package/lib/module/assets/IconsSVG/mood/SemiSad.js +0 -25
- package/lib/module/assets/IconsSVG/mood/SemiSad.js.map +0 -1
- package/lib/module/components/ExitModal.js +0 -114
- package/lib/module/components/ExitModal.js.map +0 -1
- package/lib/module/components/InfoBars.js +0 -114
- package/lib/module/components/InfoBars.js.map +0 -1
- package/lib/module/components/InvisibleNumberInput.js +0 -142
- package/lib/module/components/InvisibleNumberInput.js.map +0 -1
- package/lib/module/components/LineSeparator.js +0 -19
- package/lib/module/components/LineSeparator.js.map +0 -1
- package/lib/module/components/RecentInsulin.js +0 -97
- package/lib/module/components/RecentInsulin.js.map +0 -1
- package/lib/module/components/RecommendationModal.js +0 -291
- package/lib/module/components/RecommendationModal.js.map +0 -1
- package/lib/module/components/RecommendedCarbs.js +0 -281
- package/lib/module/components/RecommendedCarbs.js.map +0 -1
- package/lib/module/components/RecommendedInsulin.js +0 -201
- package/lib/module/components/RecommendedInsulin.js.map +0 -1
- package/lib/module/components/Remeasure.js +0 -123
- package/lib/module/components/Remeasure.js.map +0 -1
- package/lib/module/components/Text.js +0 -16
- package/lib/module/components/Text.js.map +0 -1
- package/lib/module/components/TimeoutModal.js +0 -103
- package/lib/module/components/TimeoutModal.js.map +0 -1
- package/lib/module/components/TransferToLogbook.js +0 -75
- package/lib/module/components/TransferToLogbook.js.map +0 -1
- package/lib/module/components/activity/Activity.js +0 -104
- package/lib/module/components/activity/Activity.js.map +0 -1
- package/lib/module/components/activity/ActivityIcon.js +0 -78
- package/lib/module/components/activity/ActivityIcon.js.map +0 -1
- package/lib/module/components/activity/ActivityIntensity.js +0 -57
- package/lib/module/components/activity/ActivityIntensity.js.map +0 -1
- package/lib/module/components/mood/Emotion.js +0 -78
- package/lib/module/components/mood/Emotion.js.map +0 -1
- package/lib/module/components/mood/MoodIcon.js +0 -97
- package/lib/module/components/mood/MoodIcon.js.map +0 -1
- package/lib/module/components/styles/fonts.js +0 -152
- package/lib/module/components/styles/fonts.js.map +0 -1
- package/lib/module/index.js +0 -5
- package/lib/module/index.js.map +0 -1
- package/lib/module/locales/da/translations.json +0 -82
- package/lib/module/locales/de/translations.json +0 -81
- package/lib/module/locales/en/translations.json +0 -84
- package/lib/module/locales/es/translations.json +0 -81
- package/lib/module/locales/fr/translations.json +0 -81
- package/lib/module/locales/it/translations.json +0 -81
- package/lib/module/locales/translate.js +0 -55
- package/lib/module/locales/translate.js.map +0 -1
- package/lib/module/types/enum.js +0 -170
- package/lib/module/types/enum.js.map +0 -1
- package/lib/module/types/types.js +0 -2
- package/lib/module/types/types.js.map +0 -1
- package/lib/module/utils/AttentionMessages.js +0 -131
- package/lib/module/utils/AttentionMessages.js.map +0 -1
- package/lib/module/utils/Constants.js.map +0 -1
- package/lib/module/utils/RecommendationError.js +0 -87
- package/lib/module/utils/RecommendationError.js.map +0 -1
- package/lib/module/utils/RecommendationUtils.js.map +0 -1
- package/lib/module/utils/Translations.js.map +0 -1
- package/lib/module/utils/Utils.js +0 -155
- package/lib/module/utils/Utils.js.map +0 -1
- package/lib/module/utils/Validations.js.map +0 -1
- package/lib/typescript/RecommendationScreen.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/Close.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/Close.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/CloseOutlined.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/CloseOutlined.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/Edit.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/Edit.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/activity/Cycling.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/activity/Cycling.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/activity/Running.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/activity/Running.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/activity/Stretching.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/activity/Stretching.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/activity/Swimming.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/activity/Swimming.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/activity/Walking.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/activity/Walking.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/mood/Happy.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/mood/Happy.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/mood/Neutral.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/mood/Neutral.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/mood/Sad.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/mood/Sad.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/mood/SemiHappy.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/mood/SemiHappy.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/mood/SemiSad.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/mood/SemiSad.d.ts.map +0 -1
- package/lib/typescript/components/ExitModal.d.ts +0 -26
- package/lib/typescript/components/ExitModal.d.ts.map +0 -1
- package/lib/typescript/components/InfoBars.d.ts.map +0 -1
- package/lib/typescript/components/InvisibleNumberInput.d.ts.map +0 -1
- package/lib/typescript/components/LineSeparator.d.ts.map +0 -1
- package/lib/typescript/components/RecentInsulin.d.ts.map +0 -1
- package/lib/typescript/components/RecommendationModal.d.ts.map +0 -1
- package/lib/typescript/components/RecommendedCarbs.d.ts.map +0 -1
- package/lib/typescript/components/RecommendedInsulin.d.ts.map +0 -1
- package/lib/typescript/components/Remeasure.d.ts.map +0 -1
- package/lib/typescript/components/Text.d.ts +0 -14
- package/lib/typescript/components/Text.d.ts.map +0 -1
- package/lib/typescript/components/TimeoutModal.d.ts +0 -25
- package/lib/typescript/components/TimeoutModal.d.ts.map +0 -1
- package/lib/typescript/components/TransferToLogbook.d.ts.map +0 -1
- package/lib/typescript/components/activity/Activity.d.ts.map +0 -1
- package/lib/typescript/components/activity/ActivityIcon.d.ts.map +0 -1
- package/lib/typescript/components/activity/ActivityIntensity.d.ts.map +0 -1
- package/lib/typescript/components/mood/Emotion.d.ts.map +0 -1
- package/lib/typescript/components/mood/MoodIcon.d.ts.map +0 -1
- package/lib/typescript/components/styles/fonts.d.ts +0 -151
- package/lib/typescript/components/styles/fonts.d.ts.map +0 -1
- package/lib/typescript/index.d.ts +0 -5
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/locales/translate.d.ts +0 -20
- package/lib/typescript/locales/translate.d.ts.map +0 -1
- package/lib/typescript/types/enum.d.ts.map +0 -1
- package/lib/typescript/types/types.d.ts.map +0 -1
- package/lib/typescript/utils/AttentionMessages.d.ts.map +0 -1
- package/lib/typescript/utils/Constants.d.ts.map +0 -1
- package/lib/typescript/utils/RecommendationError.d.ts.map +0 -1
- package/lib/typescript/utils/RecommendationUtils.d.ts.map +0 -1
- package/lib/typescript/utils/Translations.d.ts.map +0 -1
- package/lib/typescript/utils/Utils.d.ts.map +0 -1
- package/lib/typescript/utils/Validations.d.ts.map +0 -1
- package/src/RecommendationScreen.tsx +0 -854
- package/src/assets/IconsSVG/Close.tsx +0 -13
- package/src/assets/IconsSVG/CloseOutlined.tsx +0 -23
- package/src/assets/IconsSVG/Edit.tsx +0 -16
- package/src/assets/IconsSVG/activity/Cycling.tsx +0 -41
- package/src/assets/IconsSVG/activity/Running.tsx +0 -29
- package/src/assets/IconsSVG/activity/Stretching.tsx +0 -29
- package/src/assets/IconsSVG/activity/Swimming.tsx +0 -47
- package/src/assets/IconsSVG/activity/Walking.tsx +0 -35
- package/src/assets/IconsSVG/mood/Happy.tsx +0 -30
- package/src/assets/IconsSVG/mood/Neutral.tsx +0 -30
- package/src/assets/IconsSVG/mood/Sad.tsx +0 -30
- package/src/assets/IconsSVG/mood/SemiHappy.tsx +0 -30
- package/src/assets/IconsSVG/mood/SemiSad.tsx +0 -30
- package/src/components/ExitModal.tsx +0 -134
- package/src/components/InfoBars.tsx +0 -122
- package/src/components/InvisibleNumberInput.tsx +0 -170
- package/src/components/LineSeparator.tsx +0 -29
- package/src/components/RecentInsulin.tsx +0 -109
- package/src/components/RecommendationModal.tsx +0 -319
- package/src/components/RecommendedCarbs.tsx +0 -303
- package/src/components/RecommendedInsulin.tsx +0 -220
- package/src/components/Remeasure.tsx +0 -135
- package/src/components/Text.tsx +0 -27
- package/src/components/TimeoutModal.tsx +0 -121
- package/src/components/TransferToLogbook.tsx +0 -92
- package/src/components/activity/Activity.tsx +0 -107
- package/src/components/activity/ActivityIcon.tsx +0 -77
- package/src/components/activity/ActivityIntensity.tsx +0 -67
- package/src/components/mood/Emotion.tsx +0 -97
- package/src/components/mood/MoodIcon.tsx +0 -91
- package/src/components/styles/fonts.ts +0 -151
- package/src/index.ts +0 -5
- package/src/locales/da/translations.json +0 -82
- package/src/locales/de/translations.json +0 -81
- package/src/locales/en/translations.json +0 -84
- package/src/locales/es/translations.json +0 -81
- package/src/locales/fr/translations.json +0 -81
- package/src/locales/it/translations.json +0 -81
- package/src/locales/translate.ts +0 -62
- package/src/types/enum.ts +0 -164
- package/src/types/types.ts +0 -19
- package/src/utils/AttentionMessages.ts +0 -167
- package/src/utils/Constants.ts +0 -77
- package/src/utils/RecommendationError.ts +0 -182
- package/src/utils/RecommendationUtils.ts +0 -232
- package/src/utils/Translations.ts +0 -17
- package/src/utils/Utils.ts +0 -156
- package/src/utils/Validations.ts +0 -490
|
@@ -0,0 +1,522 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { AppState, BackHandler, Dimensions, LogBox, ScrollView, StatusBar, StyleSheet, View, } from "react-native";
|
|
3
|
+
import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
|
|
4
|
+
import { colors } from "./utils/Constants";
|
|
5
|
+
import ForecastInfoBar from "./components/ForecastInfoBar";
|
|
6
|
+
import Header from "./components/Header";
|
|
7
|
+
import InfoBars, { infoStyles } from "./components/InfoBars";
|
|
8
|
+
import RecentInsulin from "./components/RecentInsulin";
|
|
9
|
+
import RecommendedCarbs from "./components/RecommendedCarbs";
|
|
10
|
+
import RecommendedInsulin from "./components/RecommendedInsulin";
|
|
11
|
+
import Remeasure from "./components/Remeasure";
|
|
12
|
+
import * as Calculator from "@hedia/recommendation-calculator";
|
|
13
|
+
import { Milliseconds, } from "@hedia/types";
|
|
14
|
+
import { I18nProvider } from "@lingui/react";
|
|
15
|
+
import Emotion from "./components/mood/Emotion";
|
|
16
|
+
import SaveButton from "./components/SaveButton";
|
|
17
|
+
import { t } from "@lingui/macro";
|
|
18
|
+
import Activity from "./components/activity/Activity";
|
|
19
|
+
import LimitationMessage from "./components/LimitationMessage";
|
|
20
|
+
import RecommendationModal from "./components/RecommendationModal";
|
|
21
|
+
import TwoOptionModal, { modalStyle } from "./components/TwoOptionModal";
|
|
22
|
+
import { changeLanguage, i18n } from "./locale/i18nUtils";
|
|
23
|
+
import { Testing } from "./types/enum";
|
|
24
|
+
import { Messages } from "./utils/AttentionMessages";
|
|
25
|
+
import { getAttentionMessage, getBGLevel, getLimitationMessage, getReminder } from "./utils/RecommendationUtils";
|
|
26
|
+
import { Utils } from "./utils/Utils";
|
|
27
|
+
import { validateParams } from "./utils/Validations";
|
|
28
|
+
const { InfoBarTestIds, RecommendationScreenTestIds } = Testing.Id;
|
|
29
|
+
// Ignoring long timer warnings
|
|
30
|
+
// https://github.com/facebook/react-native/issues/12981#issuecomment-652745831
|
|
31
|
+
LogBox.ignoreLogs([`Setting a timer`]);
|
|
32
|
+
/**
|
|
33
|
+
* The RecommendationScreen is the React component that passes relevant inputs to the recommendation calculation module and presents
|
|
34
|
+
* the resulting recommendation along with related messages or warnings to the user.
|
|
35
|
+
* The RecommendationScreen component accepts properties with the user’s settings/preferences and other inputs needed for calculating a recommendation.
|
|
36
|
+
* @noInheritDoc
|
|
37
|
+
*/
|
|
38
|
+
export default class RecommendationScreen extends React.Component {
|
|
39
|
+
/** Reference to the timer that prompts the user to make a new calculation after 15 minutes. */
|
|
40
|
+
timer;
|
|
41
|
+
/**
|
|
42
|
+
* The carbohydrate recommendation for the user.
|
|
43
|
+
* This value is saved in a member variable because we want to store it unmodified if the logbook entry
|
|
44
|
+
* gets saved regardless of what other changes were made on the recommendation screen.
|
|
45
|
+
*/
|
|
46
|
+
suggestedCarbs;
|
|
47
|
+
/**
|
|
48
|
+
* A guard against displaying wrong or dangerous information to the user.
|
|
49
|
+
* If an error has occurred, this variable will be set to true and an empty placeholder will be rendered instead of the normal recommendation screen.
|
|
50
|
+
*/
|
|
51
|
+
hasError = false;
|
|
52
|
+
/** The timestamp when the current recommendation was made. For determining if the recommendation is too old and should be hidden from the user. */
|
|
53
|
+
recommendationDate;
|
|
54
|
+
/**
|
|
55
|
+
* A reference to the screens scrollview allowing us to programmatically scroll the screen in the handleNoRecentInsulin() method.
|
|
56
|
+
* The member is initiated without a value but will be set as soon as the component is being rendered.
|
|
57
|
+
*/
|
|
58
|
+
scrollView;
|
|
59
|
+
/**
|
|
60
|
+
* A reference to the eventSubscription that'll be returned by AppState.addEventListener().
|
|
61
|
+
* It'll allow us to later remove the subscription.
|
|
62
|
+
*/
|
|
63
|
+
appStateSubscription;
|
|
64
|
+
/**
|
|
65
|
+
* A reference to the eventSubscription that'll be returned by BackHandler.addEventListener().
|
|
66
|
+
* It'll allow us to later remove the subscription.
|
|
67
|
+
*/
|
|
68
|
+
backHandlerSubscription;
|
|
69
|
+
/**
|
|
70
|
+
* Steps:
|
|
71
|
+
* 1. Call the super() method with the props.
|
|
72
|
+
* 2. Execute the following steps and if an exception is thrown, catch it, set the hasError member variable to true and call the onError callback prop with the caught exception as argument:
|
|
73
|
+
* - Call the validateParams() method with the props as argument
|
|
74
|
+
* - Set the recommendationDate member to the current date and time
|
|
75
|
+
* - Set the language by using the language prop as argument for calling changeLanguage()
|
|
76
|
+
* - Unpack recentBoluses from the calculatorParams prop.
|
|
77
|
+
* - Use the calculatorParams prop as argument for calling calculateRecommendation() and unpack all of the resulting values.
|
|
78
|
+
* - Copy the carbRecommendation to the suggestedCarbs member variable.
|
|
79
|
+
* - Set the following state variables:
|
|
80
|
+
* - Set remeasureTime to the return value from calling the getBGLevelRemeasurementReminder() method.
|
|
81
|
+
* - Set isRecommendationDisplayed to be false if the length of recentBoluses is 0 or false otherwise.
|
|
82
|
+
* - Set insulinRecommendation to be the bolus insulin recommendation rounded using roundValue().
|
|
83
|
+
* - Set wasLimited to the wasLimited return value from calling calculateRecommendation() above.
|
|
84
|
+
* - Set activityReduction to the reduction returned from the calculation result.
|
|
85
|
+
* - Set carbRecommendation to the recommendation returned from the calculation result.
|
|
86
|
+
* - Set activeInsulin to the estimation returned from the calculation result.
|
|
87
|
+
* - Set enteredCarbs, enteredInsulin, selectedMood to null.
|
|
88
|
+
* - Set recommendationModal to be true if wasLimited is true or if carbRecommendation after being rounded is truthy or if the return value from calling the getBGLevelAttentionMessage() method is truthy.
|
|
89
|
+
* - Set showExitModal, showLimitationMessage, showTimeoutModal to be false.
|
|
90
|
+
* 3. Start a 15 minute timer assigned to the timer member variable using the setTimeout() function. When the timer expires, call the showTimeoutModal() method.
|
|
91
|
+
* @param props The data required to initialise the Recommendation Screen
|
|
92
|
+
*/
|
|
93
|
+
constructor(props) {
|
|
94
|
+
super(props);
|
|
95
|
+
try {
|
|
96
|
+
validateParams(props);
|
|
97
|
+
this.recommendationDate = new Date(global.Date.now());
|
|
98
|
+
changeLanguage(props.language);
|
|
99
|
+
const { recentBoluses } = props.calculatorParams;
|
|
100
|
+
const { bolus, carbRecommendation, activityReduction, wasLimited, activeInsulin } = Calculator.calculateRecommendation(props.calculatorParams);
|
|
101
|
+
this.suggestedCarbs = carbRecommendation;
|
|
102
|
+
this.state = {
|
|
103
|
+
remeasureTime: this.getBGLevelRemeasurementReminder(),
|
|
104
|
+
isRecommendationDisplayed: recentBoluses?.length !== 0,
|
|
105
|
+
insulinRecommendation: Utils.roundValue(bolus, props.injectionMethod),
|
|
106
|
+
wasLimited,
|
|
107
|
+
activityReduction,
|
|
108
|
+
carbRecommendation,
|
|
109
|
+
activeInsulin,
|
|
110
|
+
enteredCarbs: null,
|
|
111
|
+
enteredInsulin: null,
|
|
112
|
+
selectedMood: null,
|
|
113
|
+
recommendationModal: wasLimited || !!Math.round(carbRecommendation) || !!this.getBGLevelAttentionMessage(),
|
|
114
|
+
showExitModal: false,
|
|
115
|
+
showLimitationMessage: false,
|
|
116
|
+
showTimeoutModal: false,
|
|
117
|
+
};
|
|
118
|
+
this.timer = setTimeout(this.showTimeoutModal, Milliseconds.Minute * 15);
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
this.hasError = true;
|
|
122
|
+
props.onError(error);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Called immediately after a component is mounted. Setting state here will trigger re-rendering.
|
|
127
|
+
*
|
|
128
|
+
* Steps:
|
|
129
|
+
* 1. If there is no error, create a listener to call the handleAppStateChange() method when the app state changes.
|
|
130
|
+
*/
|
|
131
|
+
componentDidMount() {
|
|
132
|
+
if (!this.hasError) {
|
|
133
|
+
this.appStateSubscription = AppState.addEventListener(`change`, this.handleAppStateChange);
|
|
134
|
+
this.backHandlerSubscription = BackHandler.addEventListener(`hardwareBackPress`, this.onBackHandlerPress);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Called immediately before a component is destroyed.
|
|
139
|
+
* Perform any necessary cleanup in this method, such as cancelled network requests, or cleaning up any DOM elements created in componentDidMount.
|
|
140
|
+
*
|
|
141
|
+
* Clear the 15 minute timer that was set in the constructor during initialisation so it doesn't keep running and gets triggered after the recommendation screen was closed.
|
|
142
|
+
*
|
|
143
|
+
* Steps:
|
|
144
|
+
* 1. Call clearTimeout on the timer member variable.
|
|
145
|
+
* 2. Remove the listener for app state changes that was set by the componentDidMount() method.
|
|
146
|
+
*/
|
|
147
|
+
componentWillUnmount() {
|
|
148
|
+
if (this.timer !== undefined) {
|
|
149
|
+
clearTimeout(this.timer);
|
|
150
|
+
}
|
|
151
|
+
this.appStateSubscription?.remove();
|
|
152
|
+
this.backHandlerSubscription?.remove();
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Steps:
|
|
156
|
+
* 1. Evaluate a boolean called isOlderThan15Minutes to indicate whether the recommendationDate member variable represents a time more than 15 minutes ago.
|
|
157
|
+
* 2. If nextAppState is ‘active’ and isOlderThan15Minutes is true then call the showTimeoutModal() method.
|
|
158
|
+
* @param nextAppState The new state of the app.
|
|
159
|
+
*/
|
|
160
|
+
handleAppStateChange = (nextAppState) => {
|
|
161
|
+
const time = this.recommendationDate.getTime();
|
|
162
|
+
const isOlderThan15Minutes = global.Date.now() - time > Milliseconds.Minute * 15;
|
|
163
|
+
if (nextAppState === `active` && isOlderThan15Minutes) {
|
|
164
|
+
this.showTimeoutModal();
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* Steps:
|
|
169
|
+
* 1. Set the showTimeoutModal state variable to be true. Use a callback function to call the showBolusBar prop callback function with false as argument when the state has been updated.
|
|
170
|
+
* */
|
|
171
|
+
showTimeoutModal = () => {
|
|
172
|
+
this.setState({ showTimeoutModal: true }, () => this.props.showBolusBar(!this.state.showTimeoutModal));
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Make a new insulin calculation and set the result to be displayed to the user.
|
|
176
|
+
*
|
|
177
|
+
* Steps:
|
|
178
|
+
* 1. Use calculatorParams as an argument for calling calculateRecommendation(). Unpack bolus, wasLimited, and activityReduction from the result.
|
|
179
|
+
* 2. Set the following state variables:
|
|
180
|
+
* - Set insulinRecommendation to the bolus rounded using the roundValue() function.
|
|
181
|
+
* - Set enteredInsulin to be undefined.
|
|
182
|
+
* - Set wasLimited to be the value returned from the insulin calculator.
|
|
183
|
+
* - Set activityReduction to be the value returned from the insulin calculator.
|
|
184
|
+
* - Set showLimitationMessage to be the wasLimited value returned from the insulin calculator.
|
|
185
|
+
* @param calculatorParams The input values for the bolus calculator itself.
|
|
186
|
+
*/
|
|
187
|
+
recalculateInsulin = (calculatorParams) => {
|
|
188
|
+
const { bolus, wasLimited, activityReduction } = Calculator.calculateRecommendation(calculatorParams);
|
|
189
|
+
this.setState({
|
|
190
|
+
insulinRecommendation: Utils.roundValue(bolus, this.props.injectionMethod),
|
|
191
|
+
enteredInsulin: null,
|
|
192
|
+
wasLimited,
|
|
193
|
+
activityReduction,
|
|
194
|
+
showLimitationMessage: wasLimited,
|
|
195
|
+
});
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* Handle presses on the exit button in the header bar.
|
|
199
|
+
*
|
|
200
|
+
* Steps:
|
|
201
|
+
* 1. If the insulin recommendation is being displayed (the isRecommendationDisplayed state variable is true):
|
|
202
|
+
* - Set the showExitModal state variable to true. When the state has been updated, call the showBolusBar prop callback function with the inverse value of the showExitModal state variable as argument.
|
|
203
|
+
* 2. Else:
|
|
204
|
+
* - Call the exitCallback prop callback function.
|
|
205
|
+
*/
|
|
206
|
+
onExit = () => {
|
|
207
|
+
if (this.state.isRecommendationDisplayed) {
|
|
208
|
+
this.setState({ showExitModal: true }, () => this.props.showBolusBar(!this.state.showExitModal));
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
this.props.exitCallback();
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* Callback to be executed by the back handler listener.
|
|
216
|
+
*
|
|
217
|
+
* Steps:
|
|
218
|
+
* 1. Call the onExist method
|
|
219
|
+
* 2. Return true so that the default behaviour is overwritten.
|
|
220
|
+
*/
|
|
221
|
+
onBackHandlerPress = () => {
|
|
222
|
+
this.onExit();
|
|
223
|
+
return true;
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* Hide the modal that shows attention messages.
|
|
227
|
+
*
|
|
228
|
+
* Steps:
|
|
229
|
+
* 1. Set the recommendationModal state variable to false.
|
|
230
|
+
*/
|
|
231
|
+
hideAttentionModal = () => {
|
|
232
|
+
this.setState({ recommendationModal: false });
|
|
233
|
+
};
|
|
234
|
+
/**
|
|
235
|
+
* Hide the modal that shows attention messages.
|
|
236
|
+
*
|
|
237
|
+
* Steps:
|
|
238
|
+
* 1. Set the showLimitationMessage state variable to false.
|
|
239
|
+
*/
|
|
240
|
+
hideLimitationMessage = () => {
|
|
241
|
+
this.setState({ showLimitationMessage: false });
|
|
242
|
+
};
|
|
243
|
+
/**
|
|
244
|
+
* Hide the exit modal. To be used when the user closes the modal directly or in some way exits the recommendation screen.
|
|
245
|
+
*
|
|
246
|
+
* Steps:
|
|
247
|
+
* 1. Set the showExitModal state variable to false.
|
|
248
|
+
* When the state has been updated, call the showBolusBar prop callback function with the inverse value of the showExitModal state variable as argument.
|
|
249
|
+
*/
|
|
250
|
+
hideExitModal = () => {
|
|
251
|
+
this.setState({ showExitModal: false }, () => this.props.showBolusBar(!this.state.showExitModal));
|
|
252
|
+
};
|
|
253
|
+
/**
|
|
254
|
+
* Hide the modal that warns the user that their recommendation is old.
|
|
255
|
+
*
|
|
256
|
+
* Steps:
|
|
257
|
+
* 1. Set the showTimeoutModal state variable to false.
|
|
258
|
+
* When the state has been updated, call the showBolusBar prop callback function with the inverse value of the showTimeoutModal state variable as argument.
|
|
259
|
+
*/
|
|
260
|
+
hideTimeoutModal = () => {
|
|
261
|
+
this.setState({ showTimeoutModal: false }, () => this.props.showBolusBar(!this.state.showTimeoutModal));
|
|
262
|
+
};
|
|
263
|
+
/**
|
|
264
|
+
* Used as a callback function for the Remeasure component to update the state when the remeasure time slider’s value changes.
|
|
265
|
+
*
|
|
266
|
+
* Steps:
|
|
267
|
+
* 1. Set the remeasureTime state variable to the value of the remeasureTime argument.
|
|
268
|
+
* @param remeasureTime The number of hours for which to wait before reminding the user to measure their BGL again. 0 indicates that the user should not be reminded.
|
|
269
|
+
*/
|
|
270
|
+
updateRemeasureTime = (remeasureTime) => {
|
|
271
|
+
this.setState({ remeasureTime });
|
|
272
|
+
};
|
|
273
|
+
/**
|
|
274
|
+
* Handle what happens if the user taps “No” to the question about injecting insulin within the last 4 hours.
|
|
275
|
+
* The card that prompts the user to answer if they have injected insulin within the last 4 hours shall be hidden and
|
|
276
|
+
* the screen shall automatically be scrolled to the bottom so the user can see the now visible “Transfer to logbook” button.
|
|
277
|
+
*
|
|
278
|
+
* Steps:
|
|
279
|
+
* 1. Set the isRecommendationDisplayed state variable to be true.
|
|
280
|
+
* 2. As a callback to the setState() method, define a new anonymous function that calls setTimeout() with a duration of 0 milliseconds.
|
|
281
|
+
* When the time expires, call the scrollToEnd() method of the scrollView member, with the animated argument set to true.
|
|
282
|
+
* This ensures that the scroll event happens after all other events that get queued to happen at the same time,
|
|
283
|
+
* so all relevant elements are visible on the screen and the scroll happens reliably.
|
|
284
|
+
*/
|
|
285
|
+
handleNoRecentInsulin = () => {
|
|
286
|
+
this.setState({ isRecommendationDisplayed: true }, () => {
|
|
287
|
+
setTimeout(() => {
|
|
288
|
+
this.scrollView?.scrollToEnd({ animated: true });
|
|
289
|
+
}, 0);
|
|
290
|
+
});
|
|
291
|
+
};
|
|
292
|
+
/**
|
|
293
|
+
* Handle what happens when the user changes the content of the additional carbohydrates input field.
|
|
294
|
+
*
|
|
295
|
+
* Steps:
|
|
296
|
+
* 1. Set the enteredCarbs state variable to the value of the enteredCarbs argument.
|
|
297
|
+
* 2. As a callback to the setState() method, define a new anonymous function that calls the recalculateInsulin() function using
|
|
298
|
+
* a copy of the calculatorParams prop where the carbohydrates property has been overwritten to be
|
|
299
|
+
* the sum of the carbohydrates property of the calculatorParams prop and the enteredCarbs argument.
|
|
300
|
+
* @param enteredCarbs The amount of carbohydrates in grams that has been entered in the additional carbohydrates input field.
|
|
301
|
+
*/
|
|
302
|
+
updateCarbRecommendation = (enteredCarbs) => {
|
|
303
|
+
const providedCarbs = this.props.calculatorParams.carbohydrates;
|
|
304
|
+
this.setState({ enteredCarbs }, () => {
|
|
305
|
+
this.recalculateInsulin({ ...this.props.calculatorParams, carbohydrates: providedCarbs + enteredCarbs });
|
|
306
|
+
});
|
|
307
|
+
};
|
|
308
|
+
/**
|
|
309
|
+
* Handle what happens when the cross button by the additional carbohydrates button is tapped.
|
|
310
|
+
*
|
|
311
|
+
* Steps:
|
|
312
|
+
* 1. Set both the enteredCarbs and the carbRecommendation state variables to null.
|
|
313
|
+
* 2. As a callback to the setState() method, define a new anonymous function that calls the recalculateInsulin() function using a copy of the calculatorParams prop.
|
|
314
|
+
*/
|
|
315
|
+
removeCarbRecommendation = () => {
|
|
316
|
+
this.setState({ enteredCarbs: null, carbRecommendation: null }, () => this.recalculateInsulin({ ...this.props.calculatorParams }));
|
|
317
|
+
};
|
|
318
|
+
/**
|
|
319
|
+
* Handle what happens when the user is recommended to eat additional carbohydrates but taps the decline button.
|
|
320
|
+
*
|
|
321
|
+
* Steps:
|
|
322
|
+
* 1. Call the hideAttentionModal() method.
|
|
323
|
+
* 2. Call the removeCarbRecommendation() method.
|
|
324
|
+
* 3. Call the carbRecommendationAnswer() prop callback function with false as argument.
|
|
325
|
+
*/
|
|
326
|
+
declineCarbRecommendation = () => {
|
|
327
|
+
this.hideAttentionModal();
|
|
328
|
+
this.removeCarbRecommendation();
|
|
329
|
+
this.props.carbRecommendationAnswer(false);
|
|
330
|
+
};
|
|
331
|
+
/**
|
|
332
|
+
* Handle what happens when the user is recommended to eat additional carbohydrates and they tap the accept button.
|
|
333
|
+
*
|
|
334
|
+
* Steps:
|
|
335
|
+
* 1. Call the hideAttentionModal() method.
|
|
336
|
+
* 2. Call the carbRecommendationAnswer() prop callback function with true as argument.
|
|
337
|
+
*/
|
|
338
|
+
acceptCarbRecommendation = () => {
|
|
339
|
+
this.hideAttentionModal();
|
|
340
|
+
this.props.carbRecommendationAnswer(true);
|
|
341
|
+
};
|
|
342
|
+
/**
|
|
343
|
+
* Handles what happens when the user hits the “close calculation”-button on the exit modal.
|
|
344
|
+
*
|
|
345
|
+
* Steps:
|
|
346
|
+
* 1. If the showExitModal state variable is true then call the hideExitModal() method. Otherwise, call the hideTimeoutModal() method
|
|
347
|
+
* 2. Call the closeCalculationCallback prop callback function.
|
|
348
|
+
*/
|
|
349
|
+
closeCalculation = () => {
|
|
350
|
+
this.state.showExitModal ? this.hideExitModal() : this.hideTimeoutModal();
|
|
351
|
+
this.props.closeCalculationCallback();
|
|
352
|
+
};
|
|
353
|
+
/**
|
|
354
|
+
* Close the current recommendation and start a new bolus calculation.
|
|
355
|
+
*
|
|
356
|
+
* Steps:
|
|
357
|
+
* 1. Call the hideTimeoutModal() method.
|
|
358
|
+
* 2. Call the restartCalculation prop callback function.
|
|
359
|
+
*/
|
|
360
|
+
restartCalculation = () => {
|
|
361
|
+
this.hideTimeoutModal();
|
|
362
|
+
this.props.restartCalculation();
|
|
363
|
+
};
|
|
364
|
+
/**
|
|
365
|
+
* Used as a callback function for the Emotion component to update the state when a mood icon is tapped.
|
|
366
|
+
*
|
|
367
|
+
* Steps:
|
|
368
|
+
* 1. Set the selectedMood state variable to the value of the selectedMood argument.
|
|
369
|
+
* @param selectedMood he mood that should be selected going forward or null if no mood should be selected.
|
|
370
|
+
*/
|
|
371
|
+
handleMoodSelected = (selectedMood) => {
|
|
372
|
+
this.setState({ selectedMood });
|
|
373
|
+
};
|
|
374
|
+
/**
|
|
375
|
+
* Handle what happens when the user changes the content of the insulin input field.
|
|
376
|
+
*
|
|
377
|
+
* Steps:
|
|
378
|
+
* 1. Set the enteredInsulin state variable to the value of the enteredInsulin argument.
|
|
379
|
+
* @param enteredInsulin The amount of insulin (in units) that has been entered in the insulin input field.
|
|
380
|
+
*/
|
|
381
|
+
updateInsulinRecommendation = (enteredInsulin) => {
|
|
382
|
+
this.setState({ enteredInsulin });
|
|
383
|
+
};
|
|
384
|
+
/**
|
|
385
|
+
* Handle what happens when the “Transfer to Logbook” button is pressed.
|
|
386
|
+
* Namely, the entered data should be saved in a logbook entry and the recommendation screen should be closed.
|
|
387
|
+
*
|
|
388
|
+
* Steps:
|
|
389
|
+
* 1. Unpack the enteredCarbs, enteredInsulin, insulinRecommendation, remeasureTime, and showExitModal state variables
|
|
390
|
+
* 2. Create an IResult object called carbs consisting of suggestedCarbs and enteredCarbs.
|
|
391
|
+
* 3. Create an IResult object called Insulin consisting of insulinRecommendation and enteredInsulin.
|
|
392
|
+
* 4. If showExitModal is true then call the hideExitModal() method. otherwise call the hideTimeoutModal() method.
|
|
393
|
+
* 5. Call the transferToLogbook prop callback function with the following arguments:
|
|
394
|
+
* - Set the carbs argument to the carbs IResult object.
|
|
395
|
+
* - Set the insulin argument to the insulin IResult object.
|
|
396
|
+
* - Set the reminder argument to the remeasureTime state variable.
|
|
397
|
+
* - Set the recommendationDate argument to the recommendationDate member variable.
|
|
398
|
+
*/
|
|
399
|
+
handleTransfer = () => {
|
|
400
|
+
const { enteredCarbs, enteredInsulin, insulinRecommendation, remeasureTime, showExitModal, selectedMood } = this.state;
|
|
401
|
+
const carbs = { suggested: this.suggestedCarbs, entered: enteredCarbs };
|
|
402
|
+
const insulin = { suggested: insulinRecommendation, entered: enteredInsulin };
|
|
403
|
+
showExitModal ? this.hideExitModal() : this.hideTimeoutModal();
|
|
404
|
+
this.props.transferToLogbook(carbs, insulin, remeasureTime, this.recommendationDate, selectedMood);
|
|
405
|
+
};
|
|
406
|
+
/**
|
|
407
|
+
* Get the attention message that should be displayed for the user to draw their attention to noteworthy circumstances regarding their current blood glucose level.
|
|
408
|
+
*
|
|
409
|
+
* Steps:
|
|
410
|
+
* 1. Unpack calculatorParams and latestLogbookFrom6Hours from the props.
|
|
411
|
+
* 2. Unpack currentBGL and activity from calculatorparams.
|
|
412
|
+
* 3. Get bgLevel, the categorisation of the blood glucose level, by calling the getBGLevel() function with the currentBGL and latestLogbookFrom6Hours as arguments.
|
|
413
|
+
* 4. Return the attention message that is returned when calling getAttentionMessage() using bgLevel and activity as arguments.
|
|
414
|
+
* @returns A string describing what the user needs to be aware of regarding their current blood glucose level.
|
|
415
|
+
* If there is nothing noteworthy, null will be returned instead.
|
|
416
|
+
*/
|
|
417
|
+
getBGLevelAttentionMessage = () => {
|
|
418
|
+
const { calculatorParams, latestLogbookFrom6Hours } = this.props;
|
|
419
|
+
const { currentBGL, activity } = calculatorParams;
|
|
420
|
+
const bgLevel = getBGLevel(currentBGL, latestLogbookFrom6Hours);
|
|
421
|
+
return getAttentionMessage(bgLevel, activity);
|
|
422
|
+
};
|
|
423
|
+
/**
|
|
424
|
+
* Get the initial value for the remeasurement reminder time slider depending on the user’s entered information.
|
|
425
|
+
*
|
|
426
|
+
* Steps:
|
|
427
|
+
* 1. Unpack calculatorParams, userReminder, and latestLogbookFrom6Hours from the props.
|
|
428
|
+
* 2. Unpack currentBGL, activity, and carbohydrates from calculatorParams.
|
|
429
|
+
* 3. Get bgLevel, the categorisation of the blood glucose level, by calling the getBGLevel() function with the currentBGL and latestLogbookFrom6Hours as arguments.
|
|
430
|
+
* 4. Return the attention message that is returned when calling getReminder() using bgLevel, carbohydrates, userReminder, and activity as arguments.
|
|
431
|
+
* @returns The time interval in hours that should be used as the initial value for the remeasurement reminder time slider.
|
|
432
|
+
*/
|
|
433
|
+
getBGLevelRemeasurementReminder = () => {
|
|
434
|
+
const { calculatorParams, userReminder, latestLogbookFrom6Hours } = this.props;
|
|
435
|
+
const { currentBGL, activity, carbohydrates } = calculatorParams;
|
|
436
|
+
const bgLevel = getBGLevel(currentBGL, latestLogbookFrom6Hours);
|
|
437
|
+
return getReminder(bgLevel, carbohydrates, userReminder, activity);
|
|
438
|
+
};
|
|
439
|
+
/**
|
|
440
|
+
* Get the attention message that should be displayed to the user to let them know that the insulin recommendation that
|
|
441
|
+
* is being displayed to them was limited by the maximum insulin threshold.
|
|
442
|
+
*
|
|
443
|
+
* Steps:
|
|
444
|
+
* 1. Unpack the wasLimited and activityReduction state variables.
|
|
445
|
+
* 2. Return the result from calling getLimitationMessage() with wasLimited and activityReduction as arguments.
|
|
446
|
+
* @returns A message to inform the user how the insulin recommendation was limited. If there is no limitation attention message, null will be returned instead.
|
|
447
|
+
*/
|
|
448
|
+
getLimitationAttentionMessage = () => {
|
|
449
|
+
const { wasLimited, activityReduction } = this.state;
|
|
450
|
+
return getLimitationMessage(wasLimited, activityReduction);
|
|
451
|
+
};
|
|
452
|
+
/** Render a JSX element for displaying the insulin recommendation screen. */
|
|
453
|
+
render() {
|
|
454
|
+
if (this.hasError) {
|
|
455
|
+
return <View style={containerStyles.container}/>;
|
|
456
|
+
}
|
|
457
|
+
const { activeInsulin, activityReduction, carbRecommendation: carbRecommendationProp, enteredCarbs, enteredInsulin, insulinRecommendation, isRecommendationDisplayed, recommendationModal, remeasureTime, selectedMood, showExitModal, showLimitationMessage, showTimeoutModal, } = this.state;
|
|
458
|
+
const { BloodGlucose: BGValueTestID, BloodKetone: BKValueTestID, ActiveInsulin: ActiveInsulinValueTestID, ForecastedGlucose: FGValueTestID, } = InfoBarTestIds.Value;
|
|
459
|
+
const { ActiveInsulin: ActiveInsulinUnitTestID, BloodGlucose: BGUnitTestID, BloodKetone: BKUnitTestID, ForecastedGlucose: FGUnitTestID, } = InfoBarTestIds.Unit;
|
|
460
|
+
const carbRecommendation = carbRecommendationProp !== null ? Math.round(carbRecommendationProp) : null;
|
|
461
|
+
const recommendedCarbs = enteredCarbs ?? carbRecommendation;
|
|
462
|
+
const isModalOpen = showExitModal || showLimitationMessage || showTimeoutModal;
|
|
463
|
+
const { activityDisplayProps, bloodGlucoseUnit, bloodKetoneUnit, calculatorParams, currentBKL, injectionMethod, language, onRecentInsulinYes, forecastedGlucose, forecastedTime, } = this.props;
|
|
464
|
+
const { activity, currentBGL, carbohydrates: providedCarbs } = calculatorParams;
|
|
465
|
+
const displayedBGL = currentBGL ? Utils.displayedBGLValue(currentBGL, bloodGlucoseUnit) : null;
|
|
466
|
+
const displayedBKL = currentBKL !== null && bloodKetoneUnit ? Utils.displayedBKLValue(currentBKL, bloodKetoneUnit) : null;
|
|
467
|
+
return (<I18nProvider language={language} i18n={i18n}>
|
|
468
|
+
<KeyboardAwareScrollView scrollEnabled={!isModalOpen} style={containerStyles.container}>
|
|
469
|
+
<StatusBar backgroundColor={colors.darkBlue}/>
|
|
470
|
+
<ScrollView testID={RecommendationScreenTestIds.RecommendationScrollView} style={containerStyles.container} ref={(view) => {
|
|
471
|
+
if (view !== null) {
|
|
472
|
+
this.scrollView = view;
|
|
473
|
+
}
|
|
474
|
+
}}>
|
|
475
|
+
<Header exitCallback={this.onExit}/>
|
|
476
|
+
<InfoBars label={i18n._(t `Active Insulin`)} value={activeInsulin ? `${activeInsulin.toFixed(1)}` : null} unit={i18n._(t `units`)} showNullAsDash={false} testID={{ unitID: ActiveInsulinUnitTestID, valueID: ActiveInsulinValueTestID }}/>
|
|
477
|
+
{forecastedGlucose ? (<ForecastInfoBar label={i18n._(t `Forecasted Glucose`)} value={forecastedGlucose} unit={bloodGlucoseUnit} forecastedTime={forecastedTime} testID={{ unitID: FGUnitTestID, valueID: FGValueTestID }}/>) : (<InfoBars label={i18n._(t `Blood Glucose Level`)} value={displayedBGL} unit={bloodGlucoseUnit} showNullAsDash={true} testID={{ unitID: BGUnitTestID, valueID: BGValueTestID }}/>)}
|
|
478
|
+
<InfoBars label={i18n._(t `Blood Ketone Level`)} value={displayedBKL} unit={bloodKetoneUnit} showNullAsDash={true} testID={{ unitID: BKUnitTestID, valueID: BKValueTestID }}/>
|
|
479
|
+
<View style={containerStyles.calcContainer}>
|
|
480
|
+
<View style={containerStyles.calcMargin}>
|
|
481
|
+
<View style={containerStyles.calcBorder}>
|
|
482
|
+
<RecommendedCarbs enteredCarbs={`${providedCarbs}`} changedRecommendedCarbs={this.updateCarbRecommendation} recommendedCarbs={`${recommendedCarbs}`} removeRecommendedCarbs={this.removeCarbRecommendation}/>
|
|
483
|
+
</View>
|
|
484
|
+
</View>
|
|
485
|
+
</View>
|
|
486
|
+
{activity && activityDisplayProps && (<Activity activity={activity} activityType={activityDisplayProps.activityType} activityTitle={activityDisplayProps.activityTitle} activityReduction={activityReduction}/>)}
|
|
487
|
+
<Remeasure onSliderChange={this.updateRemeasureTime} remeasureTime={remeasureTime}/>
|
|
488
|
+
{!isRecommendationDisplayed ? (<RecentInsulin onRecentInsulinYes={onRecentInsulinYes} onRecentInsulinNo={this.handleNoRecentInsulin}/>) : (<RecommendedInsulin injectionMethod={injectionMethod} insulinRecommendation={insulinRecommendation} enteredInsulin={enteredInsulin} activityReduction={activityReduction} updateRecommendedInsulin={this.updateInsulinRecommendation}/>)}
|
|
489
|
+
<Emotion moodSelected={this.handleMoodSelected} currentMood={selectedMood}/>
|
|
490
|
+
<SaveButton visible={isRecommendationDisplayed} transfer={this.handleTransfer}/>
|
|
491
|
+
<RecommendationModal isVisible={recommendationModal} suggestedCarbohydrates={carbRecommendationProp} attentionMessage={this.getBGLevelAttentionMessage()} limitationMessage={this.getLimitationAttentionMessage()} onClickOkButton={this.hideAttentionModal} onAcceptCarbohydrates={this.acceptCarbRecommendation} onDeclineCarbohydrates={this.declineCarbRecommendation}/>
|
|
492
|
+
</ScrollView>
|
|
493
|
+
{/* Modals */}
|
|
494
|
+
{showExitModal && (<TwoOptionModal title={i18n._(t `Save data before closing?`)} message={i18n._(t `Your saved data will be used for future calculations.`)} textFirstOption={i18n._(t `Save to logbook`)} textSecondOption={i18n._(t `Close calculation`)} isCancelable={true} rowAsButtonLayout={true} firstOption={this.handleTransfer} secondOption={this.closeCalculation} onClose={this.hideExitModal}/>)}
|
|
495
|
+
{showLimitationMessage && (<View style={modalStyle.container}>
|
|
496
|
+
<LimitationMessage limitationMessage={this.getLimitationAttentionMessage()} onPressNextButton={this.hideLimitationMessage}/>
|
|
497
|
+
</View>)}
|
|
498
|
+
{showTimeoutModal &&
|
|
499
|
+
(isRecommendationDisplayed ? (<TwoOptionModal title={Messages.TimeoutPrompTitle()} message={Messages.TimeoutRecommendationVisible(this.recommendationDate)} textFirstOption={i18n._(t `Yes, save to logbook`)} textSecondOption={i18n._(t `No, return to dashboard`)} rowAsButtonLayout={false} firstOption={this.handleTransfer} secondOption={this.closeCalculation}/>) : (<TwoOptionModal title={Messages.TimeoutPrompTitle()} message={Messages.TimeoutRecommendationNotVisible()} textFirstOption={i18n._(t `Start new calculation`)} textSecondOption={i18n._(t `Return to dashboard`)} rowAsButtonLayout={false} firstOption={this.restartCalculation} secondOption={this.closeCalculation}/>))}
|
|
500
|
+
</KeyboardAwareScrollView>
|
|
501
|
+
</I18nProvider>);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
const { width } = Dimensions.get(`screen`);
|
|
505
|
+
const containerStyles = StyleSheet.create({
|
|
506
|
+
container: {
|
|
507
|
+
flex: 1,
|
|
508
|
+
backgroundColor: colors.darkBlue,
|
|
509
|
+
},
|
|
510
|
+
calcContainer: {
|
|
511
|
+
flex: 1,
|
|
512
|
+
},
|
|
513
|
+
calcMargin: {
|
|
514
|
+
flex: 1,
|
|
515
|
+
marginBottom: 0,
|
|
516
|
+
marginHorizontal: width / 17,
|
|
517
|
+
marginVertical: `3%`,
|
|
518
|
+
},
|
|
519
|
+
calcBorder: {
|
|
520
|
+
...infoStyles.border,
|
|
521
|
+
},
|
|
522
|
+
});
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Path, Svg, SvgProps } from "react-native-svg";
|
|
3
|
+
|
|
4
|
+
const EditIcon = (props: SvgProps) => (
|
|
5
|
+
<Svg width="17" height="17" viewBox="0 0 17 17" fill="none" {...props}>
|
|
6
|
+
<Path
|
|
7
|
+
fillRule="evenodd"
|
|
8
|
+
clip-rule="evenodd"
|
|
9
|
+
d="M5.66373 11.2399L5.97672 9.34945L10.659 4.66714L12.2365 6.2446L7.55418 10.9269L5.66373 11.2399Z"
|
|
10
|
+
fill="#fff"
|
|
11
|
+
/>
|
|
12
|
+
<Path
|
|
13
|
+
opacity="0.6"
|
|
14
|
+
fillRule="evenodd"
|
|
15
|
+
clip-rule="evenodd"
|
|
16
|
+
d="M8.521 16.125C12.8357 16.125 16.3335 12.6272 16.3335 8.3125C16.3335 3.99778 12.8357 0.5 8.521 0.5C4.20627 0.5 0.708496 3.99778 0.708496 8.3125C0.708496 12.6272 4.20627 16.125 8.521 16.125Z"
|
|
17
|
+
stroke="#fff"
|
|
18
|
+
strokeWidth="2"
|
|
19
|
+
/>
|
|
20
|
+
</Svg>
|
|
21
|
+
);
|
|
22
|
+
export default EditIcon;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Path, Svg, SvgProps } from "react-native-svg";
|
|
3
|
+
|
|
4
|
+
const XIcon = (props: SvgProps) => (
|
|
5
|
+
<Svg width="20" height="20" viewBox="0 0 20 20" fill="none" {...props}>
|
|
6
|
+
<Path
|
|
7
|
+
fill-rule="evenodd"
|
|
8
|
+
clip-rule="evenodd"
|
|
9
|
+
d="M4.29289 4.29289C4.68342 3.90237 5.31658 3.90237 5.70711 4.29289L10 8.58579L14.2929 4.29289C14.6834 3.90237 15.3166 3.90237 15.7071 4.29289C16.0976 4.68342 16.0976 5.31658 15.7071 5.70711L11.4142 10L15.7071 14.2929C16.0976 14.6834 16.0976 15.3166 15.7071 15.7071C15.3166 16.0976 14.6834 16.0976 14.2929 15.7071L10 11.4142L5.70711 15.7071C5.31658 16.0976 4.68342 16.0976 4.29289 15.7071C3.90237 15.3166 3.90237 14.6834 4.29289 14.2929L8.58579 10L4.29289 5.70711C3.90237 5.31658 3.90237 4.68342 4.29289 4.29289Z"
|
|
10
|
+
fill={"#8388C8"}
|
|
11
|
+
/>
|
|
12
|
+
</Svg>
|
|
13
|
+
);
|
|
14
|
+
export default XIcon;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Path, Svg } from "react-native-svg";
|
|
3
|
+
const EditIcon = (props) => (<Svg width="17" height="17" viewBox="0 0 17 17" fill="none" {...props}>
|
|
4
|
+
<Path fillRule="evenodd" clip-rule="evenodd" d="M5.66373 11.2399L5.97672 9.34945L10.659 4.66714L12.2365 6.2446L7.55418 10.9269L5.66373 11.2399Z" fill="#fff"/>
|
|
5
|
+
<Path opacity="0.6" fillRule="evenodd" clip-rule="evenodd" d="M8.521 16.125C12.8357 16.125 16.3335 12.6272 16.3335 8.3125C16.3335 3.99778 12.8357 0.5 8.521 0.5C4.20627 0.5 0.708496 3.99778 0.708496 8.3125C0.708496 12.6272 4.20627 16.125 8.521 16.125Z" stroke="#fff" strokeWidth="2"/>
|
|
6
|
+
</Svg>);
|
|
7
|
+
export default EditIcon;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Path, Svg } from "react-native-svg";
|
|
3
|
+
const XIcon = (props) => (<Svg width="20" height="20" viewBox="0 0 20 20" fill="none" {...props}>
|
|
4
|
+
<Path fill-rule="evenodd" clip-rule="evenodd" d="M4.29289 4.29289C4.68342 3.90237 5.31658 3.90237 5.70711 4.29289L10 8.58579L14.2929 4.29289C14.6834 3.90237 15.3166 3.90237 15.7071 4.29289C16.0976 4.68342 16.0976 5.31658 15.7071 5.70711L11.4142 10L15.7071 14.2929C16.0976 14.6834 16.0976 15.3166 15.7071 15.7071C15.3166 16.0976 14.6834 16.0976 14.2929 15.7071L10 11.4142L5.70711 15.7071C5.31658 16.0976 4.68342 16.0976 4.29289 15.7071C3.90237 15.3166 3.90237 14.6834 4.29289 14.2929L8.58579 10L4.29289 5.70711C3.90237 5.31658 3.90237 4.68342 4.29289 4.29289Z" fill={"#8388C8"}/>
|
|
5
|
+
</Svg>);
|
|
6
|
+
export default XIcon;
|