@hedia/recommendation-screen 2.1.75 → 2.2.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/{lib/typescript → dist/src}/RecommendationScreen.d.ts +68 -82
- package/dist/src/RecommendationScreen.js +522 -0
- package/dist/src/assets/assets/activity/Cyclist.png +0 -0
- package/dist/src/assets/assets/activity/Other.png +0 -0
- package/dist/src/assets/assets/activity/Runner.png +0 -0
- package/dist/src/assets/assets/activity/Swimmer.png +0 -0
- package/dist/src/assets/assets/activity/Walk.png +0 -0
- package/dist/src/assets/assets/fonts/Poppins-Bold.ttf +0 -0
- package/dist/src/assets/assets/fonts/Poppins-SemiBold.ttf +0 -0
- package/dist/src/assets/assets/icons/Edit.tsx +22 -0
- package/dist/src/assets/assets/icons/X.tsx +14 -0
- package/dist/src/assets/assets/mood/happy.png +0 -0
- package/dist/src/assets/assets/mood/happy_active.png +0 -0
- package/dist/src/assets/assets/mood/neutral.png +0 -0
- package/dist/src/assets/assets/mood/neutral_active.png +0 -0
- package/dist/src/assets/assets/mood/sad.png +0 -0
- package/dist/src/assets/assets/mood/sad_active.png +0 -0
- package/dist/src/assets/assets/mood/semi_happy.png +0 -0
- package/dist/src/assets/assets/mood/semi_happy_active.png +0 -0
- package/dist/src/assets/assets/mood/semi_sad.png +0 -0
- package/dist/src/assets/assets/mood/semi_sad_active.png +0 -0
- package/dist/src/assets/icons/Edit.d.ts +4 -0
- package/dist/src/assets/icons/Edit.js +7 -0
- package/dist/src/assets/icons/X.d.ts +4 -0
- package/dist/src/assets/icons/X.js +6 -0
- package/dist/src/components/ForecastInfoBar.d.ts +109 -0
- package/dist/src/components/ForecastInfoBar.js +138 -0
- package/dist/src/components/Header.d.ts +8 -0
- package/dist/src/components/Header.js +54 -0
- package/dist/src/components/Icon.d.ts +20 -0
- package/dist/src/components/Icon.js +43 -0
- package/{lib/typescript → dist/src}/components/InfoBars.d.ts +28 -14
- package/dist/src/components/InfoBars.js +128 -0
- package/{lib/typescript → dist/src}/components/InvisibleNumberInput.d.ts +3 -9
- package/dist/src/components/InvisibleNumberInput.js +121 -0
- package/dist/src/components/LimitationMessage.d.ts +14 -0
- package/dist/src/components/LimitationMessage.js +30 -0
- package/{lib/typescript → dist/src}/components/LineSeparator.d.ts +1 -6
- package/dist/src/components/LineSeparator.js +18 -0
- package/{lib/typescript → dist/src}/components/RecentInsulin.d.ts +1 -3
- package/dist/src/components/RecentInsulin.js +73 -0
- package/{lib/typescript → dist/src}/components/RecommendationModal.d.ts +63 -63
- package/dist/src/components/RecommendationModal.js +226 -0
- package/{lib/typescript → dist/src}/components/RecommendedCarbs.d.ts +0 -3
- package/dist/src/components/RecommendedCarbs.js +251 -0
- package/{lib/typescript → dist/src}/components/RecommendedInsulin.d.ts +1 -2
- package/dist/src/components/RecommendedInsulin.js +180 -0
- package/{lib/typescript → dist/src}/components/Remeasure.d.ts +15 -6
- package/dist/src/components/Remeasure.js +130 -0
- package/{lib/typescript/components/TransferToLogbook.d.ts → dist/src/components/SaveButton.d.ts} +2 -3
- package/dist/src/components/SaveButton.js +71 -0
- package/dist/src/components/TwoOptionModal.d.ts +136 -0
- package/dist/src/components/TwoOptionModal.js +141 -0
- package/{lib/typescript → dist/src}/components/activity/Activity.d.ts +2 -3
- package/dist/src/components/activity/Activity.js +84 -0
- package/{lib/typescript → dist/src}/components/activity/ActivityIcon.d.ts +7 -8
- package/dist/src/components/activity/ActivityIcon.js +58 -0
- package/{lib/typescript → dist/src}/components/activity/ActivityIntensity.d.ts +1 -2
- package/dist/src/components/activity/ActivityIntensity.js +58 -0
- package/{lib/typescript → dist/src}/components/mood/Emotion.d.ts +1 -2
- package/dist/src/components/mood/Emotion.js +64 -0
- package/{lib/typescript → dist/src}/components/mood/MoodIcon.d.ts +5 -5
- package/dist/src/components/mood/MoodIcon.js +63 -0
- package/dist/src/components/text/TextBold.d.ts +8 -0
- package/dist/src/components/text/TextBold.js +12 -0
- package/dist/src/components/text/TextRegular.d.ts +8 -0
- package/dist/src/components/text/TextRegular.js +12 -0
- package/dist/src/locale/da/messages.js +1 -0
- package/dist/src/locale/da/messages.po +353 -0
- package/dist/src/locale/de/messages.js +1 -0
- package/dist/src/locale/de/messages.po +353 -0
- package/dist/src/locale/en/messages.js +1 -0
- package/dist/src/locale/en/messages.po +353 -0
- package/dist/src/locale/es/messages.js +1 -0
- package/dist/src/locale/es/messages.po +353 -0
- package/dist/src/locale/fr/messages.js +1 -0
- package/dist/src/locale/fr/messages.po +353 -0
- package/dist/src/locale/i18nUtils.d.ts +18 -0
- package/dist/src/locale/i18nUtils.js +39 -0
- package/dist/src/locale/it/messages.js +1 -0
- package/dist/src/locale/it/messages.po +353 -0
- package/{lib/typescript → dist/src}/types/enum.d.ts +15 -22
- package/dist/src/types/enum.js +145 -0
- package/{lib/typescript → dist/src}/types/types.d.ts +0 -1
- package/dist/src/types/types.js +1 -0
- package/{lib/typescript → dist/src}/utils/AttentionMessages.d.ts +0 -1
- package/dist/src/utils/AttentionMessages.js +118 -0
- package/{lib/typescript → dist/src}/utils/Constants.d.ts +3 -18
- package/{lib/module → dist/src}/utils/Constants.js +21 -79
- package/{lib/typescript → dist/src}/utils/RecommendationError.d.ts +0 -1
- package/dist/src/utils/RecommendationError.js +63 -0
- package/{lib/typescript → dist/src}/utils/RecommendationUtils.d.ts +0 -1
- package/{lib/module → dist/src}/utils/RecommendationUtils.js +88 -90
- package/{lib/typescript → dist/src}/utils/Translations.d.ts +0 -1
- package/{lib/module → dist/src}/utils/Translations.js +5 -7
- package/{lib/typescript → dist/src}/utils/Utils.d.ts +1 -2
- package/dist/src/utils/Utils.js +141 -0
- package/{lib/typescript → dist/src}/utils/Validations.d.ts +1 -2
- package/{lib/module → dist/src}/utils/Validations.js +128 -156
- package/package.json +96 -109
- package/lib/commonjs/RecommendationScreen.js +0 -778
- package/lib/commonjs/RecommendationScreen.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/Close.js +0 -20
- package/lib/commonjs/assets/IconsSVG/Close.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/CloseOutlined.js +0 -28
- package/lib/commonjs/assets/IconsSVG/CloseOutlined.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/Edit.js +0 -23
- package/lib/commonjs/assets/IconsSVG/Edit.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/activity/Cycling.js +0 -43
- package/lib/commonjs/assets/IconsSVG/activity/Cycling.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/activity/Running.js +0 -33
- package/lib/commonjs/assets/IconsSVG/activity/Running.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/activity/Stretching.js +0 -33
- package/lib/commonjs/assets/IconsSVG/activity/Stretching.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/activity/Swimming.js +0 -48
- package/lib/commonjs/assets/IconsSVG/activity/Swimming.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/activity/Walking.js +0 -38
- package/lib/commonjs/assets/IconsSVG/activity/Walking.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/mood/Happy.js +0 -34
- package/lib/commonjs/assets/IconsSVG/mood/Happy.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/mood/Neutral.js +0 -34
- package/lib/commonjs/assets/IconsSVG/mood/Neutral.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/mood/Sad.js +0 -34
- package/lib/commonjs/assets/IconsSVG/mood/Sad.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/mood/SemiHappy.js +0 -34
- package/lib/commonjs/assets/IconsSVG/mood/SemiHappy.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/mood/SemiSad.js +0 -34
- package/lib/commonjs/assets/IconsSVG/mood/SemiSad.js.map +0 -1
- package/lib/commonjs/components/ExitModal.js +0 -124
- package/lib/commonjs/components/ExitModal.js.map +0 -1
- package/lib/commonjs/components/InfoBars.js +0 -123
- package/lib/commonjs/components/InfoBars.js.map +0 -1
- package/lib/commonjs/components/InvisibleNumberInput.js +0 -150
- package/lib/commonjs/components/InvisibleNumberInput.js.map +0 -1
- package/lib/commonjs/components/LineSeparator.js +0 -27
- package/lib/commonjs/components/LineSeparator.js.map +0 -1
- package/lib/commonjs/components/RecentInsulin.js +0 -105
- package/lib/commonjs/components/RecentInsulin.js.map +0 -1
- package/lib/commonjs/components/RecommendationModal.js +0 -302
- package/lib/commonjs/components/RecommendationModal.js.map +0 -1
- package/lib/commonjs/components/RecommendedCarbs.js +0 -289
- package/lib/commonjs/components/RecommendedCarbs.js.map +0 -1
- package/lib/commonjs/components/RecommendedInsulin.js +0 -209
- package/lib/commonjs/components/RecommendedInsulin.js.map +0 -1
- package/lib/commonjs/components/Remeasure.js +0 -131
- package/lib/commonjs/components/Remeasure.js.map +0 -1
- package/lib/commonjs/components/Text.js +0 -25
- package/lib/commonjs/components/Text.js.map +0 -1
- package/lib/commonjs/components/TimeoutModal.js +0 -113
- package/lib/commonjs/components/TimeoutModal.js.map +0 -1
- package/lib/commonjs/components/TransferToLogbook.js +0 -83
- package/lib/commonjs/components/TransferToLogbook.js.map +0 -1
- package/lib/commonjs/components/activity/Activity.js +0 -112
- package/lib/commonjs/components/activity/Activity.js.map +0 -1
- package/lib/commonjs/components/activity/ActivityIcon.js +0 -86
- package/lib/commonjs/components/activity/ActivityIcon.js.map +0 -1
- package/lib/commonjs/components/activity/ActivityIntensity.js +0 -65
- package/lib/commonjs/components/activity/ActivityIntensity.js.map +0 -1
- package/lib/commonjs/components/mood/Emotion.js +0 -86
- package/lib/commonjs/components/mood/Emotion.js.map +0 -1
- package/lib/commonjs/components/mood/MoodIcon.js +0 -107
- package/lib/commonjs/components/mood/MoodIcon.js.map +0 -1
- package/lib/commonjs/components/styles/fonts.js +0 -160
- package/lib/commonjs/components/styles/fonts.js.map +0 -1
- package/lib/commonjs/index.js +0 -21
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/locales/da/translations.json +0 -82
- package/lib/commonjs/locales/de/translations.json +0 -81
- package/lib/commonjs/locales/en/translations.json +0 -84
- package/lib/commonjs/locales/es/translations.json +0 -81
- package/lib/commonjs/locales/fr/translations.json +0 -81
- package/lib/commonjs/locales/it/translations.json +0 -81
- package/lib/commonjs/locales/translate.js +0 -63
- package/lib/commonjs/locales/translate.js.map +0 -1
- package/lib/commonjs/types/enum.js +0 -179
- package/lib/commonjs/types/enum.js.map +0 -1
- package/lib/commonjs/types/types.js +0 -6
- package/lib/commonjs/types/types.js.map +0 -1
- package/lib/commonjs/utils/AttentionMessages.js +0 -141
- package/lib/commonjs/utils/AttentionMessages.js.map +0 -1
- package/lib/commonjs/utils/Constants.js +0 -138
- package/lib/commonjs/utils/Constants.js.map +0 -1
- package/lib/commonjs/utils/RecommendationError.js +0 -116
- package/lib/commonjs/utils/RecommendationError.js.map +0 -1
- package/lib/commonjs/utils/RecommendationUtils.js +0 -212
- package/lib/commonjs/utils/RecommendationUtils.js.map +0 -1
- package/lib/commonjs/utils/Translations.js +0 -22
- package/lib/commonjs/utils/Translations.js.map +0 -1
- package/lib/commonjs/utils/Utils.js +0 -162
- package/lib/commonjs/utils/Utils.js.map +0 -1
- package/lib/commonjs/utils/Validations.js +0 -468
- package/lib/commonjs/utils/Validations.js.map +0 -1
- package/lib/module/RecommendationScreen.js +0 -768
- package/lib/module/RecommendationScreen.js.map +0 -1
- package/lib/module/assets/IconsSVG/Close.js +0 -11
- package/lib/module/assets/IconsSVG/Close.js.map +0 -1
- package/lib/module/assets/IconsSVG/CloseOutlined.js +0 -19
- package/lib/module/assets/IconsSVG/CloseOutlined.js.map +0 -1
- package/lib/module/assets/IconsSVG/Edit.js +0 -14
- package/lib/module/assets/IconsSVG/Edit.js.map +0 -1
- package/lib/module/assets/IconsSVG/activity/Cycling.js +0 -34
- package/lib/module/assets/IconsSVG/activity/Cycling.js.map +0 -1
- package/lib/module/assets/IconsSVG/activity/Running.js +0 -24
- package/lib/module/assets/IconsSVG/activity/Running.js.map +0 -1
- package/lib/module/assets/IconsSVG/activity/Stretching.js +0 -24
- package/lib/module/assets/IconsSVG/activity/Stretching.js.map +0 -1
- package/lib/module/assets/IconsSVG/activity/Swimming.js +0 -39
- package/lib/module/assets/IconsSVG/activity/Swimming.js.map +0 -1
- package/lib/module/assets/IconsSVG/activity/Walking.js +0 -29
- package/lib/module/assets/IconsSVG/activity/Walking.js.map +0 -1
- package/lib/module/assets/IconsSVG/mood/Happy.js +0 -25
- package/lib/module/assets/IconsSVG/mood/Happy.js.map +0 -1
- package/lib/module/assets/IconsSVG/mood/Neutral.js +0 -25
- package/lib/module/assets/IconsSVG/mood/Neutral.js.map +0 -1
- package/lib/module/assets/IconsSVG/mood/Sad.js +0 -25
- package/lib/module/assets/IconsSVG/mood/Sad.js.map +0 -1
- package/lib/module/assets/IconsSVG/mood/SemiHappy.js +0 -25
- package/lib/module/assets/IconsSVG/mood/SemiHappy.js.map +0 -1
- package/lib/module/assets/IconsSVG/mood/SemiSad.js +0 -25
- package/lib/module/assets/IconsSVG/mood/SemiSad.js.map +0 -1
- package/lib/module/components/ExitModal.js +0 -114
- package/lib/module/components/ExitModal.js.map +0 -1
- package/lib/module/components/InfoBars.js +0 -114
- package/lib/module/components/InfoBars.js.map +0 -1
- package/lib/module/components/InvisibleNumberInput.js +0 -142
- package/lib/module/components/InvisibleNumberInput.js.map +0 -1
- package/lib/module/components/LineSeparator.js +0 -19
- package/lib/module/components/LineSeparator.js.map +0 -1
- package/lib/module/components/RecentInsulin.js +0 -97
- package/lib/module/components/RecentInsulin.js.map +0 -1
- package/lib/module/components/RecommendationModal.js +0 -291
- package/lib/module/components/RecommendationModal.js.map +0 -1
- package/lib/module/components/RecommendedCarbs.js +0 -281
- package/lib/module/components/RecommendedCarbs.js.map +0 -1
- package/lib/module/components/RecommendedInsulin.js +0 -201
- package/lib/module/components/RecommendedInsulin.js.map +0 -1
- package/lib/module/components/Remeasure.js +0 -123
- package/lib/module/components/Remeasure.js.map +0 -1
- package/lib/module/components/Text.js +0 -16
- package/lib/module/components/Text.js.map +0 -1
- package/lib/module/components/TimeoutModal.js +0 -103
- package/lib/module/components/TimeoutModal.js.map +0 -1
- package/lib/module/components/TransferToLogbook.js +0 -75
- package/lib/module/components/TransferToLogbook.js.map +0 -1
- package/lib/module/components/activity/Activity.js +0 -104
- package/lib/module/components/activity/Activity.js.map +0 -1
- package/lib/module/components/activity/ActivityIcon.js +0 -78
- package/lib/module/components/activity/ActivityIcon.js.map +0 -1
- package/lib/module/components/activity/ActivityIntensity.js +0 -57
- package/lib/module/components/activity/ActivityIntensity.js.map +0 -1
- package/lib/module/components/mood/Emotion.js +0 -78
- package/lib/module/components/mood/Emotion.js.map +0 -1
- package/lib/module/components/mood/MoodIcon.js +0 -97
- package/lib/module/components/mood/MoodIcon.js.map +0 -1
- package/lib/module/components/styles/fonts.js +0 -152
- package/lib/module/components/styles/fonts.js.map +0 -1
- package/lib/module/index.js +0 -5
- package/lib/module/index.js.map +0 -1
- package/lib/module/locales/da/translations.json +0 -82
- package/lib/module/locales/de/translations.json +0 -81
- package/lib/module/locales/en/translations.json +0 -84
- package/lib/module/locales/es/translations.json +0 -81
- package/lib/module/locales/fr/translations.json +0 -81
- package/lib/module/locales/it/translations.json +0 -81
- package/lib/module/locales/translate.js +0 -55
- package/lib/module/locales/translate.js.map +0 -1
- package/lib/module/types/enum.js +0 -170
- package/lib/module/types/enum.js.map +0 -1
- package/lib/module/types/types.js +0 -2
- package/lib/module/types/types.js.map +0 -1
- package/lib/module/utils/AttentionMessages.js +0 -131
- package/lib/module/utils/AttentionMessages.js.map +0 -1
- package/lib/module/utils/Constants.js.map +0 -1
- package/lib/module/utils/RecommendationError.js +0 -87
- package/lib/module/utils/RecommendationError.js.map +0 -1
- package/lib/module/utils/RecommendationUtils.js.map +0 -1
- package/lib/module/utils/Translations.js.map +0 -1
- package/lib/module/utils/Utils.js +0 -155
- package/lib/module/utils/Utils.js.map +0 -1
- package/lib/module/utils/Validations.js.map +0 -1
- package/lib/typescript/RecommendationScreen.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/Close.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/Close.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/CloseOutlined.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/CloseOutlined.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/Edit.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/Edit.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/activity/Cycling.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/activity/Cycling.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/activity/Running.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/activity/Running.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/activity/Stretching.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/activity/Stretching.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/activity/Swimming.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/activity/Swimming.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/activity/Walking.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/activity/Walking.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/mood/Happy.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/mood/Happy.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/mood/Neutral.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/mood/Neutral.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/mood/Sad.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/mood/Sad.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/mood/SemiHappy.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/mood/SemiHappy.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/mood/SemiSad.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/mood/SemiSad.d.ts.map +0 -1
- package/lib/typescript/components/ExitModal.d.ts +0 -26
- package/lib/typescript/components/ExitModal.d.ts.map +0 -1
- package/lib/typescript/components/InfoBars.d.ts.map +0 -1
- package/lib/typescript/components/InvisibleNumberInput.d.ts.map +0 -1
- package/lib/typescript/components/LineSeparator.d.ts.map +0 -1
- package/lib/typescript/components/RecentInsulin.d.ts.map +0 -1
- package/lib/typescript/components/RecommendationModal.d.ts.map +0 -1
- package/lib/typescript/components/RecommendedCarbs.d.ts.map +0 -1
- package/lib/typescript/components/RecommendedInsulin.d.ts.map +0 -1
- package/lib/typescript/components/Remeasure.d.ts.map +0 -1
- package/lib/typescript/components/Text.d.ts +0 -14
- package/lib/typescript/components/Text.d.ts.map +0 -1
- package/lib/typescript/components/TimeoutModal.d.ts +0 -25
- package/lib/typescript/components/TimeoutModal.d.ts.map +0 -1
- package/lib/typescript/components/TransferToLogbook.d.ts.map +0 -1
- package/lib/typescript/components/activity/Activity.d.ts.map +0 -1
- package/lib/typescript/components/activity/ActivityIcon.d.ts.map +0 -1
- package/lib/typescript/components/activity/ActivityIntensity.d.ts.map +0 -1
- package/lib/typescript/components/mood/Emotion.d.ts.map +0 -1
- package/lib/typescript/components/mood/MoodIcon.d.ts.map +0 -1
- package/lib/typescript/components/styles/fonts.d.ts +0 -151
- package/lib/typescript/components/styles/fonts.d.ts.map +0 -1
- package/lib/typescript/index.d.ts +0 -5
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/locales/translate.d.ts +0 -20
- package/lib/typescript/locales/translate.d.ts.map +0 -1
- package/lib/typescript/types/enum.d.ts.map +0 -1
- package/lib/typescript/types/types.d.ts.map +0 -1
- package/lib/typescript/utils/AttentionMessages.d.ts.map +0 -1
- package/lib/typescript/utils/Constants.d.ts.map +0 -1
- package/lib/typescript/utils/RecommendationError.d.ts.map +0 -1
- package/lib/typescript/utils/RecommendationUtils.d.ts.map +0 -1
- package/lib/typescript/utils/Translations.d.ts.map +0 -1
- package/lib/typescript/utils/Utils.d.ts.map +0 -1
- package/lib/typescript/utils/Validations.d.ts.map +0 -1
- package/src/RecommendationScreen.tsx +0 -854
- package/src/assets/IconsSVG/Close.tsx +0 -13
- package/src/assets/IconsSVG/CloseOutlined.tsx +0 -23
- package/src/assets/IconsSVG/Edit.tsx +0 -16
- package/src/assets/IconsSVG/activity/Cycling.tsx +0 -41
- package/src/assets/IconsSVG/activity/Running.tsx +0 -29
- package/src/assets/IconsSVG/activity/Stretching.tsx +0 -29
- package/src/assets/IconsSVG/activity/Swimming.tsx +0 -47
- package/src/assets/IconsSVG/activity/Walking.tsx +0 -35
- package/src/assets/IconsSVG/mood/Happy.tsx +0 -30
- package/src/assets/IconsSVG/mood/Neutral.tsx +0 -30
- package/src/assets/IconsSVG/mood/Sad.tsx +0 -30
- package/src/assets/IconsSVG/mood/SemiHappy.tsx +0 -30
- package/src/assets/IconsSVG/mood/SemiSad.tsx +0 -30
- package/src/components/ExitModal.tsx +0 -134
- package/src/components/InfoBars.tsx +0 -122
- package/src/components/InvisibleNumberInput.tsx +0 -170
- package/src/components/LineSeparator.tsx +0 -29
- package/src/components/RecentInsulin.tsx +0 -109
- package/src/components/RecommendationModal.tsx +0 -319
- package/src/components/RecommendedCarbs.tsx +0 -303
- package/src/components/RecommendedInsulin.tsx +0 -220
- package/src/components/Remeasure.tsx +0 -135
- package/src/components/Text.tsx +0 -27
- package/src/components/TimeoutModal.tsx +0 -121
- package/src/components/TransferToLogbook.tsx +0 -92
- package/src/components/activity/Activity.tsx +0 -107
- package/src/components/activity/ActivityIcon.tsx +0 -77
- package/src/components/activity/ActivityIntensity.tsx +0 -67
- package/src/components/mood/Emotion.tsx +0 -97
- package/src/components/mood/MoodIcon.tsx +0 -91
- package/src/components/styles/fonts.ts +0 -151
- package/src/index.ts +0 -5
- package/src/locales/da/translations.json +0 -82
- package/src/locales/de/translations.json +0 -81
- package/src/locales/en/translations.json +0 -84
- package/src/locales/es/translations.json +0 -81
- package/src/locales/fr/translations.json +0 -81
- package/src/locales/it/translations.json +0 -81
- package/src/locales/translate.ts +0 -62
- package/src/types/enum.ts +0 -164
- package/src/types/types.ts +0 -19
- package/src/utils/AttentionMessages.ts +0 -167
- package/src/utils/Constants.ts +0 -77
- package/src/utils/RecommendationError.ts +0 -182
- package/src/utils/RecommendationUtils.ts +0 -232
- package/src/utils/Translations.ts +0 -17
- package/src/utils/Utils.ts +0 -156
- package/src/utils/Validations.ts +0 -490
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { StatusBar, StyleSheet, TouchableOpacity, View } from "react-native";
|
|
3
|
-
import ReactNativeModal from "react-native-modal";
|
|
4
|
-
|
|
5
|
-
import { Testing } from "../types/enum";
|
|
6
|
-
import { colors } from "../utils/Constants";
|
|
7
|
-
import { FONTS } from "./styles/fonts";
|
|
8
|
-
import Text from "./Text";
|
|
9
|
-
|
|
10
|
-
const { TimeOutModalTestIds } = Testing.Id;
|
|
11
|
-
|
|
12
|
-
export interface ITimeoutModalProps {
|
|
13
|
-
/** Whether the modal is visible or not. */
|
|
14
|
-
isVisible: boolean;
|
|
15
|
-
/** The title of the modal. */
|
|
16
|
-
title: string;
|
|
17
|
-
/** The message to show in the modal. */
|
|
18
|
-
message: string;
|
|
19
|
-
/** The label of the first option. */
|
|
20
|
-
textFirstOption: string;
|
|
21
|
-
/** The label of the second option. */
|
|
22
|
-
textSecondOption: string;
|
|
23
|
-
/** To be called if the user taps the first option button. */
|
|
24
|
-
firstOption(): void;
|
|
25
|
-
/** To be called if the user taps the second option button. */
|
|
26
|
-
secondOption(): void;
|
|
27
|
-
/** To be called when the modal is hidden. */
|
|
28
|
-
onModalHide(): void;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/** Display a modal with two buttons for the user to choose between. */
|
|
32
|
-
export default class TimeoutModal extends React.Component<ITimeoutModalProps> {
|
|
33
|
-
/** Compose a JSX element for displaying the modal. */
|
|
34
|
-
public render(): JSX.Element {
|
|
35
|
-
return (
|
|
36
|
-
<ReactNativeModal
|
|
37
|
-
style={style.container}
|
|
38
|
-
isVisible={this.props.isVisible}
|
|
39
|
-
onModalHide={this.props.onModalHide}
|
|
40
|
-
animationIn={`fadeIn`}
|
|
41
|
-
animationOut={`fadeOut`}
|
|
42
|
-
>
|
|
43
|
-
<StatusBar backgroundColor={colors.black} />
|
|
44
|
-
<View style={style.modalContainer}>
|
|
45
|
-
<View style={style.textContainer}>
|
|
46
|
-
<Text style={style.title}>{this.props.title}</Text>
|
|
47
|
-
<Text style={style.message}>{this.props.message}</Text>
|
|
48
|
-
</View>
|
|
49
|
-
<View style={style.buttonContainer}>
|
|
50
|
-
<TouchableOpacity
|
|
51
|
-
testID={TimeOutModalTestIds.FirstOption}
|
|
52
|
-
onPress={this.props.firstOption}
|
|
53
|
-
style={[style.button, { backgroundColor: colors.teal, marginBottom: 16 }]}
|
|
54
|
-
>
|
|
55
|
-
<Text style={style.textFirstButton}>{this.props.textFirstOption}</Text>
|
|
56
|
-
</TouchableOpacity>
|
|
57
|
-
<TouchableOpacity
|
|
58
|
-
testID={TimeOutModalTestIds.SecondOption}
|
|
59
|
-
onPress={this.props.secondOption}
|
|
60
|
-
style={style.button}
|
|
61
|
-
>
|
|
62
|
-
<Text style={style.textSecondButton}>{this.props.textSecondOption}</Text>
|
|
63
|
-
</TouchableOpacity>
|
|
64
|
-
</View>
|
|
65
|
-
</View>
|
|
66
|
-
</ReactNativeModal>
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
/** @internal */
|
|
71
|
-
const style = StyleSheet.create({
|
|
72
|
-
container: {
|
|
73
|
-
margin: 0,
|
|
74
|
-
justifyContent: `center`,
|
|
75
|
-
backgroundColor: colors.transparentBlack,
|
|
76
|
-
},
|
|
77
|
-
modalContainer: {
|
|
78
|
-
margin: 16,
|
|
79
|
-
padding: 24,
|
|
80
|
-
backgroundColor: colors.semiDarkBlue,
|
|
81
|
-
borderRadius: 24,
|
|
82
|
-
},
|
|
83
|
-
textContainer: {
|
|
84
|
-
alignSelf: `flex-start`,
|
|
85
|
-
marginBottom: 24,
|
|
86
|
-
},
|
|
87
|
-
title: {
|
|
88
|
-
...FONTS.Poppins.bold_XL,
|
|
89
|
-
color: colors.white,
|
|
90
|
-
textAlign: `center`,
|
|
91
|
-
marginBottom: 24,
|
|
92
|
-
},
|
|
93
|
-
message: {
|
|
94
|
-
...FONTS.Poppins.regular_Base,
|
|
95
|
-
color: colors.lightBlue,
|
|
96
|
-
textAlign: `center`,
|
|
97
|
-
},
|
|
98
|
-
buttonContainer: {
|
|
99
|
-
flexDirection: `column`,
|
|
100
|
-
justifyContent: `space-around`,
|
|
101
|
-
},
|
|
102
|
-
button: {
|
|
103
|
-
borderRadius: 50,
|
|
104
|
-
borderWidth: 1,
|
|
105
|
-
borderColor: colors.teal,
|
|
106
|
-
},
|
|
107
|
-
textFirstButton: {
|
|
108
|
-
...FONTS.Poppins.bold_LG,
|
|
109
|
-
textAlign: `center`,
|
|
110
|
-
color: colors.black,
|
|
111
|
-
paddingHorizontal: 16,
|
|
112
|
-
paddingVertical: 12,
|
|
113
|
-
},
|
|
114
|
-
textSecondButton: {
|
|
115
|
-
...FONTS.Poppins.bold_LG,
|
|
116
|
-
textAlign: `center`,
|
|
117
|
-
color: colors.teal,
|
|
118
|
-
paddingHorizontal: 16,
|
|
119
|
-
paddingVertical: 12,
|
|
120
|
-
},
|
|
121
|
-
});
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { StyleSheet, TouchableOpacity, View } from "react-native";
|
|
3
|
-
|
|
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
|
-
|
|
10
|
-
export interface IProps {
|
|
11
|
-
/** Whether or not the transfer button shall be visible on the screen. */
|
|
12
|
-
visible: boolean;
|
|
13
|
-
/** To be called when the button is pressed. */
|
|
14
|
-
transfer(): void;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface IState {
|
|
18
|
-
/** Keeps track of whether the button was already pressed and thus should be displayed in the inactive visually distinct pressed state. */
|
|
19
|
-
pressed: boolean;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Render a button for transferring the recommendation to a logbook entry.
|
|
24
|
-
* The button has a visually distinct pressed state to signal to the user that the button was actually activated before returning to the dashboard screen.
|
|
25
|
-
*/
|
|
26
|
-
export default class TransferToLogbook extends React.Component<IProps, IState> {
|
|
27
|
-
/** Initialise the state pressed variable with false */
|
|
28
|
-
public state: IState = {
|
|
29
|
-
pressed: false,
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Handle what happens when the button is pressed.
|
|
34
|
-
*
|
|
35
|
-
* Steps:
|
|
36
|
-
* 1. Toggle the pressed state to the opposite of its current value.
|
|
37
|
-
* 2. Call the transfer prop callback function.
|
|
38
|
-
*/
|
|
39
|
-
public handlePress = (): void => {
|
|
40
|
-
this.setState({
|
|
41
|
-
pressed: !this.state.pressed,
|
|
42
|
-
});
|
|
43
|
-
this.props.transfer();
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Steps:
|
|
48
|
-
* 1. If the visible prop is false, display an empty space to keep the correct margins in the screen.
|
|
49
|
-
* 2. Return a JSX element to display a touchable button (that is disabled when the pressed state is true)
|
|
50
|
-
* @returns JSX element for displaying the transfer button
|
|
51
|
-
*/
|
|
52
|
-
public render() {
|
|
53
|
-
if (!this.props.visible) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<TouchableOpacity
|
|
59
|
-
testID={Testing.Id.TransferToLogbookTestIds.TransferButton}
|
|
60
|
-
onPress={this.handlePress}
|
|
61
|
-
disabled={this.state.pressed}
|
|
62
|
-
style={addToLogbookStyles.container}
|
|
63
|
-
>
|
|
64
|
-
<View style={addToLogbookStyles.textContainer}>
|
|
65
|
-
<Text style={addToLogbookStyles.transferText}>{t(`Transfer to logbook`)}</Text>
|
|
66
|
-
</View>
|
|
67
|
-
</TouchableOpacity>
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const addToLogbookStyles = StyleSheet.create({
|
|
73
|
-
container: {
|
|
74
|
-
minWidth: 230,
|
|
75
|
-
borderRadius: 50,
|
|
76
|
-
backgroundColor: colors.teal,
|
|
77
|
-
marginBottom: 32,
|
|
78
|
-
justifyContent: `center`,
|
|
79
|
-
alignSelf: `center`,
|
|
80
|
-
},
|
|
81
|
-
textContainer: {
|
|
82
|
-
flexDirection: `row`,
|
|
83
|
-
justifyContent: `center`,
|
|
84
|
-
},
|
|
85
|
-
transferText: {
|
|
86
|
-
...FONTS.Poppins.bold_Base,
|
|
87
|
-
color: colors.black,
|
|
88
|
-
paddingVertical: 12,
|
|
89
|
-
paddingHorizontal: 16,
|
|
90
|
-
textAlign: `center`,
|
|
91
|
-
},
|
|
92
|
-
});
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { StyleSheet, View } from "react-native";
|
|
3
|
-
|
|
4
|
-
import { Activity as ActivitySettings, BolusCalculator } from "@hedia/types";
|
|
5
|
-
|
|
6
|
-
import { t } from "../../locales/translate";
|
|
7
|
-
import { Testing } from "../../types/enum";
|
|
8
|
-
import { IActivityDisplayProps } from "../../types/types";
|
|
9
|
-
import { colors } from "../../utils/Constants";
|
|
10
|
-
import { infoStyles } from "../InfoBars";
|
|
11
|
-
import { FONTS } from "../styles/fonts";
|
|
12
|
-
import Text from "../Text";
|
|
13
|
-
import ActivityIcon from "./ActivityIcon";
|
|
14
|
-
import ActivityIntensity from "./ActivityIntensity";
|
|
15
|
-
|
|
16
|
-
export interface IProps extends IActivityDisplayProps {
|
|
17
|
-
/** Details about the activity that affect the calculation */
|
|
18
|
-
activity: BolusCalculator.Types.IActivityParams;
|
|
19
|
-
/** The fraction (in the interval [0; 1]) by which the insulin recommendation is being reduced due to physical activity */
|
|
20
|
-
activityReduction: ActivitySettings.Types.ReductionType;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Component for displaying a summary of the entered physical activity along with the effect it has on the insulin recommendation.
|
|
25
|
-
*/
|
|
26
|
-
export default class Activity extends React.Component<IProps> {
|
|
27
|
-
/**
|
|
28
|
-
* Steps:
|
|
29
|
-
* 1. Unpack activity, activityType, activityReduction, and activityTitle from props.
|
|
30
|
-
* 2. Compute the reductionPercentage by multiplying the activityReduction prop by 100 and rounding to the nearest integer.
|
|
31
|
-
* 3. Generate and return the JSX element to display the following on the screen:
|
|
32
|
-
* - Print the activity duration.
|
|
33
|
-
* - Display the ActivityIcon that corresponds to the type of activity.
|
|
34
|
-
* - Display the ActivityIntensity for the activity.
|
|
35
|
-
* - Print the reductionPercentage.
|
|
36
|
-
* @returns JSX Element containing all the user's physical activity details
|
|
37
|
-
*/
|
|
38
|
-
public render(): JSX.Element {
|
|
39
|
-
const { activity, activityType, activityReduction, activityTitle } = this.props;
|
|
40
|
-
const reductionPercentage = ((activityReduction ?? 0) * 100).toFixed(0);
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<View style={styles.container}>
|
|
44
|
-
<View style={styles.activityTextContainer}>
|
|
45
|
-
<View style={infoStyles.labelContainer}>
|
|
46
|
-
<Text style={styles.label}>{t(`Activity`)}</Text>
|
|
47
|
-
</View>
|
|
48
|
-
<View style={infoStyles.valueUnitContainer}>
|
|
49
|
-
<Text style={infoStyles.value} testID={Testing.Id.ActivityTestIds.ActivityDuration}>
|
|
50
|
-
{activity.activityDuration}
|
|
51
|
-
</Text>
|
|
52
|
-
<Text style={infoStyles.units}>{t(`min`)}</Text>
|
|
53
|
-
</View>
|
|
54
|
-
</View>
|
|
55
|
-
<ActivityIcon activityType={activityType} activityTitle={activityTitle} />
|
|
56
|
-
<ActivityIntensity activityIntensity={activity.activityIntensity} />
|
|
57
|
-
<Text style={styles.infoText}>
|
|
58
|
-
{t(`Based on the selected activity your insulin recommendation is reduced by:`)}
|
|
59
|
-
</Text>
|
|
60
|
-
<View style={styles.reductionContainer}>
|
|
61
|
-
<Text style={styles.reductionPercentage} testID={Testing.Id.ActivityTestIds.ActivityReduction}>
|
|
62
|
-
{reductionPercentage}
|
|
63
|
-
</Text>
|
|
64
|
-
<Text style={styles.percentage}>{`%`}</Text>
|
|
65
|
-
</View>
|
|
66
|
-
</View>
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
const styles = StyleSheet.create({
|
|
71
|
-
container: {
|
|
72
|
-
flex: 1,
|
|
73
|
-
marginTop: 8,
|
|
74
|
-
padding: 16,
|
|
75
|
-
borderWidth: 1,
|
|
76
|
-
borderColor: colors.dustyDarkBlue,
|
|
77
|
-
borderRadius: 5,
|
|
78
|
-
},
|
|
79
|
-
activityTextContainer: {
|
|
80
|
-
flex: 1,
|
|
81
|
-
flexDirection: `row`,
|
|
82
|
-
marginBottom: 6,
|
|
83
|
-
alignItems: `center`,
|
|
84
|
-
},
|
|
85
|
-
infoText: {
|
|
86
|
-
...FONTS.Poppins.regular_Base,
|
|
87
|
-
color: colors.lightBlue,
|
|
88
|
-
marginBottom: 4,
|
|
89
|
-
},
|
|
90
|
-
reductionContainer: {
|
|
91
|
-
flexDirection: `row`,
|
|
92
|
-
alignItems: `baseline`,
|
|
93
|
-
},
|
|
94
|
-
reductionPercentage: {
|
|
95
|
-
...FONTS.Poppins.medium_2XL,
|
|
96
|
-
color: colors.white,
|
|
97
|
-
},
|
|
98
|
-
percentage: {
|
|
99
|
-
...FONTS.Poppins.regular_XS,
|
|
100
|
-
color: colors.white,
|
|
101
|
-
marginLeft: 4,
|
|
102
|
-
},
|
|
103
|
-
label: {
|
|
104
|
-
...FONTS.Poppins.regular_Base,
|
|
105
|
-
color: colors.white,
|
|
106
|
-
},
|
|
107
|
-
});
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { StyleSheet, View } from "react-native";
|
|
3
|
-
import { SvgProps } from "react-native-svg";
|
|
4
|
-
|
|
5
|
-
import { Activity } from "@hedia/types";
|
|
6
|
-
|
|
7
|
-
import Cycling from "../../assets/IconsSVG/activity/Cycling";
|
|
8
|
-
import Running from "../../assets/IconsSVG/activity/Running";
|
|
9
|
-
import Stretching from "../../assets/IconsSVG/activity/Stretching";
|
|
10
|
-
import Swimming from "../../assets/IconsSVG/activity/Swimming";
|
|
11
|
-
import Walking from "../../assets/IconsSVG/activity/Walking";
|
|
12
|
-
import { t } from "../../locales/translate";
|
|
13
|
-
import { IActivityDisplayProps } from "../../types/types";
|
|
14
|
-
import { colors } from "../../utils/Constants";
|
|
15
|
-
import { FONTS } from "../styles/fonts";
|
|
16
|
-
import Text from "../Text";
|
|
17
|
-
|
|
18
|
-
const { Other } = Activity.Enums.ActivityEnum;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
Component used to displat the user's physical activity type icon
|
|
22
|
-
Mapping from ActivityEnums to corresponding image resource.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
export default class ActivityIcon extends React.Component<IActivityDisplayProps> {
|
|
26
|
-
/**
|
|
27
|
-
* @returns The value from the ACTIVITY_ICONS constant that corresponds to the value of the activityType prop.
|
|
28
|
-
*/
|
|
29
|
-
public getActivityIcon = (props?: SvgProps): JSX.Element => {
|
|
30
|
-
const ACTIVITY_ICONS: Record<Activity.Enums.ActivityEnum, JSX.Element> = {
|
|
31
|
-
Run: Running(props),
|
|
32
|
-
Walk: Walking(props),
|
|
33
|
-
Cycling: Cycling(props),
|
|
34
|
-
Swim: Swimming(props),
|
|
35
|
-
Other: Stretching(props),
|
|
36
|
-
};
|
|
37
|
-
return ACTIVITY_ICONS[this.props.activityType ?? Other];
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Steps:
|
|
42
|
-
* 1. Unpack activityType and activityTitle from props.
|
|
43
|
-
* 2. Create a testID string by appending ‘_activity’ to the enum label corresponding to the activityType prop.
|
|
44
|
-
* @returns A JSX element including the following:
|
|
45
|
-
* 1. An svg component with the generated testID displaying the icon from getActivityIcon().
|
|
46
|
-
* 2. The activityTitle if it is truthy or the string “Untitled Activity” otherwise
|
|
47
|
-
*/
|
|
48
|
-
public render(): JSX.Element | null {
|
|
49
|
-
const { activityType, activityTitle } = this.props;
|
|
50
|
-
const testID = `${Activity.Enums.ActivityEnum[activityType ?? Other]}-icon`.toLowerCase();
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<View style={styles.container}>
|
|
54
|
-
{this.getActivityIcon({ testID, style: styles.icon })}
|
|
55
|
-
<Text style={styles.activityTitle}>{activityTitle || t(`Untitled Activity`)}</Text>
|
|
56
|
-
</View>
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const styles = StyleSheet.create({
|
|
62
|
-
container: {
|
|
63
|
-
flex: 1,
|
|
64
|
-
flexDirection: `row`,
|
|
65
|
-
alignItems: `center`,
|
|
66
|
-
marginBottom: 6,
|
|
67
|
-
},
|
|
68
|
-
activityTitle: {
|
|
69
|
-
...FONTS.Poppins.regular_SM,
|
|
70
|
-
color: colors.white,
|
|
71
|
-
marginLeft: 4,
|
|
72
|
-
},
|
|
73
|
-
icon: {
|
|
74
|
-
width: 20,
|
|
75
|
-
height: 20,
|
|
76
|
-
},
|
|
77
|
-
});
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { StyleSheet, View } from "react-native";
|
|
3
|
-
|
|
4
|
-
import { Activity, BolusCalculator } from "@hedia/types";
|
|
5
|
-
|
|
6
|
-
import {} from "../../types/types";
|
|
7
|
-
import { colors } from "../../utils/Constants";
|
|
8
|
-
import { ActivityIntensityTranslations } from "../../utils/Translations";
|
|
9
|
-
import { FONTS } from "../styles/fonts";
|
|
10
|
-
import Text from "../Text";
|
|
11
|
-
|
|
12
|
-
export interface IProps {
|
|
13
|
-
/** - Indicates the intensity of the activity. */
|
|
14
|
-
activityIntensity: BolusCalculator.Types.IActivityParams["activityIntensity"];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/** Component used to display the users's physical activity intensity on its corresponding background color */
|
|
18
|
-
export default class ActivityIntensity extends React.Component<IProps> {
|
|
19
|
-
/**
|
|
20
|
-
* Steps:
|
|
21
|
-
* 1. Set intensity to the activityIntensity prop.
|
|
22
|
-
* 2. Set the style variable to the style that correspond to the intensity.
|
|
23
|
-
* @returns JSX element that displays the intensity of the user’s activity along with the associated color coding
|
|
24
|
-
*/
|
|
25
|
-
public render = (): JSX.Element => {
|
|
26
|
-
const intensity = this.props.activityIntensity;
|
|
27
|
-
const style = activityIntensityStyles[intensity];
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<View style={activityIntensityStyles.row}>
|
|
31
|
-
<View style={[activityIntensityStyles.intensityTextContainer, style]}>
|
|
32
|
-
<Text style={activityIntensityStyles.text} testID={`intensity-${intensity}`}>
|
|
33
|
-
{ActivityIntensityTranslations[intensity]()}
|
|
34
|
-
</Text>
|
|
35
|
-
</View>
|
|
36
|
-
</View>
|
|
37
|
-
);
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const activityIntensityStyles = StyleSheet.create({
|
|
42
|
-
row: {
|
|
43
|
-
flexDirection: `row`,
|
|
44
|
-
marginBottom: 6,
|
|
45
|
-
minHeight: 24,
|
|
46
|
-
},
|
|
47
|
-
intensityTextContainer: {
|
|
48
|
-
alignItems: `center`,
|
|
49
|
-
justifyContent: `center`,
|
|
50
|
-
borderRadius: 5,
|
|
51
|
-
paddingVertical: 4,
|
|
52
|
-
paddingHorizontal: 17.5,
|
|
53
|
-
},
|
|
54
|
-
[Activity.Enums.ActivityIntensity.light]: {
|
|
55
|
-
backgroundColor: colors.activityGreen,
|
|
56
|
-
},
|
|
57
|
-
[Activity.Enums.ActivityIntensity.moderate]: {
|
|
58
|
-
backgroundColor: colors.activityOrange,
|
|
59
|
-
},
|
|
60
|
-
[Activity.Enums.ActivityIntensity.hard]: {
|
|
61
|
-
backgroundColor: colors.activityRed,
|
|
62
|
-
},
|
|
63
|
-
text: {
|
|
64
|
-
...FONTS.Poppins.medium_XS,
|
|
65
|
-
color: colors.black,
|
|
66
|
-
},
|
|
67
|
-
});
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { StyleSheet, View } from "react-native";
|
|
3
|
-
|
|
4
|
-
import { Logbook } from "@hedia/types";
|
|
5
|
-
|
|
6
|
-
import { t } from "../../locales/translate";
|
|
7
|
-
import { colors } from "../../utils/Constants";
|
|
8
|
-
import { FONTS } from "../styles/fonts";
|
|
9
|
-
import Text from "../Text";
|
|
10
|
-
import MoodIcon from "./MoodIcon";
|
|
11
|
-
|
|
12
|
-
const MoodEnum = Logbook.Enums.MoodEnum;
|
|
13
|
-
|
|
14
|
-
export interface IProps {
|
|
15
|
-
/** Indicates which mood if any that is currently selected. */
|
|
16
|
-
currentMood: Logbook.Enums.MoodEnum | null;
|
|
17
|
-
/**
|
|
18
|
-
* Callback function to call when the selected icon changes. Takes a single optional argument, mood, which is a {@link Logbook.Enums.MoodEnum} | null.
|
|
19
|
-
* Doesn’t have a return value.
|
|
20
|
-
* */
|
|
21
|
-
moodSelected(mood: Logbook.Enums.MoodEnum | null): void;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/** The Emotion component displays a horizontally arranged set of icons representing various moods and allows the user to select one. */
|
|
25
|
-
export default class Emotion extends React.Component<IProps> {
|
|
26
|
-
/**
|
|
27
|
-
* Handle what should happen when the user picks taps on one of the mood icons.
|
|
28
|
-
*
|
|
29
|
-
* Steps:
|
|
30
|
-
* 1. Call the moodSelected prop callback function with selected as argument if toggle is true and null as argument otherwise.
|
|
31
|
-
* @param selected Integer number that represents the icon that was tapped.
|
|
32
|
-
* @param toggle Boolean indicating whether the icon should be deselected.
|
|
33
|
-
*/
|
|
34
|
-
public handleIconPress = (selected: Logbook.Enums.MoodEnum, toggle: boolean): void => {
|
|
35
|
-
this.props.moodSelected(toggle ? selected : null);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Compose a sequence of MoodIcons
|
|
40
|
-
*
|
|
41
|
-
* Steps:
|
|
42
|
-
* 1. Make a sequence of MoodEnum values from the properties of the MoodEnum object and save the sequence as a variable named values.
|
|
43
|
-
* 2. Map each of the elements of the values sequence to a MoodIcon.
|
|
44
|
-
* @returns JSX Element consisting of an array of MoodIcon components.
|
|
45
|
-
*/
|
|
46
|
-
public mappedMoods = (): Array<JSX.Element> => {
|
|
47
|
-
const values = Object.values(MoodEnum).filter((val): boolean => isNaN(Number(val))) as Array<
|
|
48
|
-
keyof typeof MoodEnum
|
|
49
|
-
>;
|
|
50
|
-
|
|
51
|
-
return values.map((key): JSX.Element => {
|
|
52
|
-
const moodValue = MoodEnum[key];
|
|
53
|
-
return (
|
|
54
|
-
<MoodIcon
|
|
55
|
-
onPress={(toggle): void => this.handleIconPress(moodValue, toggle)}
|
|
56
|
-
active={moodValue === this.props.currentMood}
|
|
57
|
-
mood={moodValue}
|
|
58
|
-
key={moodValue}
|
|
59
|
-
/>
|
|
60
|
-
);
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* @returns JSX element to display the mood icons from mappedMoods() in a horizontal arrangement.
|
|
66
|
-
*/
|
|
67
|
-
public render(): JSX.Element {
|
|
68
|
-
return (
|
|
69
|
-
<View style={emotionStyles.container}>
|
|
70
|
-
<Text style={emotionStyles.feelingText} maxFontSizeMultiplier={1}>
|
|
71
|
-
{t(`How are you feeling?`)}
|
|
72
|
-
</Text>
|
|
73
|
-
<View style={emotionStyles.moodIconContainer}>{this.mappedMoods()}</View>
|
|
74
|
-
</View>
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const emotionStyles = StyleSheet.create({
|
|
80
|
-
container: {
|
|
81
|
-
flex: 1,
|
|
82
|
-
paddingHorizontal: 40,
|
|
83
|
-
marginBottom: 32,
|
|
84
|
-
},
|
|
85
|
-
feelingText: {
|
|
86
|
-
...FONTS.Poppins.regular_Base,
|
|
87
|
-
textAlign: `center`,
|
|
88
|
-
color: colors.white,
|
|
89
|
-
marginBottom: 8,
|
|
90
|
-
},
|
|
91
|
-
moodIconContainer: {
|
|
92
|
-
flex: 1,
|
|
93
|
-
flexDirection: `row`,
|
|
94
|
-
justifyContent: `center`,
|
|
95
|
-
paddingHorizontal: 40,
|
|
96
|
-
},
|
|
97
|
-
});
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { StyleSheet, TouchableOpacity } from "react-native";
|
|
3
|
-
|
|
4
|
-
import { Logbook } from "@hedia/types";
|
|
5
|
-
|
|
6
|
-
import Happy from "../../assets/IconsSVG/mood/Happy";
|
|
7
|
-
import Neutral from "../../assets/IconsSVG/mood/Neutral";
|
|
8
|
-
import Sad from "../../assets/IconsSVG/mood/Sad";
|
|
9
|
-
import SemiHappy from "../../assets/IconsSVG/mood/SemiHappy";
|
|
10
|
-
import SemiSad from "../../assets/IconsSVG/mood/SemiSad";
|
|
11
|
-
|
|
12
|
-
const MoodEnum = Logbook.Enums.MoodEnum;
|
|
13
|
-
|
|
14
|
-
export interface IProps {
|
|
15
|
-
/** Which mood the mood component should represent. */
|
|
16
|
-
mood: Logbook.Enums.MoodEnum;
|
|
17
|
-
/** Boolean indicating whether the mood component represents the currently active mood. */
|
|
18
|
-
active: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Callback function to be called when the mood icon is pressed.
|
|
21
|
-
* The function has no return value.
|
|
22
|
-
* @param toggle Boolean value to indicate whether the icon should be turned on (if true) or off (if false).
|
|
23
|
-
*/
|
|
24
|
-
onPress(toggle: boolean): void;
|
|
25
|
-
}
|
|
26
|
-
const styles = StyleSheet.create({
|
|
27
|
-
icon: {
|
|
28
|
-
flex: 1,
|
|
29
|
-
width: 40,
|
|
30
|
-
height: 40,
|
|
31
|
-
marginHorizontal: 6,
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
/** Mapping from {@link Logbook.Enums.MoodEnum} to corresponding image resources */
|
|
36
|
-
export const MOODS_INACTIVE: Record<number, JSX.Element> = {
|
|
37
|
-
1: Sad(false, { style: styles.icon }),
|
|
38
|
-
2: SemiSad(false, { style: styles.icon }),
|
|
39
|
-
3: Neutral(false, { style: styles.icon }),
|
|
40
|
-
4: SemiHappy(false, { style: styles.icon }),
|
|
41
|
-
5: Happy(false, { style: styles.icon }),
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
/** Mapping from {@link Logbook.Enums.MoodEnum} to corresponding image resources */
|
|
45
|
-
export const MOODS_ACTIVE: Record<number, JSX.Element> = {
|
|
46
|
-
1: Sad(true, { style: styles.icon }),
|
|
47
|
-
2: SemiSad(true, { style: styles.icon }),
|
|
48
|
-
3: Neutral(true, { style: styles.icon }),
|
|
49
|
-
4: SemiHappy(true, { style: styles.icon }),
|
|
50
|
-
5: Happy(true, { style: styles.icon }),
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
/** Component to display a mood icon base on its props. */
|
|
54
|
-
export default class MoodIcon extends React.Component<IProps> {
|
|
55
|
-
/**
|
|
56
|
-
* Get the icon image resource that should be displayed for the mood icon.
|
|
57
|
-
*
|
|
58
|
-
* Steps:
|
|
59
|
-
* 1. If the active prop is true, return the value from the MOODS_ACTIVE constant that corresponds to the value of the mood prop.
|
|
60
|
-
* 2. (Only reached if the active prop is false) Return the value from the MOODS_INACTIVE constant that corresponds to the value of the mood prop.
|
|
61
|
-
* @returns Image resource that should be displayed for the mood icon.
|
|
62
|
-
*/
|
|
63
|
-
public getMoodIcon = (): JSX.Element => {
|
|
64
|
-
if (this.props.active) {
|
|
65
|
-
return MOODS_ACTIVE[this.props.mood];
|
|
66
|
-
}
|
|
67
|
-
return MOODS_INACTIVE[this.props.mood];
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Handle what happens when the mood icon is pressed.
|
|
72
|
-
*
|
|
73
|
-
* Steps:
|
|
74
|
-
* 1. Call the onPress prop callback function with the toggle argument set to the inverse value of the active prop.
|
|
75
|
-
*/
|
|
76
|
-
public handleOnPress = (): void => {
|
|
77
|
-
this.props.onPress(!this.props.active);
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
/** JSX element to display the mood icon retrieved using the getMoodIcon() method. */
|
|
81
|
-
public render(): JSX.Element {
|
|
82
|
-
const { mood, active } = this.props;
|
|
83
|
-
const testID = `${MoodEnum[mood]}-${active}`;
|
|
84
|
-
|
|
85
|
-
return (
|
|
86
|
-
<TouchableOpacity onPress={this.handleOnPress} testID={testID}>
|
|
87
|
-
{this.getMoodIcon()}
|
|
88
|
-
</TouchableOpacity>
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
}
|