@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
|
@@ -1,303 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Alert, StyleSheet, TouchableOpacity, View } from "react-native";
|
|
3
|
-
|
|
4
|
-
import CloseOutlined from "../assets/IconsSVG/CloseOutlined";
|
|
5
|
-
import Edit from "../assets/IconsSVG/Edit";
|
|
6
|
-
import { t } from "../locales/translate";
|
|
7
|
-
import { Testing } from "../types/enum";
|
|
8
|
-
import { colors } from "../utils/Constants";
|
|
9
|
-
import { CarbohydrateLimitError } from "../utils/RecommendationError";
|
|
10
|
-
import InvisibleNumberInput from "./InvisibleNumberInput";
|
|
11
|
-
import LineSeparator from "./LineSeparator";
|
|
12
|
-
import { FONTS } from "./styles/fonts";
|
|
13
|
-
import Text from "./Text";
|
|
14
|
-
|
|
15
|
-
const { RecommendedCarbsTestIds } = Testing.Id;
|
|
16
|
-
|
|
17
|
-
export interface ICalculationRow {
|
|
18
|
-
label: string;
|
|
19
|
-
value: string;
|
|
20
|
-
units: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface IProps {
|
|
24
|
-
/** The amount of carbs in grams that was recommended to and accepted by the user. */
|
|
25
|
-
recommendedCarbs?: string;
|
|
26
|
-
/** The amount of carbs in grams that the user entered on the food screen. */
|
|
27
|
-
enteredCarbs: string;
|
|
28
|
-
|
|
29
|
-
/** Callback function that doesn’t accept any arguments and doesn’t return anything - To be called every time the “remove additional carbs” button has been pressed. */
|
|
30
|
-
removeRecommendedCarbs(): void;
|
|
31
|
-
/**
|
|
32
|
-
* Callback function that takes a single number as argument and doesn’t return anything.
|
|
33
|
-
* Function to be called when the entered carbohydrate value is changed by the user. The new value should be given as argument
|
|
34
|
-
*/
|
|
35
|
-
changedRecommendedCarbs(value: number): void;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface IState {
|
|
39
|
-
/** The internal value of the input field. */
|
|
40
|
-
partialInput?: string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* The contents of the RecommendedCarbs component may vary quite a bit depending on data that was entered by the user
|
|
45
|
-
* and on the result of the recommendation calculation.
|
|
46
|
-
* For instance the part of the component that displays any recommendation of eating additional carbohydrates
|
|
47
|
-
* (composed by the renderRecommendedCarbs() method) will only be visible if it is actually recommended that the user eats additional carbohydrates.
|
|
48
|
-
*/
|
|
49
|
-
export default class RecommendedCarbs extends React.Component<IProps, IState> {
|
|
50
|
-
/** Initialise the state partialInput variable with undefined */
|
|
51
|
-
public state: IState = {
|
|
52
|
-
partialInput: undefined,
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Function taking no arguments and returning no value.
|
|
57
|
-
* Will be bound to the function that activates input for InvisibleNumberInput when that component has been mounted.
|
|
58
|
-
*/
|
|
59
|
-
public callbackInput?: () => void;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Handle what should happen when the additional carbohydrates amount has been pressed.
|
|
63
|
-
* Uses the InvisibleNumberInput child component to enable the user to input the amount of additional carbohydrates that they are taking.
|
|
64
|
-
*/
|
|
65
|
-
public showTextInput = (): void => {
|
|
66
|
-
this.callbackInput?.();
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Passed to the InvisibleNumberInput child component as a callback function to be called every time the content of the input field changes.
|
|
71
|
-
*
|
|
72
|
-
* Steps:
|
|
73
|
-
* 1. Save partialInput argument to the partialInput state variable.
|
|
74
|
-
* @param partialInput The contents of the input field.
|
|
75
|
-
*/
|
|
76
|
-
public handlePartialInput = (partialInput: string): void => {
|
|
77
|
-
this.setState({
|
|
78
|
-
partialInput,
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Handle what happens when input in the InvisibleNumberInput child component is completed.
|
|
84
|
-
*
|
|
85
|
-
* Steps:
|
|
86
|
-
* 1. If the carbs argument is greater than or equal to 0:
|
|
87
|
-
* - If the carbs argument is greater than 300:
|
|
88
|
-
* - Set the partialInput state variable to the value of the recommemdedCarbs prop.
|
|
89
|
-
* - Return - An alert message with the message of CarbohydrateLimitError() and with an OK button for closing it.
|
|
90
|
-
* - Use carbs as argument to call the changedRecommendedCarbs prop callback function.
|
|
91
|
-
|
|
92
|
-
* @param carbs The numerical value of the input field at completion.
|
|
93
|
-
* @returns void
|
|
94
|
-
*/
|
|
95
|
-
public handleChangedCarbs = (carbs: number): void => {
|
|
96
|
-
if (carbs >= 0) {
|
|
97
|
-
if (carbs > 300) {
|
|
98
|
-
this.setState({ partialInput: this.props.recommendedCarbs });
|
|
99
|
-
return Alert.alert(t(`Attention`), CarbohydrateLimitError().message, [{ text: t(`OK`) }]);
|
|
100
|
-
}
|
|
101
|
-
this.props.changedRecommendedCarbs(carbs);
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Render the section of the component that displays the extra carbs that the user should eat
|
|
107
|
-
* and allows the user to change the contents to indicate how many extra carbs they are actually going to eat.
|
|
108
|
-
*
|
|
109
|
-
* Steps:
|
|
110
|
-
* 1. Set a variable named shownCarbs to the partialInput state if it is set, or to the recommendedCarbs prop rounded to the nearest integer otherwise.
|
|
111
|
-
* 2. Set a variable named totalCarbs to the sum of the enteredCarbs prop and shownCarbs rounded to the nearest integer.
|
|
112
|
-
* 3. Compose and return a JSX element consisting of the following sub-components
|
|
113
|
-
* - A cancel button to remove recommended carbs from the calculation - When tapped, call the removeRecommendedCarbs prop callback function.
|
|
114
|
-
* - The text from the shownCarbs variable from step 1 - When tapped, call the showTextInput() method.
|
|
115
|
-
* - Use renderRow() to display the value of totalCarbs.
|
|
116
|
-
* - InvisibleNumberInput for showing the keyboard to enable the user to enter a number.
|
|
117
|
-
*/
|
|
118
|
-
public renderRecommendedCarbs = (): JSX.Element => {
|
|
119
|
-
const shownCarbs = this.state.partialInput ?? Math.round(Number(this.props.recommendedCarbs));
|
|
120
|
-
const totalCarbs = Math.round(parseFloat(this.props.enteredCarbs) + Number(shownCarbs));
|
|
121
|
-
return (
|
|
122
|
-
<React.Fragment>
|
|
123
|
-
<LineSeparator borderBottomColor={colors.dustyDarkBlue} marginBottom={8} marginTop={16} />
|
|
124
|
-
<View style={[style.container, { marginBottom: 4 }]}>
|
|
125
|
-
<View style={style.recommendedContainer}>
|
|
126
|
-
<TouchableOpacity
|
|
127
|
-
testID={RecommendedCarbsTestIds.RemoveRecommendation}
|
|
128
|
-
style={style.removeRecommended}
|
|
129
|
-
onPress={this.props.removeRecommendedCarbs}
|
|
130
|
-
>
|
|
131
|
-
{CloseOutlined({ style: style.removeRecommendedIcon })}
|
|
132
|
-
</TouchableOpacity>
|
|
133
|
-
<Text style={style.recommendedLabel}>{t(`Recommended`)}</Text>
|
|
134
|
-
</View>
|
|
135
|
-
</View>
|
|
136
|
-
<View style={style.container}>
|
|
137
|
-
<View style={style.recommendedContainer}>
|
|
138
|
-
<Text style={{ ...style.recommendedLabel, color: colors.teal }}>{t(`Additional`)}</Text>
|
|
139
|
-
</View>
|
|
140
|
-
<View style={style.valueUnitContainer}>
|
|
141
|
-
<TouchableOpacity
|
|
142
|
-
testID={RecommendedCarbsTestIds.EditRecommendedCarbs}
|
|
143
|
-
onPress={this.showTextInput}
|
|
144
|
-
style={[style.valueUnitContainer]}
|
|
145
|
-
>
|
|
146
|
-
<Text
|
|
147
|
-
testID={RecommendedCarbsTestIds.RecommendedCarbs}
|
|
148
|
-
style={{ ...style.value, color: colors.teal }}
|
|
149
|
-
>
|
|
150
|
-
{shownCarbs}
|
|
151
|
-
</Text>
|
|
152
|
-
{Edit({ color: colors.teal, style: style.editIcon })}
|
|
153
|
-
<Text style={{ ...style.units, color: colors.teal }}>{t(`grams`)}</Text>
|
|
154
|
-
</TouchableOpacity>
|
|
155
|
-
</View>
|
|
156
|
-
</View>
|
|
157
|
-
<LineSeparator borderBottomColor={colors.dustyDarkBlue} marginBottom={16} marginTop={8} />
|
|
158
|
-
{this.renderRow(
|
|
159
|
-
{
|
|
160
|
-
label: t(`Total`),
|
|
161
|
-
value: totalCarbs.toString(),
|
|
162
|
-
units: t(`grams`),
|
|
163
|
-
},
|
|
164
|
-
RecommendedCarbsTestIds.TotalCarbs,
|
|
165
|
-
)}
|
|
166
|
-
<InvisibleNumberInput
|
|
167
|
-
testID={RecommendedCarbsTestIds.InvisibleCarbInput}
|
|
168
|
-
negativeAllowed={false}
|
|
169
|
-
cleanPartialInput={true}
|
|
170
|
-
decimalPlaces={0}
|
|
171
|
-
visible={(callback): (() => void) => (this.callbackInput = callback)}
|
|
172
|
-
partialInput={this.handlePartialInput}
|
|
173
|
-
onEnd={this.handleChangedCarbs}
|
|
174
|
-
startValue={this.props.recommendedCarbs}
|
|
175
|
-
maxLength={3}
|
|
176
|
-
/>
|
|
177
|
-
</React.Fragment>
|
|
178
|
-
);
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Display a row of information for the user. Specifically used to display the amount of carbohydrates that the user has entered.
|
|
183
|
-
* @param row The values to display
|
|
184
|
-
* @param testID Id used for component testing
|
|
185
|
-
* @returns A JSX element to display 3 strings on the screen: label, value, and a unit.
|
|
186
|
-
*/
|
|
187
|
-
public renderRow = (row: ICalculationRow, testID: Testing.Id.RecommendedCarbsTestIds): JSX.Element => {
|
|
188
|
-
return (
|
|
189
|
-
<View style={style.container}>
|
|
190
|
-
<View style={style.rowContainer}>
|
|
191
|
-
<Text style={style.rowLabel}>{row.label}</Text>
|
|
192
|
-
</View>
|
|
193
|
-
<View style={style.valueUnitContainer}>
|
|
194
|
-
<Text testID={testID} style={style.value}>
|
|
195
|
-
{row.value}
|
|
196
|
-
</Text>
|
|
197
|
-
<Text style={style.units}>{row.units}</Text>
|
|
198
|
-
</View>
|
|
199
|
-
</View>
|
|
200
|
-
);
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Steps:
|
|
205
|
-
* 1. Convert the recommendedCarbs prop to a number and save that as a variable named carbs.
|
|
206
|
-
* 2. Use renderRow() to display the user’s entered amount of carbohydrates
|
|
207
|
-
* 3. If carbs is not a NaN-value and it is positive, call renderRecommendedCarbs() to display the carbohydrate recommendation.
|
|
208
|
-
*/
|
|
209
|
-
public render(): JSX.Element {
|
|
210
|
-
const carbs = Number(this.props.recommendedCarbs);
|
|
211
|
-
return (
|
|
212
|
-
<React.Fragment>
|
|
213
|
-
<View style={style.foodTitleContainer}>
|
|
214
|
-
<Text style={style.label}>{t(`Food`)}</Text>
|
|
215
|
-
<Text style={style.foodUnitsLabel}>{`(${t(`Carbohydrates`)})`}</Text>
|
|
216
|
-
</View>
|
|
217
|
-
{this.renderRow(
|
|
218
|
-
{
|
|
219
|
-
label: t(`Entered`),
|
|
220
|
-
value: this.props.enteredCarbs,
|
|
221
|
-
units: t(`grams`),
|
|
222
|
-
},
|
|
223
|
-
RecommendedCarbsTestIds.EnteredCarbs,
|
|
224
|
-
)}
|
|
225
|
-
{!isNaN(carbs) && carbs > 0 ? this.renderRecommendedCarbs() : null}
|
|
226
|
-
</React.Fragment>
|
|
227
|
-
);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
const style = StyleSheet.create({
|
|
232
|
-
container: {
|
|
233
|
-
flexDirection: `row`,
|
|
234
|
-
alignItems: `center`,
|
|
235
|
-
},
|
|
236
|
-
foodTitleContainer: {
|
|
237
|
-
flexDirection: `row`,
|
|
238
|
-
alignItems: `center`,
|
|
239
|
-
marginBottom: 4,
|
|
240
|
-
},
|
|
241
|
-
foodUnitsLabel: {
|
|
242
|
-
...FONTS.Poppins.regular_XS,
|
|
243
|
-
textAlign: `left`,
|
|
244
|
-
paddingLeft: 4,
|
|
245
|
-
color: colors.lightBlue,
|
|
246
|
-
},
|
|
247
|
-
rowContainer: {
|
|
248
|
-
flex: 7,
|
|
249
|
-
},
|
|
250
|
-
rowLabel: {
|
|
251
|
-
...FONTS.Poppins.regular_Base,
|
|
252
|
-
color: colors.white,
|
|
253
|
-
},
|
|
254
|
-
enteredContainer: {
|
|
255
|
-
flex: 3,
|
|
256
|
-
alignItems: `flex-end`,
|
|
257
|
-
},
|
|
258
|
-
valueUnitContainer: {
|
|
259
|
-
flex: 6.5,
|
|
260
|
-
justifyContent: `flex-end`,
|
|
261
|
-
alignItems: `baseline`,
|
|
262
|
-
flexDirection: `row`,
|
|
263
|
-
},
|
|
264
|
-
value: {
|
|
265
|
-
...FONTS.Poppins.medium_2XL,
|
|
266
|
-
color: colors.white,
|
|
267
|
-
textAlign: `right`,
|
|
268
|
-
},
|
|
269
|
-
units: {
|
|
270
|
-
...FONTS.Poppins.regular_XS,
|
|
271
|
-
color: colors.white,
|
|
272
|
-
textAlign: `left`,
|
|
273
|
-
paddingLeft: 4,
|
|
274
|
-
},
|
|
275
|
-
recommendedContainer: {
|
|
276
|
-
flex: 7,
|
|
277
|
-
flexDirection: `row`,
|
|
278
|
-
},
|
|
279
|
-
recommendedLabel: {
|
|
280
|
-
...FONTS.Poppins.regular_Base,
|
|
281
|
-
color: colors.teal,
|
|
282
|
-
},
|
|
283
|
-
removeRecommended: {
|
|
284
|
-
justifyContent: `center`,
|
|
285
|
-
alignItems: `center`,
|
|
286
|
-
},
|
|
287
|
-
removeRecommendedIcon: {
|
|
288
|
-
height: 20,
|
|
289
|
-
width: 20,
|
|
290
|
-
marginRight: 4,
|
|
291
|
-
},
|
|
292
|
-
editIcon: {
|
|
293
|
-
height: 16,
|
|
294
|
-
width: 16,
|
|
295
|
-
right: 0,
|
|
296
|
-
top: -8,
|
|
297
|
-
position: `absolute`,
|
|
298
|
-
},
|
|
299
|
-
label: {
|
|
300
|
-
...FONTS.Poppins.regular_Base,
|
|
301
|
-
color: colors.white,
|
|
302
|
-
},
|
|
303
|
-
});
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Alert, StyleSheet, TouchableOpacity, View } from "react-native";
|
|
3
|
-
|
|
4
|
-
import { BolusCalculator, UserSettings } from "@hedia/types";
|
|
5
|
-
|
|
6
|
-
import Edit from "../assets/IconsSVG/Edit";
|
|
7
|
-
import { t } from "../locales/translate";
|
|
8
|
-
import { Testing } from "../types/enum";
|
|
9
|
-
import { Messages } from "../utils/AttentionMessages";
|
|
10
|
-
import { colors } from "../utils/Constants";
|
|
11
|
-
import { Utils } from "../utils/Utils";
|
|
12
|
-
import InvisibleNumberInput from "./InvisibleNumberInput";
|
|
13
|
-
import { FONTS } from "./styles/fonts";
|
|
14
|
-
import Text from "./Text";
|
|
15
|
-
|
|
16
|
-
const { RecommendedInsulinTestIds } = Testing.Id;
|
|
17
|
-
|
|
18
|
-
export interface IProps {
|
|
19
|
-
/** The amount of insulin in units to display to the user as a recommendation. */
|
|
20
|
-
insulinRecommendation: number;
|
|
21
|
-
/** The amount of insulin introduced by the user. */
|
|
22
|
-
enteredInsulin: number | null;
|
|
23
|
-
/**
|
|
24
|
-
* The factor by which the recommendation was multiplied to get the reduced insulin amount.
|
|
25
|
-
* Used by the RecommendedInsulin component to check that the user’s input doesn’t exceed the maximum allowed.
|
|
26
|
-
* If no activity has been entered, this prop should be null.
|
|
27
|
-
* */
|
|
28
|
-
activityReduction: number | null;
|
|
29
|
-
/** Used to determine how the insulin amount should be rounded. */
|
|
30
|
-
injectionMethod: UserSettings.Enums.InjectionMethod;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Callback function taking a number as argument and giving no return value.
|
|
34
|
-
* To be called with the new value every time the content of the insulin input field gets changed.
|
|
35
|
-
*/
|
|
36
|
-
updateRecommendedInsulin(value: number): void;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface IState {
|
|
40
|
-
/** The entered amount of insulin as a string. */
|
|
41
|
-
partialInput?: string;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const SAFETY_INSULIN_LIMIT = BolusCalculator.Constants.SAFETY_INSULIN_LIMIT;
|
|
45
|
-
|
|
46
|
-
/** Input field for displaying the entered amount of insulin (which defaults to HDA’s recommendation) and allowing the user to edit it. */
|
|
47
|
-
export default class RecommendedInsulin extends React.Component<IProps, IState> {
|
|
48
|
-
/** Initialise the state partialInput variable with undefined */
|
|
49
|
-
public state: IState = {
|
|
50
|
-
partialInput: undefined,
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Function taking no arguments and returning no value.
|
|
54
|
-
* Will be bound to the function that activates input for InvisibleNumberInput when that component has been mounted.
|
|
55
|
-
*/
|
|
56
|
-
public callbackInput?: () => void;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Called immediately after updating occurs. Not called for the initial render.
|
|
60
|
-
* The snapshot is only present if getSnapshotBeforeUpdate is present and returns non-null.
|
|
61
|
-
*
|
|
62
|
-
* Steps:
|
|
63
|
-
* 1. If the value of the enteredInsulin prop was changed, set the partialInput state variable to the new value.
|
|
64
|
-
* @param prevProps The previous component props
|
|
65
|
-
*/
|
|
66
|
-
public componentDidUpdate(prevProps: IProps): void {
|
|
67
|
-
const { enteredInsulin } = this.props;
|
|
68
|
-
if (prevProps.enteredInsulin !== enteredInsulin) {
|
|
69
|
-
this.setState({ partialInput: enteredInsulin?.toString() });
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Handle what should happen when the InsulinRecommendation component has been pressed.
|
|
75
|
-
* Uses the InvisibleNumberInput child component to enable the user to input the amount of insulin that hey are taking.
|
|
76
|
-
*
|
|
77
|
-
* Steps:
|
|
78
|
-
* 1. Call the callbackInput() member method.
|
|
79
|
-
*/
|
|
80
|
-
public handleOnPress = (): void => {
|
|
81
|
-
this.callbackInput?.();
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Passed to the InvisibleNumberInput child component as a callback function to be called every time the content of the input field changes.
|
|
86
|
-
*
|
|
87
|
-
* Steps:
|
|
88
|
-
* 1. Assign a new local variable, replacedZero, with the value of the insulin argument string
|
|
89
|
-
* except for the first character if insulin is longer than 1 character and starts with a '0' but doesn’t start with ‘0.’.
|
|
90
|
-
* Otherwise set it to insulin. This would be better handled by converting it to a number: replacedZero = Number(insulin);
|
|
91
|
-
* 2. Save replacedZero to the partialInput state variable.
|
|
92
|
-
* 3. Return replacedZero
|
|
93
|
-
* @param insulin The contents of the input field.
|
|
94
|
-
* @returns The partially cleaned input.
|
|
95
|
-
*/
|
|
96
|
-
public updatePartially = (insulin: string): string => {
|
|
97
|
-
const replacedZero =
|
|
98
|
-
insulin.length > 1 && insulin.startsWith(`0`) && !insulin.startsWith(`0.`) ? insulin.substring(1) : insulin;
|
|
99
|
-
this.setState({
|
|
100
|
-
partialInput: replacedZero,
|
|
101
|
-
});
|
|
102
|
-
return replacedZero;
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Handle what happens when input in the InvisibleNumberInput child component is completed.
|
|
107
|
-
*
|
|
108
|
-
* Steps:
|
|
109
|
-
* 1. Get the rounded insulin amount using the value argument and the injectionMethod prop as arguments for the Utils.roundValue() function.
|
|
110
|
-
* 2. Get the adjusted safety insulin limit (due to activity) by multiplying the activity reduction factor (which is 1 minus the activityReduction prop) with the SAFETY_INSULIN_LIMIT constant.
|
|
111
|
-
* 3. If the rounded value exceeds the adjusted safety threshold:
|
|
112
|
-
* - Call the updatePartially() method with the adjusted safety threshold to set the insulin amount to the capped value.
|
|
113
|
-
* - Return an Alert with a message about the insulin limit.
|
|
114
|
-
* 4. Call the updatePartially() method with the rounded value to set the entered insulin value.
|
|
115
|
-
* 5. Call the updateRecommendedInsulin callback function prop with rounded as the argument to report back the updated insulin amount to the parent RecommendationScreen component.
|
|
116
|
-
* @param value The numerical value of the input field at completion.
|
|
117
|
-
*/
|
|
118
|
-
public handleUpdatedInsulin = (value: number): void => {
|
|
119
|
-
const rounded = Utils.roundValue(value, this.props.injectionMethod);
|
|
120
|
-
|
|
121
|
-
// https://hedia.atlassian.net/browse/HDA-795
|
|
122
|
-
const limited = (1 - (this.props.activityReduction ?? 0)) * SAFETY_INSULIN_LIMIT;
|
|
123
|
-
|
|
124
|
-
if (rounded > limited) {
|
|
125
|
-
this.setState({ partialInput: this.props.insulinRecommendation?.toString() ?? null });
|
|
126
|
-
this.props.updateRecommendedInsulin(this.props.insulinRecommendation);
|
|
127
|
-
return Alert.alert(t(`Attention`), Messages.InsulinInputWasLimited(this.props.activityReduction), [
|
|
128
|
-
{ text: t(`OK`) },
|
|
129
|
-
]);
|
|
130
|
-
}
|
|
131
|
-
this.updatePartially(`${rounded}`);
|
|
132
|
-
this.props.updateRecommendedInsulin(rounded);
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Render a JSX element to display the insulin input field with the current insulin amount value
|
|
137
|
-
* and using an InvisibleNumberInput component to enable input when the insulin amount is tapped.
|
|
138
|
-
*/
|
|
139
|
-
public render = (): JSX.Element => {
|
|
140
|
-
const shownInsulin = this.state.partialInput ?? this.props.insulinRecommendation ?? `0`;
|
|
141
|
-
const { EditRecommendedInsulin, EditRecommendedInsulinIcon, ShownInsulinText, InvisibleInsulinInput } =
|
|
142
|
-
RecommendedInsulinTestIds;
|
|
143
|
-
|
|
144
|
-
return (
|
|
145
|
-
<React.Fragment>
|
|
146
|
-
<TouchableOpacity testID={EditRecommendedInsulin} onPress={this.handleOnPress} style={style.container}>
|
|
147
|
-
<Text style={style.titleText}>{t(`Recommended amount of insulin`)}</Text>
|
|
148
|
-
<Text style={style.insulinText} testID={ShownInsulinText}>
|
|
149
|
-
{shownInsulin}
|
|
150
|
-
</Text>
|
|
151
|
-
<Text style={style.unitsText}>{t(`Units`)}</Text>
|
|
152
|
-
<View style={style.enterManually}>
|
|
153
|
-
{Edit({ color: colors.teal, style: style.editIcon, testID: EditRecommendedInsulinIcon })}
|
|
154
|
-
<Text style={style.editText}>{t(`Enter Manually`)}</Text>
|
|
155
|
-
</View>
|
|
156
|
-
</TouchableOpacity>
|
|
157
|
-
|
|
158
|
-
<InvisibleNumberInput
|
|
159
|
-
testID={InvisibleInsulinInput}
|
|
160
|
-
decimalPlaces={1}
|
|
161
|
-
maxLength={4}
|
|
162
|
-
negativeAllowed={false}
|
|
163
|
-
cleanPartialInput={false}
|
|
164
|
-
partialInput={this.updatePartially}
|
|
165
|
-
onEnd={this.handleUpdatedInsulin}
|
|
166
|
-
visible={(visible): (() => void) => (this.callbackInput = visible)}
|
|
167
|
-
startValue={`${shownInsulin}`}
|
|
168
|
-
/>
|
|
169
|
-
</React.Fragment>
|
|
170
|
-
);
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
const style = StyleSheet.create({
|
|
175
|
-
container: {
|
|
176
|
-
borderRadius: 5,
|
|
177
|
-
padding: 16,
|
|
178
|
-
backgroundColor: colors.deepPurple,
|
|
179
|
-
marginBottom: 32,
|
|
180
|
-
minHeight: 200,
|
|
181
|
-
},
|
|
182
|
-
editText: {
|
|
183
|
-
...FONTS.Poppins.regular_SM,
|
|
184
|
-
color: colors.teal,
|
|
185
|
-
textAlign: `center`,
|
|
186
|
-
},
|
|
187
|
-
unitsText: {
|
|
188
|
-
...FONTS.Poppins.medium_XS,
|
|
189
|
-
color: colors.white,
|
|
190
|
-
textAlign: `center`,
|
|
191
|
-
marginTop: -16,
|
|
192
|
-
marginBottom: 16,
|
|
193
|
-
},
|
|
194
|
-
insulinText: {
|
|
195
|
-
...FONTS.Poppins.bold_6XL,
|
|
196
|
-
fontSize: 80,
|
|
197
|
-
color: colors.white,
|
|
198
|
-
textAlign: `center`,
|
|
199
|
-
minHeight: 110,
|
|
200
|
-
lineHeight: 90,
|
|
201
|
-
letterSpacing: 6,
|
|
202
|
-
justifyContent: `center`,
|
|
203
|
-
},
|
|
204
|
-
titleText: {
|
|
205
|
-
...FONTS.Poppins.medium_Base,
|
|
206
|
-
color: colors.white,
|
|
207
|
-
textAlign: `center`,
|
|
208
|
-
marginBottom: 16,
|
|
209
|
-
},
|
|
210
|
-
editIcon: {
|
|
211
|
-
height: 16,
|
|
212
|
-
width: 16,
|
|
213
|
-
marginRight: 4,
|
|
214
|
-
alignSelf: `center`,
|
|
215
|
-
},
|
|
216
|
-
enterManually: {
|
|
217
|
-
flexDirection: `row`,
|
|
218
|
-
justifyContent: `center`,
|
|
219
|
-
},
|
|
220
|
-
});
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import Slider from "@react-native-community/slider";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { StyleSheet, View } from "react-native";
|
|
4
|
-
|
|
5
|
-
import { t } from "../locales/translate";
|
|
6
|
-
import { Testing } from "../types/enum";
|
|
7
|
-
import { colors } from "../utils/Constants";
|
|
8
|
-
import { FONTS } from "./styles/fonts";
|
|
9
|
-
import Text from "./Text";
|
|
10
|
-
|
|
11
|
-
export interface IProps {
|
|
12
|
-
/** The initial time (in hours) after which the user should be reminded to measure their BGL. */
|
|
13
|
-
remeasureTime: number;
|
|
14
|
-
/**
|
|
15
|
-
* Callback function taking a single number (the new remeasurement time) as argument
|
|
16
|
-
* Function to be called every time the slider component is changed to a new value.
|
|
17
|
-
*/
|
|
18
|
-
onSliderChange(value: number): void;
|
|
19
|
-
}
|
|
20
|
-
export interface IState {
|
|
21
|
-
remeasureTime: number;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* The Remeasure component has a slider child component that the user can drag to change
|
|
26
|
-
* when they will get a reminder notification about measuring their BGL again.
|
|
27
|
-
*/
|
|
28
|
-
export default class Remeasure extends React.Component<IProps, IState> {
|
|
29
|
-
constructor(props: IProps) {
|
|
30
|
-
super(props);
|
|
31
|
-
this.state = { remeasureTime: props.remeasureTime };
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Steps:
|
|
36
|
-
* 1. Use limitTime() to limit/clamp the value of remeasureTime in the range 0 to 6.
|
|
37
|
-
* 2. Call the onSliderChange prop callback function with the limited value as argument.
|
|
38
|
-
* @param remeasureTime The value of the remeasurement slider.
|
|
39
|
-
*/
|
|
40
|
-
public handleSliderChange = (remeasureTime: number): void => {
|
|
41
|
-
this.setState({ remeasureTime });
|
|
42
|
-
const limited = this.limitTime(remeasureTime);
|
|
43
|
-
this.props.onSliderChange(limited);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Steps:
|
|
48
|
-
* 1.Use Math.min() and Math.max() to clamp remeasureTime in the range 0 to 6 and return the result.
|
|
49
|
-
* @param remeasureTime The value of the remeasurement slider.
|
|
50
|
-
* @returns The limited remeasurement time in hours
|
|
51
|
-
*/
|
|
52
|
-
public limitTime = (remeasureTime: number): number => {
|
|
53
|
-
return Math.min(Math.max(0, remeasureTime), 6);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Compose a JSX element for displaying the currently selected remeasurement time along
|
|
58
|
-
* with a horizontal slider for changing it in increments of 0.5 hours in the range 0 to 6.
|
|
59
|
-
*/
|
|
60
|
-
public render(): JSX.Element {
|
|
61
|
-
const measure = this.state.remeasureTime > 0;
|
|
62
|
-
const limited = this.limitTime(this.state.remeasureTime);
|
|
63
|
-
const { RemeasureHours, RemeasureSlider } = Testing.Id.RemeasureTestIds;
|
|
64
|
-
return (
|
|
65
|
-
<View style={styles.container}>
|
|
66
|
-
<View style={styles.textContainer}>
|
|
67
|
-
<Text style={styles.remeasureLabel} maxFontSizeMultiplier={1}>
|
|
68
|
-
{t(`Remind me to remeasure in`)}
|
|
69
|
-
</Text>
|
|
70
|
-
<View style={styles.valueUnitContainer}>
|
|
71
|
-
<Text style={styles.value} testID={RemeasureHours} maxFontSizeMultiplier={1}>
|
|
72
|
-
{measure ? limited : t(`OFF`)}
|
|
73
|
-
</Text>
|
|
74
|
-
{measure && (
|
|
75
|
-
<Text style={styles.units} maxFontSizeMultiplier={1}>
|
|
76
|
-
{t(`hours`)}
|
|
77
|
-
</Text>
|
|
78
|
-
)}
|
|
79
|
-
</View>
|
|
80
|
-
</View>
|
|
81
|
-
|
|
82
|
-
<Slider
|
|
83
|
-
testID={RemeasureSlider}
|
|
84
|
-
maximumTrackTintColor={colors.mistBlue}
|
|
85
|
-
minimumTrackTintColor={colors.blue}
|
|
86
|
-
thumbTintColor={colors.white}
|
|
87
|
-
maximumValue={6}
|
|
88
|
-
minimumValue={0}
|
|
89
|
-
step={0.5}
|
|
90
|
-
onValueChange={this.handleSliderChange}
|
|
91
|
-
value={limited}
|
|
92
|
-
/>
|
|
93
|
-
</View>
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const styles = StyleSheet.create({
|
|
99
|
-
container: {
|
|
100
|
-
flexDirection: `column`,
|
|
101
|
-
marginVertical: 32,
|
|
102
|
-
},
|
|
103
|
-
textContainer: {
|
|
104
|
-
flexDirection: `row`,
|
|
105
|
-
marginBottom: 18,
|
|
106
|
-
},
|
|
107
|
-
remeasureLabel: {
|
|
108
|
-
...FONTS.Poppins.regular_Base,
|
|
109
|
-
color: colors.white,
|
|
110
|
-
flex: 7,
|
|
111
|
-
alignSelf: `center`,
|
|
112
|
-
},
|
|
113
|
-
offText: {
|
|
114
|
-
...FONTS.Poppins.bold_Base,
|
|
115
|
-
color: colors.white,
|
|
116
|
-
},
|
|
117
|
-
valueUnitContainer: {
|
|
118
|
-
flex: 3,
|
|
119
|
-
justifyContent: `center`,
|
|
120
|
-
alignItems: `baseline`,
|
|
121
|
-
flexDirection: `row`,
|
|
122
|
-
alignSelf: `center`,
|
|
123
|
-
},
|
|
124
|
-
value: {
|
|
125
|
-
...FONTS.Poppins.medium_2XL,
|
|
126
|
-
textAlign: `right`,
|
|
127
|
-
color: colors.white,
|
|
128
|
-
},
|
|
129
|
-
units: {
|
|
130
|
-
...FONTS.Poppins.regular_XS,
|
|
131
|
-
textAlign: `left`,
|
|
132
|
-
paddingLeft: 4,
|
|
133
|
-
color: colors.white,
|
|
134
|
-
},
|
|
135
|
-
});
|
package/src/components/Text.tsx
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { StyleSheet, Text as RNText, TextProps, TextStyle } from "react-native";
|
|
3
|
-
|
|
4
|
-
import { FontFamily, FONTS } from "./styles/fonts";
|
|
5
|
-
|
|
6
|
-
const maxFontSizeMultiplier = 1.235;
|
|
7
|
-
|
|
8
|
-
export type StyleWithFont = Omit<TextStyle, `fontFamily` | `fontSize` | `lineHeight`> & {
|
|
9
|
-
fontFamily: FontFamily;
|
|
10
|
-
fontSize: number;
|
|
11
|
-
lineHeight: number;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
type CustomTextPropsStyle = Omit<TextProps, `style`> & { style?: StyleWithFont };
|
|
15
|
-
|
|
16
|
-
const Text = (props: CustomTextPropsStyle) => (
|
|
17
|
-
<RNText {...props} style={[styles.defaultText, props.style]} maxFontSizeMultiplier={maxFontSizeMultiplier}>
|
|
18
|
-
{props.children}
|
|
19
|
-
</RNText>
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
const styles = StyleSheet.create({
|
|
23
|
-
defaultText: {
|
|
24
|
-
...FONTS.Poppins.regular_Base,
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
export default Text;
|