@hedia/recommendation-screen 2.1.75 → 2.2.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +349 -0
- package/dist/src/locale/de/messages.js +1 -0
- package/dist/src/locale/de/messages.po +349 -0
- package/dist/src/locale/en/messages.js +1 -0
- package/dist/src/locale/en/messages.po +349 -0
- package/dist/src/locale/es/messages.js +1 -0
- package/dist/src/locale/es/messages.po +349 -0
- package/dist/src/locale/fr/messages.js +1 -0
- package/dist/src/locale/fr/messages.po +349 -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 +349 -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,291 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { SafeAreaView, ScrollView, StatusBar, StyleSheet, TouchableOpacity, View } from "react-native";
|
|
3
|
-
import ReactNativeModal from "react-native-modal";
|
|
4
|
-
import { t } from "../locales/translate";
|
|
5
|
-
import { Testing } from "../types/enum";
|
|
6
|
-
import { colors } from "../utils/Constants";
|
|
7
|
-
import { FONTS } from "./styles/fonts";
|
|
8
|
-
import Text from "./Text";
|
|
9
|
-
const {
|
|
10
|
-
RecommendationModalTestIds
|
|
11
|
-
} = Testing.Id;
|
|
12
|
-
/**
|
|
13
|
-
* Popup modal for displaying information messages or warnings to the user if necessary.
|
|
14
|
-
* The modal has two “pages” with different content that it is able to display.
|
|
15
|
-
* The first page is for informing the user if their insulin recommendation was limited by the maximum insulin safety limit.
|
|
16
|
-
* This page will only be displayed if the recommendation was actually limited.
|
|
17
|
-
* The second page is for displaying a general attention message that may contain instructions for the user,
|
|
18
|
-
* and for letting the user know if they are being recommended eating additional carbohydrates.
|
|
19
|
-
*/
|
|
20
|
-
export default class RecommendationModal extends React.Component {
|
|
21
|
-
/**
|
|
22
|
-
* Steps:
|
|
23
|
-
* 1. Call the super() method with the props.
|
|
24
|
-
* 2. Set the firstPageVisible state variable true if the limitationMessage prop is truthy.
|
|
25
|
-
* @param props The class props
|
|
26
|
-
*/
|
|
27
|
-
constructor(props) {
|
|
28
|
-
super(props);
|
|
29
|
-
this.state = {
|
|
30
|
-
firstPageVisible: !!this.props.limitationMessage
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/*
|
|
35
|
-
* Steps:
|
|
36
|
-
* 1. Set the firstPageVisible state variable true if the limitationMessage prop was updated.
|
|
37
|
-
*/
|
|
38
|
-
componentDidUpdate(prevProps) {
|
|
39
|
-
if (prevProps.limitationMessage !== this.props.limitationMessage) {
|
|
40
|
-
this.setState({
|
|
41
|
-
firstPageVisible: !!this.props.limitationMessage
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Handle what happens when the “next” button is pressed.
|
|
48
|
-
*
|
|
49
|
-
* Steps:
|
|
50
|
-
* 1. Unpack attentionMessage and suggestedCarbohydrates from the props object.
|
|
51
|
-
* 2. Define isPageVisible to be true if either attentionMessage or suggestedCarbohydrates is truthy.
|
|
52
|
-
* 3. If isPageVisible is true then set the firstPageVisible state variable to false. Otherwise call the onClickOkButton prop callback function.
|
|
53
|
-
*/
|
|
54
|
-
onPressNextButton = () => {
|
|
55
|
-
const {
|
|
56
|
-
attentionMessage,
|
|
57
|
-
suggestedCarbohydrates
|
|
58
|
-
} = this.props;
|
|
59
|
-
const isSecondPageVisible = !!attentionMessage || !!suggestedCarbohydrates;
|
|
60
|
-
return isSecondPageVisible ? this.setState({
|
|
61
|
-
firstPageVisible: false
|
|
62
|
-
}) : this.props.onClickOkButton();
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* @returns Return an JSX element for composing two buttons: one for accepting a suggestion and one for rejecting it.
|
|
67
|
-
* If the accept button is pressed the onAcceptCarbohydrates prop callback function shall be called.
|
|
68
|
-
* If the accept button is pressed the onDeclineCarbohydrates prop callback function shall be called.
|
|
69
|
-
*/
|
|
70
|
-
recommendationButtons = () => {
|
|
71
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
72
|
-
style: stylesModal.recommendationButtonsContainer
|
|
73
|
-
}, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
74
|
-
testID: RecommendationModalTestIds.AcceptCarbs,
|
|
75
|
-
style: [stylesModal.button, {
|
|
76
|
-
marginRight: 12
|
|
77
|
-
}],
|
|
78
|
-
onPress: this.props.onAcceptCarbohydrates
|
|
79
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
80
|
-
style: stylesModal.carbsButtonText
|
|
81
|
-
}, t(`OK`))), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
82
|
-
testID: RecommendationModalTestIds.DeclineCarbs,
|
|
83
|
-
style: [stylesModal.button, {
|
|
84
|
-
marginLeft: 12
|
|
85
|
-
}],
|
|
86
|
-
onPress: this.props.onDeclineCarbohydrates
|
|
87
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
88
|
-
style: stylesModal.carbsButtonText
|
|
89
|
-
}, t(`NO`))));
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Compose a JSX element for displaying a recommendation of additional carbohydrates (the value of the suggestedCarbohydrates prop rounded to the nearest integer)
|
|
94
|
-
* to the user in a way that explains what to do with the suggestion.
|
|
95
|
-
* @param suggestedCarbohydrates the recommended additional carbohydrates
|
|
96
|
-
*/
|
|
97
|
-
recommendCarbohydrates = suggestedCarbohydrates => {
|
|
98
|
-
const displayCarbs = Math.round(suggestedCarbohydrates);
|
|
99
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(View, {
|
|
100
|
-
style: stylesModal.innerView
|
|
101
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
102
|
-
style: stylesModal.recommendEatingText
|
|
103
|
-
}, t(`We recommend eating an additional:`)), /*#__PURE__*/React.createElement(Text, {
|
|
104
|
-
style: stylesModal.textCenter
|
|
105
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
106
|
-
style: stylesModal.suggestedCarbs,
|
|
107
|
-
testID: RecommendationModalTestIds.SuggestedCarbs
|
|
108
|
-
}, `${displayCarbs} `), /*#__PURE__*/React.createElement(Text, {
|
|
109
|
-
style: stylesModal.carbohydrateText
|
|
110
|
-
}, t(`grams of carbohydrates`))), /*#__PURE__*/React.createElement(Text, {
|
|
111
|
-
style: stylesModal.recommendEatingText
|
|
112
|
-
}, t(`Instead of taking insulin`))), /*#__PURE__*/React.createElement(Text, {
|
|
113
|
-
style: stylesModal.addToCalculation
|
|
114
|
-
}, t(`Would you like to add this to your current calculation?`)), this.recommendationButtons());
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* @returns JSX element for displaying the “second” page of the recommendation modal. The second page displays the string from the attentionMessage prop.
|
|
119
|
-
*/
|
|
120
|
-
secondPage = () => {
|
|
121
|
-
const {
|
|
122
|
-
attentionMessage,
|
|
123
|
-
suggestedCarbohydrates
|
|
124
|
-
} = this.props;
|
|
125
|
-
const willRecommendCarbs = suggestedCarbohydrates !== null && suggestedCarbohydrates > 0;
|
|
126
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(View, {
|
|
127
|
-
style: stylesModal.container
|
|
128
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
129
|
-
style: stylesModal.textTittleMessage
|
|
130
|
-
}, t(`Attention`)), attentionMessage && /*#__PURE__*/React.createElement(Text, {
|
|
131
|
-
style: stylesModal.textMessage
|
|
132
|
-
}, attentionMessage), willRecommendCarbs && this.recommendCarbohydrates(suggestedCarbohydrates)), !willRecommendCarbs && /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
133
|
-
testID: RecommendationModalTestIds.OkButton,
|
|
134
|
-
style: stylesModal.okButton,
|
|
135
|
-
onPress: this.props.onClickOkButton
|
|
136
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
137
|
-
style: stylesModal.buttonText
|
|
138
|
-
}, t(`OK`))));
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* @returns JSX element for displaying the “first” page of the recommendation modal.
|
|
143
|
-
* The first page consists of a limitation message rendered using a LimitationMessage component.
|
|
144
|
-
*/
|
|
145
|
-
firstPage = () => {
|
|
146
|
-
const {
|
|
147
|
-
limitationMessage
|
|
148
|
-
} = this.props;
|
|
149
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, {
|
|
150
|
-
style: stylesModal.textTittleMessage
|
|
151
|
-
}, t(`Attention`)), /*#__PURE__*/React.createElement(Text, {
|
|
152
|
-
style: stylesModal.textMessage
|
|
153
|
-
}, limitationMessage), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
154
|
-
testID: Testing.Id.RecommendationModalTestIds.LimitationOkButton,
|
|
155
|
-
style: stylesModal.okButton,
|
|
156
|
-
onPress: this.props.onlyShowLimitationMessage ? this.props.onClickOkButton : this.onPressNextButton
|
|
157
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
158
|
-
style: stylesModal.buttonText
|
|
159
|
-
}, t(`OK`))));
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* @returns JSX element for rendering a modal that is visible if the isVisible prop is true.
|
|
164
|
-
* If the firstPageVisible state variable is true then use firstPage() to render the first page.
|
|
165
|
-
* Otherwise use secondPage() to render the second page.
|
|
166
|
-
*/
|
|
167
|
-
render() {
|
|
168
|
-
const {
|
|
169
|
-
isVisible
|
|
170
|
-
} = this.props;
|
|
171
|
-
const {
|
|
172
|
-
firstPageVisible
|
|
173
|
-
} = this.state;
|
|
174
|
-
return /*#__PURE__*/React.createElement(ReactNativeModal, {
|
|
175
|
-
isVisible: isVisible,
|
|
176
|
-
style: stylesModal.modalStyle,
|
|
177
|
-
backdropColor: colors.darkBlue,
|
|
178
|
-
backdropOpacity: 1,
|
|
179
|
-
animationIn: `fadeIn`,
|
|
180
|
-
animationOut: `fadeOut`
|
|
181
|
-
}, /*#__PURE__*/React.createElement(StatusBar, {
|
|
182
|
-
backgroundColor: colors.darkBlue
|
|
183
|
-
}), /*#__PURE__*/React.createElement(SafeAreaView, {
|
|
184
|
-
style: stylesModal.safe
|
|
185
|
-
}, /*#__PURE__*/React.createElement(ScrollView, {
|
|
186
|
-
contentContainerStyle: stylesModal.scrollViewContainer
|
|
187
|
-
}, firstPageVisible ? this.firstPage() : this.secondPage())));
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/** @internal */
|
|
192
|
-
export const stylesModal = StyleSheet.create({
|
|
193
|
-
safe: {
|
|
194
|
-
backgroundColor: colors.darkBlue
|
|
195
|
-
},
|
|
196
|
-
modalStyle: {
|
|
197
|
-
margin: 0
|
|
198
|
-
},
|
|
199
|
-
scrollViewContainer: {
|
|
200
|
-
flexGrow: 1,
|
|
201
|
-
justifyContent: `center`
|
|
202
|
-
},
|
|
203
|
-
container: {
|
|
204
|
-
justifyContent: `center`
|
|
205
|
-
},
|
|
206
|
-
textTittleMessage: {
|
|
207
|
-
...FONTS.Poppins.bold_3XL,
|
|
208
|
-
color: colors.white,
|
|
209
|
-
textAlign: `center`
|
|
210
|
-
},
|
|
211
|
-
textMessage: {
|
|
212
|
-
...FONTS.Poppins.regular_Base,
|
|
213
|
-
color: colors.white,
|
|
214
|
-
textAlign: `center`,
|
|
215
|
-
marginHorizontal: 30,
|
|
216
|
-
marginTop: 8
|
|
217
|
-
},
|
|
218
|
-
buttonText: {
|
|
219
|
-
...FONTS.Poppins.bold_Base,
|
|
220
|
-
color: colors.white,
|
|
221
|
-
textAlign: `center`,
|
|
222
|
-
paddingHorizontal: 16,
|
|
223
|
-
paddingVertical: 12
|
|
224
|
-
},
|
|
225
|
-
innerView: {
|
|
226
|
-
alignContent: `center`,
|
|
227
|
-
borderRadius: 8,
|
|
228
|
-
backgroundColor: colors.purple,
|
|
229
|
-
paddingVertical: 24,
|
|
230
|
-
marginHorizontal: 30,
|
|
231
|
-
marginTop: 24,
|
|
232
|
-
marginBottom: 36
|
|
233
|
-
},
|
|
234
|
-
suggestedCarbs: {
|
|
235
|
-
...FONTS.Poppins.bold_XL,
|
|
236
|
-
color: colors.white
|
|
237
|
-
},
|
|
238
|
-
textCenter: {
|
|
239
|
-
...FONTS.Poppins.regular_Base,
|
|
240
|
-
textAlign: `center`,
|
|
241
|
-
paddingHorizontal: 26.5
|
|
242
|
-
},
|
|
243
|
-
recommendEatingText: {
|
|
244
|
-
...FONTS.Poppins.regular_Base,
|
|
245
|
-
color: colors.white,
|
|
246
|
-
textAlign: `center`,
|
|
247
|
-
paddingHorizontal: 15,
|
|
248
|
-
marginBottom: 8
|
|
249
|
-
},
|
|
250
|
-
carbohydrateText: {
|
|
251
|
-
...FONTS.Poppins.bold_Base,
|
|
252
|
-
color: colors.white
|
|
253
|
-
},
|
|
254
|
-
addToCalculation: {
|
|
255
|
-
...FONTS.Poppins.regular_Base,
|
|
256
|
-
color: colors.white,
|
|
257
|
-
textAlign: `center`,
|
|
258
|
-
marginBottom: 16,
|
|
259
|
-
marginHorizontal: 50
|
|
260
|
-
},
|
|
261
|
-
recommendationButtonsContainer: {
|
|
262
|
-
justifyContent: `center`,
|
|
263
|
-
flexDirection: `row`,
|
|
264
|
-
paddingHorizontal: 47
|
|
265
|
-
},
|
|
266
|
-
carbsButtonText: {
|
|
267
|
-
...FONTS.Poppins.bold_Base,
|
|
268
|
-
color: colors.white,
|
|
269
|
-
textAlign: `center`,
|
|
270
|
-
paddingHorizontal: 16,
|
|
271
|
-
paddingVertical: 12
|
|
272
|
-
},
|
|
273
|
-
button: {
|
|
274
|
-
borderRadius: 50,
|
|
275
|
-
borderWidth: 1,
|
|
276
|
-
borderColor: colors.white,
|
|
277
|
-
alignSelf: `center`,
|
|
278
|
-
minWidth: 127
|
|
279
|
-
},
|
|
280
|
-
okButton: {
|
|
281
|
-
backgroundColor: colors.darkBlue,
|
|
282
|
-
justifyContent: `flex-start`,
|
|
283
|
-
marginTop: 24,
|
|
284
|
-
borderRadius: 50,
|
|
285
|
-
borderWidth: 1,
|
|
286
|
-
borderColor: colors.white,
|
|
287
|
-
alignSelf: `center`,
|
|
288
|
-
minWidth: 127
|
|
289
|
-
}
|
|
290
|
-
});
|
|
291
|
-
//# sourceMappingURL=RecommendationModal.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","SafeAreaView","ScrollView","StatusBar","StyleSheet","TouchableOpacity","View","ReactNativeModal","t","Testing","colors","FONTS","Text","RecommendationModalTestIds","Id","RecommendationModal","Component","constructor","props","state","firstPageVisible","limitationMessage","componentDidUpdate","prevProps","setState","onPressNextButton","attentionMessage","suggestedCarbohydrates","isSecondPageVisible","onClickOkButton","recommendationButtons","createElement","style","stylesModal","recommendationButtonsContainer","testID","AcceptCarbs","button","marginRight","onPress","onAcceptCarbohydrates","carbsButtonText","DeclineCarbs","marginLeft","onDeclineCarbohydrates","recommendCarbohydrates","displayCarbs","Math","round","Fragment","innerView","recommendEatingText","textCenter","suggestedCarbs","SuggestedCarbs","carbohydrateText","addToCalculation","secondPage","willRecommendCarbs","container","textTittleMessage","textMessage","OkButton","okButton","buttonText","firstPage","LimitationOkButton","onlyShowLimitationMessage","render","isVisible","modalStyle","backdropColor","darkBlue","backdropOpacity","animationIn","animationOut","backgroundColor","safe","contentContainerStyle","scrollViewContainer","create","margin","flexGrow","justifyContent","Poppins","bold_3XL","color","white","textAlign","regular_Base","marginHorizontal","marginTop","bold_Base","paddingHorizontal","paddingVertical","alignContent","borderRadius","purple","marginBottom","bold_XL","flexDirection","borderWidth","borderColor","alignSelf","minWidth"],"sourceRoot":"../../../src","sources":["components/RecommendationModal.tsx"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,YAAY,EAAEC,UAAU,EAAEC,SAAS,EAAEC,UAAU,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,cAAc;AACtG,OAAOC,gBAAgB,MAAM,oBAAoB;AAEjD,SAASC,CAAC,QAAQ,sBAAsB;AACxC,SAASC,OAAO,QAAQ,eAAe;AACvC,SAASC,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,KAAK,QAAQ,gBAAgB;AACtC,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BU,YAAY,EAAE,EAAE;IAChBR,gBAAgB,EAAE;EACnB,CAAC;EACDxD,8BAA8B,EAAE;IAC/BiD,cAAc,EAAG,QAAO;IACxBiB,aAAa,EAAG,KAAI;IACpBP,iBAAiB,EAAE;EACpB,CAAC;EACDpD,eAAe,EAAE;IAChB,GAAG9B,KAAK,CAACyE,OAAO,CAACQ,SAAS;IAC1BN,KAAK,EAAE5E,MAAM,CAAC6E,KAAK;IACnBC,SAAS,EAAG,QAAO;IACnBK,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE;EAClB,CAAC;EACDzD,MAAM,EAAE;IACP2D,YAAY,EAAE,EAAE;IAChBK,WAAW,EAAE,CAAC;IACdC,WAAW,EAAE5F,MAAM,CAAC6E,KAAK;IACzBgB,SAAS,EAAG,QAAO;IACnBC,QAAQ,EAAE;EACX,CAAC;EACDzC,QAAQ,EAAE;IACTa,eAAe,EAAElE,MAAM,CAAC8D,QAAQ;IAChCW,cAAc,EAAG,YAAW;IAC5BQ,SAAS,EAAE,EAAE;IACbK,YAAY,EAAE,EAAE;IAChBK,WAAW,EAAE,CAAC;IACdC,WAAW,EAAE5F,MAAM,CAAC6E,KAAK;IACzBgB,SAAS,EAAG,QAAO;IACnBC,QAAQ,EAAE;EACX;AACD,CAAC,CAAC"}
|
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Alert, StyleSheet, TouchableOpacity, View } from "react-native";
|
|
3
|
-
import CloseOutlined from "../assets/IconsSVG/CloseOutlined";
|
|
4
|
-
import Edit from "../assets/IconsSVG/Edit";
|
|
5
|
-
import { t } from "../locales/translate";
|
|
6
|
-
import { Testing } from "../types/enum";
|
|
7
|
-
import { colors } from "../utils/Constants";
|
|
8
|
-
import { CarbohydrateLimitError } from "../utils/RecommendationError";
|
|
9
|
-
import InvisibleNumberInput from "./InvisibleNumberInput";
|
|
10
|
-
import LineSeparator from "./LineSeparator";
|
|
11
|
-
import { FONTS } from "./styles/fonts";
|
|
12
|
-
import Text from "./Text";
|
|
13
|
-
const {
|
|
14
|
-
RecommendedCarbsTestIds
|
|
15
|
-
} = Testing.Id;
|
|
16
|
-
/**
|
|
17
|
-
* The contents of the RecommendedCarbs component may vary quite a bit depending on data that was entered by the user
|
|
18
|
-
* and on the result of the recommendation calculation.
|
|
19
|
-
* For instance the part of the component that displays any recommendation of eating additional carbohydrates
|
|
20
|
-
* (composed by the renderRecommendedCarbs() method) will only be visible if it is actually recommended that the user eats additional carbohydrates.
|
|
21
|
-
*/
|
|
22
|
-
export default class RecommendedCarbs extends React.Component {
|
|
23
|
-
/** Initialise the state partialInput variable with undefined */
|
|
24
|
-
state = {
|
|
25
|
-
partialInput: undefined
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Function taking no arguments and returning no value.
|
|
30
|
-
* Will be bound to the function that activates input for InvisibleNumberInput when that component has been mounted.
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Handle what should happen when the additional carbohydrates amount has been pressed.
|
|
35
|
-
* Uses the InvisibleNumberInput child component to enable the user to input the amount of additional carbohydrates that they are taking.
|
|
36
|
-
*/
|
|
37
|
-
showTextInput = () => {
|
|
38
|
-
this.callbackInput?.();
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Passed to the InvisibleNumberInput child component as a callback function to be called every time the content of the input field changes.
|
|
43
|
-
*
|
|
44
|
-
* Steps:
|
|
45
|
-
* 1. Save partialInput argument to the partialInput state variable.
|
|
46
|
-
* @param partialInput The contents of the input field.
|
|
47
|
-
*/
|
|
48
|
-
handlePartialInput = partialInput => {
|
|
49
|
-
this.setState({
|
|
50
|
-
partialInput
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Handle what happens when input in the InvisibleNumberInput child component is completed.
|
|
56
|
-
*
|
|
57
|
-
* Steps:
|
|
58
|
-
* 1. If the carbs argument is greater than or equal to 0:
|
|
59
|
-
* - If the carbs argument is greater than 300:
|
|
60
|
-
* - Set the partialInput state variable to the value of the recommemdedCarbs prop.
|
|
61
|
-
* - Return - An alert message with the message of CarbohydrateLimitError() and with an OK button for closing it.
|
|
62
|
-
* - Use carbs as argument to call the changedRecommendedCarbs prop callback function.
|
|
63
|
-
* @param carbs The numerical value of the input field at completion.
|
|
64
|
-
* @returns void
|
|
65
|
-
*/
|
|
66
|
-
handleChangedCarbs = carbs => {
|
|
67
|
-
if (carbs >= 0) {
|
|
68
|
-
if (carbs > 300) {
|
|
69
|
-
this.setState({
|
|
70
|
-
partialInput: this.props.recommendedCarbs
|
|
71
|
-
});
|
|
72
|
-
return Alert.alert(t(`Attention`), CarbohydrateLimitError().message, [{
|
|
73
|
-
text: t(`OK`)
|
|
74
|
-
}]);
|
|
75
|
-
}
|
|
76
|
-
this.props.changedRecommendedCarbs(carbs);
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Render the section of the component that displays the extra carbs that the user should eat
|
|
82
|
-
* and allows the user to change the contents to indicate how many extra carbs they are actually going to eat.
|
|
83
|
-
*
|
|
84
|
-
* Steps:
|
|
85
|
-
* 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.
|
|
86
|
-
* 2. Set a variable named totalCarbs to the sum of the enteredCarbs prop and shownCarbs rounded to the nearest integer.
|
|
87
|
-
* 3. Compose and return a JSX element consisting of the following sub-components
|
|
88
|
-
* - A cancel button to remove recommended carbs from the calculation - When tapped, call the removeRecommendedCarbs prop callback function.
|
|
89
|
-
* - The text from the shownCarbs variable from step 1 - When tapped, call the showTextInput() method.
|
|
90
|
-
* - Use renderRow() to display the value of totalCarbs.
|
|
91
|
-
* - InvisibleNumberInput for showing the keyboard to enable the user to enter a number.
|
|
92
|
-
*/
|
|
93
|
-
renderRecommendedCarbs = () => {
|
|
94
|
-
const shownCarbs = this.state.partialInput ?? Math.round(Number(this.props.recommendedCarbs));
|
|
95
|
-
const totalCarbs = Math.round(parseFloat(this.props.enteredCarbs) + Number(shownCarbs));
|
|
96
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LineSeparator, {
|
|
97
|
-
borderBottomColor: colors.dustyDarkBlue,
|
|
98
|
-
marginBottom: 8,
|
|
99
|
-
marginTop: 16
|
|
100
|
-
}), /*#__PURE__*/React.createElement(View, {
|
|
101
|
-
style: [style.container, {
|
|
102
|
-
marginBottom: 4
|
|
103
|
-
}]
|
|
104
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
105
|
-
style: style.recommendedContainer
|
|
106
|
-
}, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
107
|
-
testID: RecommendedCarbsTestIds.RemoveRecommendation,
|
|
108
|
-
style: style.removeRecommended,
|
|
109
|
-
onPress: this.props.removeRecommendedCarbs
|
|
110
|
-
}, CloseOutlined({
|
|
111
|
-
style: style.removeRecommendedIcon
|
|
112
|
-
})), /*#__PURE__*/React.createElement(Text, {
|
|
113
|
-
style: style.recommendedLabel
|
|
114
|
-
}, t(`Recommended`)))), /*#__PURE__*/React.createElement(View, {
|
|
115
|
-
style: style.container
|
|
116
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
117
|
-
style: style.recommendedContainer
|
|
118
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
119
|
-
style: {
|
|
120
|
-
...style.recommendedLabel,
|
|
121
|
-
color: colors.teal
|
|
122
|
-
}
|
|
123
|
-
}, t(`Additional`))), /*#__PURE__*/React.createElement(View, {
|
|
124
|
-
style: style.valueUnitContainer
|
|
125
|
-
}, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
126
|
-
testID: RecommendedCarbsTestIds.EditRecommendedCarbs,
|
|
127
|
-
onPress: this.showTextInput,
|
|
128
|
-
style: [style.valueUnitContainer]
|
|
129
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
130
|
-
testID: RecommendedCarbsTestIds.RecommendedCarbs,
|
|
131
|
-
style: {
|
|
132
|
-
...style.value,
|
|
133
|
-
color: colors.teal
|
|
134
|
-
}
|
|
135
|
-
}, shownCarbs), Edit({
|
|
136
|
-
color: colors.teal,
|
|
137
|
-
style: style.editIcon
|
|
138
|
-
}), /*#__PURE__*/React.createElement(Text, {
|
|
139
|
-
style: {
|
|
140
|
-
...style.units,
|
|
141
|
-
color: colors.teal
|
|
142
|
-
}
|
|
143
|
-
}, t(`grams`))))), /*#__PURE__*/React.createElement(LineSeparator, {
|
|
144
|
-
borderBottomColor: colors.dustyDarkBlue,
|
|
145
|
-
marginBottom: 16,
|
|
146
|
-
marginTop: 8
|
|
147
|
-
}), this.renderRow({
|
|
148
|
-
label: t(`Total`),
|
|
149
|
-
value: totalCarbs.toString(),
|
|
150
|
-
units: t(`grams`)
|
|
151
|
-
}, RecommendedCarbsTestIds.TotalCarbs), /*#__PURE__*/React.createElement(InvisibleNumberInput, {
|
|
152
|
-
testID: RecommendedCarbsTestIds.InvisibleCarbInput,
|
|
153
|
-
negativeAllowed: false,
|
|
154
|
-
cleanPartialInput: true,
|
|
155
|
-
decimalPlaces: 0,
|
|
156
|
-
visible: callback => this.callbackInput = callback,
|
|
157
|
-
partialInput: this.handlePartialInput,
|
|
158
|
-
onEnd: this.handleChangedCarbs,
|
|
159
|
-
startValue: this.props.recommendedCarbs,
|
|
160
|
-
maxLength: 3
|
|
161
|
-
}));
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Display a row of information for the user. Specifically used to display the amount of carbohydrates that the user has entered.
|
|
166
|
-
* @param row The values to display
|
|
167
|
-
* @param testID Id used for component testing
|
|
168
|
-
* @returns A JSX element to display 3 strings on the screen: label, value, and a unit.
|
|
169
|
-
*/
|
|
170
|
-
renderRow = (row, testID) => {
|
|
171
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
172
|
-
style: style.container
|
|
173
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
174
|
-
style: style.rowContainer
|
|
175
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
176
|
-
style: style.rowLabel
|
|
177
|
-
}, row.label)), /*#__PURE__*/React.createElement(View, {
|
|
178
|
-
style: style.valueUnitContainer
|
|
179
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
180
|
-
testID: testID,
|
|
181
|
-
style: style.value
|
|
182
|
-
}, row.value), /*#__PURE__*/React.createElement(Text, {
|
|
183
|
-
style: style.units
|
|
184
|
-
}, row.units)));
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Steps:
|
|
189
|
-
* 1. Convert the recommendedCarbs prop to a number and save that as a variable named carbs.
|
|
190
|
-
* 2. Use renderRow() to display the user’s entered amount of carbohydrates
|
|
191
|
-
* 3. If carbs is not a NaN-value and it is positive, call renderRecommendedCarbs() to display the carbohydrate recommendation.
|
|
192
|
-
*/
|
|
193
|
-
render() {
|
|
194
|
-
const carbs = Number(this.props.recommendedCarbs);
|
|
195
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(View, {
|
|
196
|
-
style: style.foodTitleContainer
|
|
197
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
198
|
-
style: style.label
|
|
199
|
-
}, t(`Food`)), /*#__PURE__*/React.createElement(Text, {
|
|
200
|
-
style: style.foodUnitsLabel
|
|
201
|
-
}, `(${t(`Carbohydrates`)})`)), this.renderRow({
|
|
202
|
-
label: t(`Entered`),
|
|
203
|
-
value: this.props.enteredCarbs,
|
|
204
|
-
units: t(`grams`)
|
|
205
|
-
}, RecommendedCarbsTestIds.EnteredCarbs), !isNaN(carbs) && carbs > 0 ? this.renderRecommendedCarbs() : null);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
const style = StyleSheet.create({
|
|
209
|
-
container: {
|
|
210
|
-
flexDirection: `row`,
|
|
211
|
-
alignItems: `center`
|
|
212
|
-
},
|
|
213
|
-
foodTitleContainer: {
|
|
214
|
-
flexDirection: `row`,
|
|
215
|
-
alignItems: `center`,
|
|
216
|
-
marginBottom: 4
|
|
217
|
-
},
|
|
218
|
-
foodUnitsLabel: {
|
|
219
|
-
...FONTS.Poppins.regular_XS,
|
|
220
|
-
textAlign: `left`,
|
|
221
|
-
paddingLeft: 4,
|
|
222
|
-
color: colors.lightBlue
|
|
223
|
-
},
|
|
224
|
-
rowContainer: {
|
|
225
|
-
flex: 7
|
|
226
|
-
},
|
|
227
|
-
rowLabel: {
|
|
228
|
-
...FONTS.Poppins.regular_Base,
|
|
229
|
-
color: colors.white
|
|
230
|
-
},
|
|
231
|
-
enteredContainer: {
|
|
232
|
-
flex: 3,
|
|
233
|
-
alignItems: `flex-end`
|
|
234
|
-
},
|
|
235
|
-
valueUnitContainer: {
|
|
236
|
-
flex: 6.5,
|
|
237
|
-
justifyContent: `flex-end`,
|
|
238
|
-
alignItems: `baseline`,
|
|
239
|
-
flexDirection: `row`
|
|
240
|
-
},
|
|
241
|
-
value: {
|
|
242
|
-
...FONTS.Poppins.medium_2XL,
|
|
243
|
-
color: colors.white,
|
|
244
|
-
textAlign: `right`
|
|
245
|
-
},
|
|
246
|
-
units: {
|
|
247
|
-
...FONTS.Poppins.regular_XS,
|
|
248
|
-
color: colors.white,
|
|
249
|
-
textAlign: `left`,
|
|
250
|
-
paddingLeft: 4
|
|
251
|
-
},
|
|
252
|
-
recommendedContainer: {
|
|
253
|
-
flex: 7,
|
|
254
|
-
flexDirection: `row`
|
|
255
|
-
},
|
|
256
|
-
recommendedLabel: {
|
|
257
|
-
...FONTS.Poppins.regular_Base,
|
|
258
|
-
color: colors.teal
|
|
259
|
-
},
|
|
260
|
-
removeRecommended: {
|
|
261
|
-
justifyContent: `center`,
|
|
262
|
-
alignItems: `center`
|
|
263
|
-
},
|
|
264
|
-
removeRecommendedIcon: {
|
|
265
|
-
height: 20,
|
|
266
|
-
width: 20,
|
|
267
|
-
marginRight: 4
|
|
268
|
-
},
|
|
269
|
-
editIcon: {
|
|
270
|
-
height: 16,
|
|
271
|
-
width: 16,
|
|
272
|
-
right: 0,
|
|
273
|
-
top: -8,
|
|
274
|
-
position: `absolute`
|
|
275
|
-
},
|
|
276
|
-
label: {
|
|
277
|
-
...FONTS.Poppins.regular_Base,
|
|
278
|
-
color: colors.white
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
//# sourceMappingURL=RecommendedCarbs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","Alert","StyleSheet","TouchableOpacity","View","CloseOutlined","Edit","t","Testing","colors","CarbohydrateLimitError","InvisibleNumberInput","LineSeparator","FONTS","Text","RecommendedCarbsTestIds","Id","RecommendedCarbs","Component","state","partialInput","undefined","showTextInput","callbackInput","handlePartialInput","setState","handleChangedCarbs","carbs","props","recommendedCarbs","alert","message","text","changedRecommendedCarbs","renderRecommendedCarbs","shownCarbs","Math","round","Number","totalCarbs","parseFloat","enteredCarbs","createElement","Fragment","borderBottomColor","dustyDarkBlue","marginBottom","marginTop","style","container","recommendedContainer","testID","RemoveRecommendation","removeRecommended","onPress","removeRecommendedCarbs","removeRecommendedIcon","recommendedLabel","color","teal","valueUnitContainer","EditRecommendedCarbs","value","editIcon","units","renderRow","label","toString","TotalCarbs","InvisibleCarbInput","negativeAllowed","cleanPartialInput","decimalPlaces","visible","callback","onEnd","startValue","maxLength","row","rowContainer","rowLabel","render","foodTitleContainer","foodUnitsLabel","EnteredCarbs","isNaN","create","flexDirection","alignItems","Poppins","regular_XS","textAlign","paddingLeft","lightBlue","flex","regular_Base","white","enteredContainer","justifyContent","medium_2XL","height","width","marginRight","right","top","position"],"sourceRoot":"../../../src","sources":["components/RecommendedCarbs.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,KAAK,EAAEC,UAAU,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,cAAc;AAExE,OAAOC,aAAa,MAAM,kCAAkC;AAC5D,OAAO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