@hedia/recommendation-screen 2.1.73 → 2.1.74-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/lib/commonjs/RecommendationScreen.js +768 -0
- package/lib/commonjs/RecommendationScreen.js.map +1 -0
- package/lib/commonjs/assets/IconsSVG/Close.js +20 -0
- package/lib/commonjs/assets/IconsSVG/Close.js.map +1 -0
- package/lib/commonjs/assets/IconsSVG/CloseOutlined.js +28 -0
- package/lib/commonjs/assets/IconsSVG/CloseOutlined.js.map +1 -0
- package/lib/commonjs/assets/IconsSVG/Edit.js +23 -0
- package/lib/commonjs/assets/IconsSVG/Edit.js.map +1 -0
- package/lib/commonjs/assets/IconsSVG/activity/Cycling.js +43 -0
- package/lib/commonjs/assets/IconsSVG/activity/Cycling.js.map +1 -0
- package/lib/commonjs/assets/IconsSVG/activity/Running.js +33 -0
- package/lib/commonjs/assets/IconsSVG/activity/Running.js.map +1 -0
- package/lib/commonjs/assets/IconsSVG/activity/Stretching.js +33 -0
- package/lib/commonjs/assets/IconsSVG/activity/Stretching.js.map +1 -0
- package/lib/commonjs/assets/IconsSVG/activity/Swimming.js +48 -0
- package/lib/commonjs/assets/IconsSVG/activity/Swimming.js.map +1 -0
- package/lib/commonjs/assets/IconsSVG/activity/Walking.js +38 -0
- package/lib/commonjs/assets/IconsSVG/activity/Walking.js.map +1 -0
- package/lib/commonjs/assets/IconsSVG/mood/Happy.js +34 -0
- package/lib/commonjs/assets/IconsSVG/mood/Happy.js.map +1 -0
- package/lib/commonjs/assets/IconsSVG/mood/Neutral.js +34 -0
- package/lib/commonjs/assets/IconsSVG/mood/Neutral.js.map +1 -0
- package/lib/commonjs/assets/IconsSVG/mood/Sad.js +34 -0
- package/lib/commonjs/assets/IconsSVG/mood/Sad.js.map +1 -0
- package/lib/commonjs/assets/IconsSVG/mood/SemiHappy.js +34 -0
- package/lib/commonjs/assets/IconsSVG/mood/SemiHappy.js.map +1 -0
- package/lib/commonjs/assets/IconsSVG/mood/SemiSad.js +34 -0
- package/lib/commonjs/assets/IconsSVG/mood/SemiSad.js.map +1 -0
- package/lib/commonjs/components/ExitModal.js +124 -0
- package/lib/commonjs/components/ExitModal.js.map +1 -0
- package/lib/commonjs/components/InfoBars.js +123 -0
- package/lib/commonjs/components/InfoBars.js.map +1 -0
- package/lib/commonjs/components/InvisibleNumberInput.js +150 -0
- package/lib/commonjs/components/InvisibleNumberInput.js.map +1 -0
- package/lib/commonjs/components/LineSeparator.js +27 -0
- package/lib/commonjs/components/LineSeparator.js.map +1 -0
- package/lib/commonjs/components/RecentInsulin.js +105 -0
- package/lib/commonjs/components/RecentInsulin.js.map +1 -0
- package/lib/commonjs/components/RecommendationModal.js +302 -0
- package/lib/commonjs/components/RecommendationModal.js.map +1 -0
- package/lib/commonjs/components/RecommendedCarbs.js +289 -0
- package/lib/commonjs/components/RecommendedCarbs.js.map +1 -0
- package/lib/commonjs/components/RecommendedInsulin.js +208 -0
- package/lib/commonjs/components/RecommendedInsulin.js.map +1 -0
- package/lib/commonjs/components/Remeasure.js +131 -0
- package/lib/commonjs/components/Remeasure.js.map +1 -0
- package/lib/commonjs/components/Text.js +25 -0
- package/lib/commonjs/components/Text.js.map +1 -0
- package/lib/commonjs/components/TimeoutModal.js +113 -0
- package/lib/commonjs/components/TimeoutModal.js.map +1 -0
- package/lib/commonjs/components/TransferToLogbook.js +83 -0
- package/lib/commonjs/components/TransferToLogbook.js.map +1 -0
- package/lib/commonjs/components/activity/Activity.js +112 -0
- package/lib/commonjs/components/activity/Activity.js.map +1 -0
- package/lib/commonjs/components/activity/ActivityIcon.js +86 -0
- package/lib/commonjs/components/activity/ActivityIcon.js.map +1 -0
- package/lib/commonjs/components/activity/ActivityIntensity.js +65 -0
- package/lib/commonjs/components/activity/ActivityIntensity.js.map +1 -0
- package/lib/commonjs/components/mood/Emotion.js +86 -0
- package/lib/commonjs/components/mood/Emotion.js.map +1 -0
- package/lib/commonjs/components/mood/MoodIcon.js +107 -0
- package/lib/commonjs/components/mood/MoodIcon.js.map +1 -0
- package/lib/commonjs/components/styles/fonts.js +154 -0
- package/lib/commonjs/components/styles/fonts.js.map +1 -0
- package/lib/commonjs/index.js +21 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/locales/da/translations.json +82 -0
- package/lib/commonjs/locales/de/translations.json +81 -0
- package/lib/commonjs/locales/en/translations.json +84 -0
- package/lib/commonjs/locales/es/translations.json +81 -0
- package/lib/commonjs/locales/fr/translations.json +81 -0
- package/lib/commonjs/locales/it/translations.json +81 -0
- package/lib/commonjs/locales/translate.js +63 -0
- package/lib/commonjs/locales/translate.js.map +1 -0
- package/lib/commonjs/types/enum.js +179 -0
- package/lib/commonjs/types/enum.js.map +1 -0
- package/lib/commonjs/types/types.js +6 -0
- package/lib/commonjs/types/types.js.map +1 -0
- package/lib/commonjs/utils/AttentionMessages.js +141 -0
- package/lib/commonjs/utils/AttentionMessages.js.map +1 -0
- package/lib/commonjs/utils/Constants.js +138 -0
- package/lib/commonjs/utils/Constants.js.map +1 -0
- package/lib/commonjs/utils/RecommendationError.js +116 -0
- package/lib/commonjs/utils/RecommendationError.js.map +1 -0
- package/lib/commonjs/utils/RecommendationUtils.js +212 -0
- package/lib/commonjs/utils/RecommendationUtils.js.map +1 -0
- package/lib/commonjs/utils/Translations.js +22 -0
- package/lib/commonjs/utils/Translations.js.map +1 -0
- package/lib/commonjs/utils/Utils.js +162 -0
- package/lib/commonjs/utils/Utils.js.map +1 -0
- package/lib/commonjs/utils/Validations.js +468 -0
- package/lib/commonjs/utils/Validations.js.map +1 -0
- package/lib/module/RecommendationScreen.js +758 -0
- package/lib/module/RecommendationScreen.js.map +1 -0
- package/lib/module/assets/IconsSVG/Close.js +11 -0
- package/lib/module/assets/IconsSVG/Close.js.map +1 -0
- package/lib/module/assets/IconsSVG/CloseOutlined.js +19 -0
- package/lib/module/assets/IconsSVG/CloseOutlined.js.map +1 -0
- package/lib/module/assets/IconsSVG/Edit.js +14 -0
- package/lib/module/assets/IconsSVG/Edit.js.map +1 -0
- package/lib/module/assets/IconsSVG/activity/Cycling.js +34 -0
- package/lib/module/assets/IconsSVG/activity/Cycling.js.map +1 -0
- package/lib/module/assets/IconsSVG/activity/Running.js +24 -0
- package/lib/module/assets/IconsSVG/activity/Running.js.map +1 -0
- package/lib/module/assets/IconsSVG/activity/Stretching.js +24 -0
- package/lib/module/assets/IconsSVG/activity/Stretching.js.map +1 -0
- package/lib/module/assets/IconsSVG/activity/Swimming.js +39 -0
- package/lib/module/assets/IconsSVG/activity/Swimming.js.map +1 -0
- package/lib/module/assets/IconsSVG/activity/Walking.js +29 -0
- package/lib/module/assets/IconsSVG/activity/Walking.js.map +1 -0
- package/lib/module/assets/IconsSVG/mood/Happy.js +25 -0
- package/lib/module/assets/IconsSVG/mood/Happy.js.map +1 -0
- package/lib/module/assets/IconsSVG/mood/Neutral.js +25 -0
- package/lib/module/assets/IconsSVG/mood/Neutral.js.map +1 -0
- package/lib/module/assets/IconsSVG/mood/Sad.js +25 -0
- package/lib/module/assets/IconsSVG/mood/Sad.js.map +1 -0
- package/lib/module/assets/IconsSVG/mood/SemiHappy.js +25 -0
- package/lib/module/assets/IconsSVG/mood/SemiHappy.js.map +1 -0
- package/lib/module/assets/IconsSVG/mood/SemiSad.js +25 -0
- package/lib/module/assets/IconsSVG/mood/SemiSad.js.map +1 -0
- package/lib/module/components/ExitModal.js +114 -0
- package/lib/module/components/ExitModal.js.map +1 -0
- package/lib/module/components/InfoBars.js +114 -0
- package/lib/module/components/InfoBars.js.map +1 -0
- package/lib/module/components/InvisibleNumberInput.js +142 -0
- package/lib/module/components/InvisibleNumberInput.js.map +1 -0
- package/lib/module/components/LineSeparator.js +19 -0
- package/lib/module/components/LineSeparator.js.map +1 -0
- package/lib/module/components/RecentInsulin.js +97 -0
- package/lib/module/components/RecentInsulin.js.map +1 -0
- package/lib/module/components/RecommendationModal.js +291 -0
- package/lib/module/components/RecommendationModal.js.map +1 -0
- package/lib/module/components/RecommendedCarbs.js +281 -0
- package/lib/module/components/RecommendedCarbs.js.map +1 -0
- package/lib/module/components/RecommendedInsulin.js +200 -0
- package/lib/module/components/RecommendedInsulin.js.map +1 -0
- package/lib/module/components/Remeasure.js +123 -0
- package/lib/module/components/Remeasure.js.map +1 -0
- package/lib/module/components/Text.js +16 -0
- package/lib/module/components/Text.js.map +1 -0
- package/lib/module/components/TimeoutModal.js +103 -0
- package/lib/module/components/TimeoutModal.js.map +1 -0
- package/lib/module/components/TransferToLogbook.js +75 -0
- package/lib/module/components/TransferToLogbook.js.map +1 -0
- package/lib/module/components/activity/Activity.js +104 -0
- package/lib/module/components/activity/Activity.js.map +1 -0
- package/lib/module/components/activity/ActivityIcon.js +78 -0
- package/lib/module/components/activity/ActivityIcon.js.map +1 -0
- package/lib/module/components/activity/ActivityIntensity.js +57 -0
- package/lib/module/components/activity/ActivityIntensity.js.map +1 -0
- package/lib/module/components/mood/Emotion.js +78 -0
- package/lib/module/components/mood/Emotion.js.map +1 -0
- package/lib/module/components/mood/MoodIcon.js +97 -0
- package/lib/module/components/mood/MoodIcon.js.map +1 -0
- package/lib/module/components/styles/fonts.js +145 -0
- package/lib/module/components/styles/fonts.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/locales/da/translations.json +82 -0
- package/lib/module/locales/de/translations.json +81 -0
- package/lib/module/locales/en/translations.json +84 -0
- package/lib/module/locales/es/translations.json +81 -0
- package/lib/module/locales/fr/translations.json +81 -0
- package/lib/module/locales/it/translations.json +81 -0
- package/lib/module/locales/translate.js +55 -0
- package/lib/module/locales/translate.js.map +1 -0
- package/lib/module/types/enum.js +170 -0
- package/lib/module/types/enum.js.map +1 -0
- package/lib/module/types/types.js.map +1 -0
- package/lib/module/utils/AttentionMessages.js +131 -0
- package/lib/module/utils/AttentionMessages.js.map +1 -0
- package/{dist/src → lib/module}/utils/Constants.js +78 -35
- package/lib/module/utils/Constants.js.map +1 -0
- package/{dist/src → lib/module}/utils/RecommendationError.js +28 -6
- package/lib/module/utils/RecommendationError.js.map +1 -0
- package/{dist/src → lib/module}/utils/RecommendationUtils.js +89 -90
- package/lib/module/utils/RecommendationUtils.js.map +1 -0
- package/{dist/src → lib/module}/utils/Translations.js +5 -3
- package/lib/module/utils/Translations.js.map +1 -0
- package/lib/module/utils/Utils.js +155 -0
- package/lib/module/utils/Utils.js.map +1 -0
- package/{dist/src → lib/module}/utils/Validations.js +155 -128
- package/lib/module/utils/Validations.js.map +1 -0
- package/{dist/src → lib/typescript}/RecommendationScreen.d.ts +2 -1
- package/lib/typescript/RecommendationScreen.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/assets/IconsSVG/Close.d.ts +1 -0
- package/lib/typescript/assets/IconsSVG/Close.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/assets/IconsSVG/CloseOutlined.d.ts +1 -0
- package/lib/typescript/assets/IconsSVG/CloseOutlined.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/assets/IconsSVG/Edit.d.ts +1 -0
- package/lib/typescript/assets/IconsSVG/Edit.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/assets/IconsSVG/activity/Cycling.d.ts +1 -0
- package/lib/typescript/assets/IconsSVG/activity/Cycling.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/assets/IconsSVG/activity/Running.d.ts +1 -0
- package/lib/typescript/assets/IconsSVG/activity/Running.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/assets/IconsSVG/activity/Stretching.d.ts +1 -0
- package/lib/typescript/assets/IconsSVG/activity/Stretching.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/assets/IconsSVG/activity/Swimming.d.ts +1 -0
- package/lib/typescript/assets/IconsSVG/activity/Swimming.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/assets/IconsSVG/activity/Walking.d.ts +1 -0
- package/lib/typescript/assets/IconsSVG/activity/Walking.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/assets/IconsSVG/mood/Happy.d.ts +1 -0
- package/lib/typescript/assets/IconsSVG/mood/Happy.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/assets/IconsSVG/mood/Neutral.d.ts +1 -0
- package/lib/typescript/assets/IconsSVG/mood/Neutral.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/assets/IconsSVG/mood/Sad.d.ts +1 -0
- package/lib/typescript/assets/IconsSVG/mood/Sad.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/assets/IconsSVG/mood/SemiHappy.d.ts +1 -0
- package/lib/typescript/assets/IconsSVG/mood/SemiHappy.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/assets/IconsSVG/mood/SemiSad.d.ts +1 -0
- package/lib/typescript/assets/IconsSVG/mood/SemiSad.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/ExitModal.d.ts +1 -0
- package/lib/typescript/components/ExitModal.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/InfoBars.d.ts +1 -0
- package/lib/typescript/components/InfoBars.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/InvisibleNumberInput.d.ts +1 -0
- package/lib/typescript/components/InvisibleNumberInput.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/LineSeparator.d.ts +1 -0
- package/lib/typescript/components/LineSeparator.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/RecentInsulin.d.ts +1 -0
- package/lib/typescript/components/RecentInsulin.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/RecommendationModal.d.ts +1 -0
- package/lib/typescript/components/RecommendationModal.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/RecommendedCarbs.d.ts +1 -0
- package/lib/typescript/components/RecommendedCarbs.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/RecommendedInsulin.d.ts +1 -0
- package/lib/typescript/components/RecommendedInsulin.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/Remeasure.d.ts +1 -0
- package/lib/typescript/components/Remeasure.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/Text.d.ts +1 -0
- package/lib/typescript/components/Text.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/TimeoutModal.d.ts +1 -0
- package/lib/typescript/components/TimeoutModal.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/TransferToLogbook.d.ts +1 -0
- package/lib/typescript/components/TransferToLogbook.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/activity/Activity.d.ts +1 -0
- package/lib/typescript/components/activity/Activity.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/activity/ActivityIcon.d.ts +1 -0
- package/lib/typescript/components/activity/ActivityIcon.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/activity/ActivityIntensity.d.ts +1 -0
- package/lib/typescript/components/activity/ActivityIntensity.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/mood/Emotion.d.ts +1 -0
- package/lib/typescript/components/mood/Emotion.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/mood/MoodIcon.d.ts +1 -0
- package/lib/typescript/components/mood/MoodIcon.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/styles/fonts.d.ts +1 -0
- package/lib/typescript/components/styles/fonts.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +5 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/locales/translate.d.ts +1 -0
- package/lib/typescript/locales/translate.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/types/enum.d.ts +1 -0
- package/lib/typescript/types/enum.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/types/types.d.ts +1 -0
- package/lib/typescript/types/types.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/utils/AttentionMessages.d.ts +1 -0
- package/lib/typescript/utils/AttentionMessages.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/utils/Constants.d.ts +1 -0
- package/lib/typescript/utils/Constants.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/utils/RecommendationError.d.ts +1 -0
- package/lib/typescript/utils/RecommendationError.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/utils/RecommendationUtils.d.ts +1 -0
- package/lib/typescript/utils/RecommendationUtils.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/utils/Translations.d.ts +1 -0
- package/lib/typescript/utils/Translations.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/utils/Utils.d.ts +1 -0
- package/lib/typescript/utils/Utils.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/utils/Validations.d.ts +1 -0
- package/lib/typescript/utils/Validations.d.ts.map +1 -0
- package/package.json +27 -7
- package/src/RecommendationScreen.tsx +854 -0
- package/src/assets/IconsSVG/Close.tsx +13 -0
- package/src/assets/IconsSVG/CloseOutlined.tsx +23 -0
- package/src/assets/IconsSVG/Edit.tsx +16 -0
- package/src/assets/IconsSVG/activity/Cycling.tsx +41 -0
- package/src/assets/IconsSVG/activity/Running.tsx +29 -0
- package/src/assets/IconsSVG/activity/Stretching.tsx +29 -0
- package/src/assets/IconsSVG/activity/Swimming.tsx +47 -0
- package/src/assets/IconsSVG/activity/Walking.tsx +35 -0
- package/src/assets/IconsSVG/mood/Happy.tsx +30 -0
- package/src/assets/IconsSVG/mood/Neutral.tsx +30 -0
- package/src/assets/IconsSVG/mood/Sad.tsx +30 -0
- package/src/assets/IconsSVG/mood/SemiHappy.tsx +30 -0
- package/src/assets/IconsSVG/mood/SemiSad.tsx +30 -0
- package/src/components/ExitModal.tsx +134 -0
- package/src/components/InfoBars.tsx +122 -0
- package/src/components/InvisibleNumberInput.tsx +170 -0
- package/src/components/LineSeparator.tsx +29 -0
- package/src/components/RecentInsulin.tsx +109 -0
- package/src/components/RecommendationModal.tsx +319 -0
- package/src/components/RecommendedCarbs.tsx +303 -0
- package/src/components/RecommendedInsulin.tsx +219 -0
- package/src/components/Remeasure.tsx +135 -0
- package/src/components/Text.tsx +27 -0
- package/src/components/TimeoutModal.tsx +121 -0
- package/src/components/TransferToLogbook.tsx +92 -0
- package/src/components/activity/Activity.tsx +107 -0
- package/src/components/activity/ActivityIcon.tsx +77 -0
- package/src/components/activity/ActivityIntensity.tsx +67 -0
- package/src/components/mood/Emotion.tsx +97 -0
- package/src/components/mood/MoodIcon.tsx +91 -0
- package/src/components/styles/fonts.ts +145 -0
- package/src/index.ts +5 -0
- package/src/locales/da/translations.json +82 -0
- package/src/locales/de/translations.json +81 -0
- package/src/locales/en/translations.json +84 -0
- package/src/locales/es/translations.json +81 -0
- package/src/locales/fr/translations.json +81 -0
- package/src/locales/it/translations.json +81 -0
- package/src/locales/translate.ts +62 -0
- package/src/types/enum.ts +164 -0
- package/src/types/types.ts +19 -0
- package/src/utils/AttentionMessages.ts +167 -0
- package/src/utils/Constants.ts +77 -0
- package/src/utils/RecommendationError.ts +182 -0
- package/src/utils/RecommendationUtils.ts +232 -0
- package/src/utils/Translations.ts +17 -0
- package/src/utils/Utils.ts +156 -0
- package/src/utils/Validations.ts +490 -0
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -6
- package/dist/index.js.map +0 -1
- package/dist/src/RecommendationScreen.js +0 -537
- package/dist/src/RecommendationScreen.js.map +0 -1
- package/dist/src/assets/IconsSVG/Close.js +0 -7
- package/dist/src/assets/IconsSVG/Close.js.map +0 -1
- package/dist/src/assets/IconsSVG/CloseOutlined.js +0 -9
- package/dist/src/assets/IconsSVG/CloseOutlined.js.map +0 -1
- package/dist/src/assets/IconsSVG/Edit.js +0 -8
- package/dist/src/assets/IconsSVG/Edit.js.map +0 -1
- package/dist/src/assets/IconsSVG/activity/Cycling.js +0 -12
- package/dist/src/assets/IconsSVG/activity/Cycling.js.map +0 -1
- package/dist/src/assets/IconsSVG/activity/Running.js +0 -10
- package/dist/src/assets/IconsSVG/activity/Running.js.map +0 -1
- package/dist/src/assets/IconsSVG/activity/Stretching.js +0 -10
- package/dist/src/assets/IconsSVG/activity/Stretching.js.map +0 -1
- package/dist/src/assets/IconsSVG/activity/Swimming.js +0 -13
- package/dist/src/assets/IconsSVG/activity/Swimming.js.map +0 -1
- package/dist/src/assets/IconsSVG/activity/Walking.js +0 -11
- package/dist/src/assets/IconsSVG/activity/Walking.js.map +0 -1
- package/dist/src/assets/IconsSVG/mood/Happy.js +0 -11
- package/dist/src/assets/IconsSVG/mood/Happy.js.map +0 -1
- package/dist/src/assets/IconsSVG/mood/Neutral.js +0 -11
- package/dist/src/assets/IconsSVG/mood/Neutral.js.map +0 -1
- package/dist/src/assets/IconsSVG/mood/Sad.js +0 -11
- package/dist/src/assets/IconsSVG/mood/Sad.js.map +0 -1
- package/dist/src/assets/IconsSVG/mood/SemiHappy.js +0 -11
- package/dist/src/assets/IconsSVG/mood/SemiHappy.js.map +0 -1
- package/dist/src/assets/IconsSVG/mood/SemiSad.js +0 -11
- package/dist/src/assets/IconsSVG/mood/SemiSad.js.map +0 -1
- package/dist/src/components/ExitModal.js +0 -91
- package/dist/src/components/ExitModal.js.map +0 -1
- package/dist/src/components/InfoBars.js +0 -98
- package/dist/src/components/InfoBars.js.map +0 -1
- package/dist/src/components/InvisibleNumberInput.js +0 -123
- package/dist/src/components/InvisibleNumberInput.js.map +0 -1
- package/dist/src/components/LineSeparator.js +0 -17
- package/dist/src/components/LineSeparator.js.map +0 -1
- package/dist/src/components/RecentInsulin.js +0 -90
- package/dist/src/components/RecentInsulin.js.map +0 -1
- package/dist/src/components/RecommendationModal.js +0 -241
- package/dist/src/components/RecommendationModal.js.map +0 -1
- package/dist/src/components/RecommendedCarbs.js +0 -234
- package/dist/src/components/RecommendedCarbs.js.map +0 -1
- package/dist/src/components/RecommendedInsulin.js +0 -166
- package/dist/src/components/RecommendedInsulin.js.map +0 -1
- package/dist/src/components/Remeasure.js +0 -103
- package/dist/src/components/Remeasure.js.map +0 -1
- package/dist/src/components/Text.js +0 -14
- package/dist/src/components/Text.js.map +0 -1
- package/dist/src/components/TimeoutModal.js +0 -84
- package/dist/src/components/TimeoutModal.js.map +0 -1
- package/dist/src/components/TransferToLogbook.js +0 -68
- package/dist/src/components/TransferToLogbook.js.map +0 -1
- package/dist/src/components/activity/Activity.js +0 -93
- package/dist/src/components/activity/Activity.js.map +0 -1
- package/dist/src/components/activity/ActivityIcon.js +0 -66
- package/dist/src/components/activity/ActivityIcon.js.map +0 -1
- package/dist/src/components/activity/ActivityIntensity.js +0 -55
- package/dist/src/components/activity/ActivityIntensity.js.map +0 -1
- package/dist/src/components/mood/Emotion.js +0 -69
- package/dist/src/components/mood/Emotion.js.map +0 -1
- package/dist/src/components/mood/MoodIcon.js +0 -68
- package/dist/src/components/mood/MoodIcon.js.map +0 -1
- package/dist/src/components/styles/fonts.js +0 -145
- package/dist/src/components/styles/fonts.js.map +0 -1
- package/dist/src/locales/da/translations.json +0 -82
- package/dist/src/locales/de/translations.json +0 -81
- package/dist/src/locales/en/translations.json +0 -84
- package/dist/src/locales/es/translations.json +0 -81
- package/dist/src/locales/fr/translations.json +0 -81
- package/dist/src/locales/it/translations.json +0 -81
- package/dist/src/locales/translate.js +0 -53
- package/dist/src/locales/translate.js.map +0 -1
- package/dist/src/types/enum.js +0 -154
- package/dist/src/types/enum.js.map +0 -1
- package/dist/src/types/types.js.map +0 -1
- package/dist/src/utils/AttentionMessages.js +0 -123
- package/dist/src/utils/AttentionMessages.js.map +0 -1
- package/dist/src/utils/Constants.js.map +0 -1
- package/dist/src/utils/RecommendationError.js.map +0 -1
- package/dist/src/utils/RecommendationUtils.js.map +0 -1
- package/dist/src/utils/Translations.js.map +0 -1
- package/dist/src/utils/Utils.js +0 -142
- package/dist/src/utils/Utils.js.map +0 -1
- package/dist/src/utils/Validations.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- /package/{dist/src → lib/module}/types/types.js +0 -0
|
@@ -0,0 +1,291 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,OAAOC,IAAI,MAAM,QAAQ;AAEzB,MAAM;EAAEC;AAA2B,CAAC,GAAGJ,OAAO,CAACK,EAAE;AAiCjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAMC,mBAAmB,SAASf,KAAK,CAACgB,SAAS,CAA2B;EAC1F;AACD;AACA;AACA;AACA;AACA;EACCC,WAAWA,CAACC,KAAkB,EAAE;IAC/B,KAAK,CAACA,KAAK,CAAC;IACZ,IAAI,CAACC,KAAK,GAAG;MACZC,gBAAgB,EAAE,CAAC,CAAC,IAAI,CAACF,KAAK,CAACG;IAChC,CAAC;EACF;;EAEA;AACD;AACA;AACA;EACQC,kBAAkBA,CAACC,SAAgC,EAAQ;IACjE,IAAI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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"}
|
|
@@ -0,0 +1,281 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,OAAOC,IAAI,MAAM,yBAAyB;AAC1C,SAASC,CAAC,QAAQ,sBAAsB;AACxC,SAASC,OAAO,QAAQ,eAAe;AACvC,SAASC,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,sBAAsB,QAAQ,8BAA8B;AACrE,OAAOC,oBAAoB,MAAM,wBAAwB;AACzD,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,SAASC,KAAK,QAAQ,gBAAgB;AACtC,OAAOC,IAAI,MAAM,QAAQ;AAEzB,MAAM;EAAEC;AAAwB,CAAC,GAAGP,OAAO,CAACQ,EAAE;AA4B9C;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAMC,gBAAgB,SAASjB,KAAK,CAACkB,SAAS,CAAiB;EAC7E;EACOC,KAAK,GAAW;IACtBC,Y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