@hedia/recommendation-screen 2.2.0-alpha.44 → 2.2.0-alpha.5

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.
Files changed (181) hide show
  1. package/dist/index.js +0 -1
  2. package/dist/src/RecommendationScreen.d.ts +67 -64
  3. package/dist/src/RecommendationScreen.js +145 -157
  4. package/dist/src/assets/assets/activity/Cyclist.png +0 -0
  5. package/dist/src/assets/assets/activity/Other.png +0 -0
  6. package/dist/src/assets/assets/activity/Runner.png +0 -0
  7. package/dist/src/assets/assets/activity/Swimmer.png +0 -0
  8. package/dist/src/assets/assets/activity/Walk.png +0 -0
  9. package/dist/src/assets/assets/fonts/Poppins-Bold.ttf +0 -0
  10. package/dist/src/assets/assets/fonts/Poppins-SemiBold.ttf +0 -0
  11. package/dist/src/assets/assets/icons/Edit.tsx +22 -0
  12. package/dist/src/assets/assets/icons/X.tsx +14 -0
  13. package/dist/src/assets/assets/mood/happy.png +0 -0
  14. package/dist/src/assets/assets/mood/happy_active.png +0 -0
  15. package/dist/src/assets/assets/mood/neutral.png +0 -0
  16. package/dist/src/assets/assets/mood/neutral_active.png +0 -0
  17. package/dist/src/assets/assets/mood/sad.png +0 -0
  18. package/dist/src/assets/assets/mood/sad_active.png +0 -0
  19. package/dist/src/assets/assets/mood/semi_happy.png +0 -0
  20. package/dist/src/assets/assets/mood/semi_happy_active.png +0 -0
  21. package/dist/src/assets/assets/mood/semi_sad.png +0 -0
  22. package/dist/src/assets/assets/mood/semi_sad_active.png +0 -0
  23. package/dist/src/assets/icons/Edit.d.ts +4 -0
  24. package/dist/src/assets/icons/Edit.js +7 -0
  25. package/dist/src/assets/{IconsSVG/Edit.d.ts → icons/X.d.ts} +2 -2
  26. package/dist/src/assets/icons/X.js +6 -0
  27. package/dist/src/components/ForecastInfoBar.d.ts +109 -0
  28. package/dist/src/components/ForecastInfoBar.js +138 -0
  29. package/dist/src/components/Header.d.ts +8 -0
  30. package/dist/src/components/Header.js +54 -0
  31. package/dist/src/components/Icon.d.ts +20 -0
  32. package/dist/src/components/Icon.js +43 -0
  33. package/dist/src/components/InfoBars.d.ts +28 -13
  34. package/dist/src/components/InfoBars.js +63 -33
  35. package/dist/src/components/InvisibleNumberInput.d.ts +3 -8
  36. package/dist/src/components/InvisibleNumberInput.js +20 -22
  37. package/dist/src/components/LimitationMessage.d.ts +14 -0
  38. package/dist/src/components/LimitationMessage.js +30 -0
  39. package/dist/src/components/LineSeparator.d.ts +1 -5
  40. package/dist/src/components/LineSeparator.js +3 -2
  41. package/dist/src/components/RecentInsulin.d.ts +1 -2
  42. package/dist/src/components/RecentInsulin.js +40 -57
  43. package/dist/src/components/RecommendationModal.d.ts +63 -61
  44. package/dist/src/components/RecommendationModal.js +118 -133
  45. package/dist/src/components/RecommendedCarbs.d.ts +0 -2
  46. package/dist/src/components/RecommendedCarbs.js +99 -82
  47. package/dist/src/components/RecommendedInsulin.d.ts +1 -1
  48. package/dist/src/components/RecommendedInsulin.js +72 -56
  49. package/dist/src/components/Remeasure.d.ts +15 -5
  50. package/dist/src/components/Remeasure.js +77 -50
  51. package/dist/src/components/{TransferToLogbook.d.ts → SaveButton.d.ts} +2 -2
  52. package/dist/src/components/{TransferToLogbook.js → SaveButton.js} +30 -27
  53. package/dist/src/components/TwoOptionModal.d.ts +136 -0
  54. package/dist/src/components/TwoOptionModal.js +141 -0
  55. package/dist/src/components/activity/Activity.d.ts +2 -2
  56. package/dist/src/components/activity/Activity.js +49 -58
  57. package/dist/src/components/activity/ActivityIcon.d.ts +7 -7
  58. package/dist/src/components/activity/ActivityIcon.js +29 -37
  59. package/dist/src/components/activity/ActivityIntensity.d.ts +1 -1
  60. package/dist/src/components/activity/ActivityIntensity.js +23 -20
  61. package/dist/src/components/mood/Emotion.d.ts +1 -1
  62. package/dist/src/components/mood/Emotion.js +16 -21
  63. package/dist/src/components/mood/MoodIcon.d.ts +5 -4
  64. package/dist/src/components/mood/MoodIcon.js +23 -28
  65. package/dist/src/components/text/TextBold.d.ts +8 -0
  66. package/dist/src/components/text/TextBold.js +12 -0
  67. package/dist/src/components/text/TextRegular.d.ts +8 -0
  68. package/dist/src/components/text/TextRegular.js +12 -0
  69. package/dist/src/locale/da/messages.js +1 -0
  70. package/dist/src/locale/da/messages.po +353 -0
  71. package/dist/src/locale/de/messages.js +1 -0
  72. package/dist/src/locale/de/messages.po +353 -0
  73. package/dist/src/locale/en/messages.js +1 -0
  74. package/dist/src/locale/en/messages.po +353 -0
  75. package/dist/src/locale/es/messages.js +1 -0
  76. package/dist/src/locale/es/messages.po +353 -0
  77. package/dist/src/locale/fr/messages.js +1 -0
  78. package/dist/src/locale/fr/messages.po +353 -0
  79. package/dist/src/locale/i18nUtils.d.ts +18 -0
  80. package/dist/src/locale/i18nUtils.js +39 -0
  81. package/dist/src/locale/it/messages.js +1 -0
  82. package/dist/src/locale/it/messages.po +353 -0
  83. package/dist/src/types/enum.d.ts +15 -21
  84. package/dist/src/types/enum.js +18 -27
  85. package/dist/src/types/types.js +0 -1
  86. package/dist/src/utils/AttentionMessages.js +24 -29
  87. package/dist/src/utils/Constants.d.ts +3 -17
  88. package/dist/src/utils/Constants.js +1 -16
  89. package/dist/src/utils/RecommendationError.js +24 -26
  90. package/dist/src/utils/RecommendationUtils.js +2 -5
  91. package/dist/src/utils/Translations.js +5 -5
  92. package/dist/src/utils/Utils.d.ts +1 -1
  93. package/dist/src/utils/Utils.js +0 -1
  94. package/dist/src/utils/Validations.d.ts +1 -1
  95. package/dist/src/utils/Validations.js +2 -3
  96. package/package.json +99 -89
  97. package/dist/index.js.map +0 -1
  98. package/dist/src/RecommendationScreen.js.map +0 -1
  99. package/dist/src/assets/IconsSVG/Close.d.ts +0 -4
  100. package/dist/src/assets/IconsSVG/Close.js +0 -7
  101. package/dist/src/assets/IconsSVG/Close.js.map +0 -1
  102. package/dist/src/assets/IconsSVG/CloseOutlined.d.ts +0 -4
  103. package/dist/src/assets/IconsSVG/CloseOutlined.js +0 -9
  104. package/dist/src/assets/IconsSVG/CloseOutlined.js.map +0 -1
  105. package/dist/src/assets/IconsSVG/Edit.js +0 -8
  106. package/dist/src/assets/IconsSVG/Edit.js.map +0 -1
  107. package/dist/src/assets/IconsSVG/activity/Cycling.d.ts +0 -4
  108. package/dist/src/assets/IconsSVG/activity/Cycling.js +0 -12
  109. package/dist/src/assets/IconsSVG/activity/Cycling.js.map +0 -1
  110. package/dist/src/assets/IconsSVG/activity/Running.d.ts +0 -4
  111. package/dist/src/assets/IconsSVG/activity/Running.js +0 -10
  112. package/dist/src/assets/IconsSVG/activity/Running.js.map +0 -1
  113. package/dist/src/assets/IconsSVG/activity/Stretching.d.ts +0 -4
  114. package/dist/src/assets/IconsSVG/activity/Stretching.js +0 -10
  115. package/dist/src/assets/IconsSVG/activity/Stretching.js.map +0 -1
  116. package/dist/src/assets/IconsSVG/activity/Swimming.d.ts +0 -4
  117. package/dist/src/assets/IconsSVG/activity/Swimming.js +0 -13
  118. package/dist/src/assets/IconsSVG/activity/Swimming.js.map +0 -1
  119. package/dist/src/assets/IconsSVG/activity/Walking.d.ts +0 -4
  120. package/dist/src/assets/IconsSVG/activity/Walking.js +0 -11
  121. package/dist/src/assets/IconsSVG/activity/Walking.js.map +0 -1
  122. package/dist/src/assets/IconsSVG/mood/Happy.d.ts +0 -4
  123. package/dist/src/assets/IconsSVG/mood/Happy.js +0 -11
  124. package/dist/src/assets/IconsSVG/mood/Happy.js.map +0 -1
  125. package/dist/src/assets/IconsSVG/mood/Neutral.d.ts +0 -4
  126. package/dist/src/assets/IconsSVG/mood/Neutral.js +0 -11
  127. package/dist/src/assets/IconsSVG/mood/Neutral.js.map +0 -1
  128. package/dist/src/assets/IconsSVG/mood/Sad.d.ts +0 -4
  129. package/dist/src/assets/IconsSVG/mood/Sad.js +0 -11
  130. package/dist/src/assets/IconsSVG/mood/Sad.js.map +0 -1
  131. package/dist/src/assets/IconsSVG/mood/SemiHappy.d.ts +0 -4
  132. package/dist/src/assets/IconsSVG/mood/SemiHappy.js +0 -11
  133. package/dist/src/assets/IconsSVG/mood/SemiHappy.js.map +0 -1
  134. package/dist/src/assets/IconsSVG/mood/SemiSad.d.ts +0 -4
  135. package/dist/src/assets/IconsSVG/mood/SemiSad.js +0 -11
  136. package/dist/src/assets/IconsSVG/mood/SemiSad.js.map +0 -1
  137. package/dist/src/components/ExitModal.d.ts +0 -25
  138. package/dist/src/components/ExitModal.js +0 -91
  139. package/dist/src/components/ExitModal.js.map +0 -1
  140. package/dist/src/components/InfoBars.js.map +0 -1
  141. package/dist/src/components/InvisibleNumberInput.js.map +0 -1
  142. package/dist/src/components/LineSeparator.js.map +0 -1
  143. package/dist/src/components/RecentInsulin.js.map +0 -1
  144. package/dist/src/components/RecommendationModal.js.map +0 -1
  145. package/dist/src/components/RecommendedCarbs.js.map +0 -1
  146. package/dist/src/components/RecommendedInsulin.js.map +0 -1
  147. package/dist/src/components/Remeasure.js.map +0 -1
  148. package/dist/src/components/Text.d.ts +0 -13
  149. package/dist/src/components/Text.js +0 -14
  150. package/dist/src/components/Text.js.map +0 -1
  151. package/dist/src/components/TimeoutModal.d.ts +0 -24
  152. package/dist/src/components/TimeoutModal.js +0 -84
  153. package/dist/src/components/TimeoutModal.js.map +0 -1
  154. package/dist/src/components/TransferToLogbook.js.map +0 -1
  155. package/dist/src/components/activity/Activity.js.map +0 -1
  156. package/dist/src/components/activity/ActivityIcon.js.map +0 -1
  157. package/dist/src/components/activity/ActivityIntensity.js.map +0 -1
  158. package/dist/src/components/mood/Emotion.js.map +0 -1
  159. package/dist/src/components/mood/MoodIcon.js.map +0 -1
  160. package/dist/src/components/styles/fonts.d.ts +0 -143
  161. package/dist/src/components/styles/fonts.js +0 -145
  162. package/dist/src/components/styles/fonts.js.map +0 -1
  163. package/dist/src/locales/da/translations.json +0 -82
  164. package/dist/src/locales/de/translations.json +0 -81
  165. package/dist/src/locales/en/translations.json +0 -84
  166. package/dist/src/locales/es/translations.json +0 -81
  167. package/dist/src/locales/fr/translations.json +0 -81
  168. package/dist/src/locales/it/translations.json +0 -81
  169. package/dist/src/locales/translate.d.ts +0 -19
  170. package/dist/src/locales/translate.js +0 -53
  171. package/dist/src/locales/translate.js.map +0 -1
  172. package/dist/src/types/enum.js.map +0 -1
  173. package/dist/src/types/types.js.map +0 -1
  174. package/dist/src/utils/AttentionMessages.js.map +0 -1
  175. package/dist/src/utils/Constants.js.map +0 -1
  176. package/dist/src/utils/RecommendationError.js.map +0 -1
  177. package/dist/src/utils/RecommendationUtils.js.map +0 -1
  178. package/dist/src/utils/Translations.js.map +0 -1
  179. package/dist/src/utils/Utils.js.map +0 -1
  180. package/dist/src/utils/Validations.js.map +0 -1
  181. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -1,11 +1,13 @@
1
+ import { t } from "@lingui/macro";
1
2
  import * as React from "react";
2
- import { SafeAreaView, ScrollView, StatusBar, StyleSheet, TouchableOpacity, View } from "react-native";
3
+ import { Dimensions, StyleSheet, TouchableOpacity, View } from "react-native";
3
4
  import ReactNativeModal from "react-native-modal";
4
- import { t } from "../locales/translate";
5
+ import { i18n } from "../locale/i18nUtils";
5
6
  import { Testing } from "../types/enum";
6
7
  import { colors } from "../utils/Constants";
7
- import { FONTS } from "./styles/fonts";
8
- import Text from "./Text";
8
+ import LimitationMessage from "./LimitationMessage";
9
+ import TextBold from "./text/TextBold";
10
+ import TextRegular from "./text/TextRegular";
9
11
  const { RecommendationModalTestIds } = Testing.Id;
10
12
  /**
11
13
  * Popup modal for displaying information messages or warnings to the user if necessary.
@@ -28,15 +30,6 @@ export default class RecommendationModal extends React.Component {
28
30
  firstPageVisible: !!this.props.limitationMessage,
29
31
  };
30
32
  }
31
- /*
32
- * Steps:
33
- * 1. Set the firstPageVisible state variable true if the limitationMessage prop was updated.
34
- */
35
- componentDidUpdate(prevProps) {
36
- if (prevProps.limitationMessage !== this.props.limitationMessage) {
37
- this.setState({ firstPageVisible: !!this.props.limitationMessage });
38
- }
39
- }
40
33
  /**
41
34
  * Handle what happens when the “next” button is pressed.
42
35
  *
@@ -47,8 +40,8 @@ export default class RecommendationModal extends React.Component {
47
40
  */
48
41
  onPressNextButton = () => {
49
42
  const { attentionMessage, suggestedCarbohydrates } = this.props;
50
- const isSecondPageVisible = !!attentionMessage || !!suggestedCarbohydrates;
51
- return isSecondPageVisible ? this.setState({ firstPageVisible: false }) : this.props.onClickOkButton();
43
+ const isPageVisible = !!attentionMessage || !!suggestedCarbohydrates;
44
+ return isPageVisible ? this.setState({ firstPageVisible: false }) : this.props.onClickOkButton();
52
45
  };
53
46
  /**
54
47
  * @returns Return an JSX element for composing two buttons: one for accepting a suggestion and one for rejecting it.
@@ -57,11 +50,11 @@ export default class RecommendationModal extends React.Component {
57
50
  */
58
51
  recommendationButtons = () => {
59
52
  return (<View style={stylesModal.recommendationButtonsContainer}>
60
- <TouchableOpacity testID={RecommendationModalTestIds.AcceptCarbs} style={[stylesModal.button, { marginRight: 12 }]} onPress={this.props.onAcceptCarbohydrates}>
61
- <Text style={stylesModal.carbsButtonText}>{t(`OK`)}</Text>
53
+ <TouchableOpacity testID={RecommendationModalTestIds.AcceptCarbs} style={stylesModal.affirmativeCarbsButton} onPress={this.props.onAcceptCarbohydrates}>
54
+ <TextRegular style={stylesModal.affirmativeCarbsText}>{i18n._(t `OK`)}</TextRegular>
62
55
  </TouchableOpacity>
63
- <TouchableOpacity testID={RecommendationModalTestIds.DeclineCarbs} style={[stylesModal.button, { marginLeft: 12 }]} onPress={this.props.onDeclineCarbohydrates}>
64
- <Text style={stylesModal.carbsButtonText}>{t(`NO`)}</Text>
56
+ <TouchableOpacity testID={RecommendationModalTestIds.DeclineCarbs} style={stylesModal.negativeCarbsButton} onPress={this.props.onDeclineCarbohydrates}>
57
+ <TextRegular style={stylesModal.negativeCarbsText}>{i18n._(t `NO`)}</TextRegular>
65
58
  </TouchableOpacity>
66
59
  </View>);
67
60
  };
@@ -74,19 +67,33 @@ export default class RecommendationModal extends React.Component {
74
67
  const displayCarbs = Math.round(suggestedCarbohydrates);
75
68
  return (<React.Fragment>
76
69
  <View style={stylesModal.innerView}>
77
- <Text style={stylesModal.recommendEatingText}>{t(`We recommend eating an additional:`)}</Text>
78
- <Text style={stylesModal.textCenter}>
79
- <Text style={stylesModal.suggestedCarbs} testID={RecommendationModalTestIds.SuggestedCarbs}>
80
- {`${displayCarbs} `}
81
- </Text>
82
- <Text style={stylesModal.carbohydrateText}>{t(`grams of carbohydrates`)}</Text>
83
- </Text>
84
- <Text style={stylesModal.recommendEatingText}>{t(`Instead of taking insulin`)}</Text>
70
+ <View style={stylesModal.recommendationRow}>
71
+ <TextRegular style={stylesModal.recommendEatingText}>
72
+ {i18n._(t `We recommend eating an additional:`)}
73
+ </TextRegular>
74
+ </View>
75
+ <View style={stylesModal.suggestedContainer}>
76
+ <TextRegular style={stylesModal.textCenter}>
77
+ <TextBold style={stylesModal.suggestedCarbs} testID={RecommendationModalTestIds.SuggestedCarbs}>
78
+ {`${displayCarbs} `}
79
+ </TextBold>
80
+ <TextRegular style={stylesModal.carbohydrateText}>
81
+ {i18n._(t `grams of carbohydrates`)}
82
+ </TextRegular>
83
+ </TextRegular>
84
+ </View>
85
+ <View style={stylesModal.recommendationRow}>
86
+ <TextRegular style={stylesModal.recommendEatingText}>
87
+ {i18n._(t `Instead of taking insulin`)}
88
+ </TextRegular>
89
+ </View>
90
+ </View>
91
+ <View style={stylesModal.addToCalculationContainer}>
92
+ <TextRegular style={stylesModal.addToCalculation}>
93
+ {i18n._(t `Would you like to add this to your current calculation?`)}
94
+ </TextRegular>
95
+ {this.recommendationButtons()}
85
96
  </View>
86
- <Text style={stylesModal.addToCalculation}>
87
- {t(`Would you like to add this to your current calculation?`)}
88
- </Text>
89
- {this.recommendationButtons()}
90
97
  </React.Fragment>);
91
98
  };
92
99
  /**
@@ -95,16 +102,20 @@ export default class RecommendationModal extends React.Component {
95
102
  secondPage = () => {
96
103
  const { attentionMessage, suggestedCarbohydrates } = this.props;
97
104
  const willRecommendCarbs = suggestedCarbohydrates !== null && suggestedCarbohydrates > 0;
98
- return (<>
105
+ return (<React.Fragment>
99
106
  <View style={stylesModal.container}>
100
- <Text style={stylesModal.textTittleMessage}>{t(`Attention`)}</Text>
101
- {attentionMessage && <Text style={stylesModal.textMessage}>{attentionMessage}</Text>}
102
- {willRecommendCarbs && this.recommendCarbohydrates(suggestedCarbohydrates)}
107
+ <View style={stylesModal.titleContainer}>
108
+ <TextBold style={stylesModal.textTittleMessage}>{i18n._(t `Attention`)}</TextBold>
109
+ </View>
110
+ <TextRegular style={stylesModal.textMessage}>{attentionMessage}</TextRegular>
111
+ {willRecommendCarbs ? this.recommendCarbohydrates(suggestedCarbohydrates) : null}
103
112
  </View>
104
- {!willRecommendCarbs && (<TouchableOpacity testID={RecommendationModalTestIds.OkButton} style={stylesModal.okButton} onPress={this.props.onClickOkButton}>
105
- <Text style={stylesModal.buttonText}>{t(`OK`)}</Text>
106
- </TouchableOpacity>)}
107
- </>);
113
+ {willRecommendCarbs ? null : (<View style={stylesModal.containerAcceptButton}>
114
+ <TouchableOpacity testID={RecommendationModalTestIds.OkButton} style={stylesModal.okButton} onPress={this.props.onClickOkButton}>
115
+ <TextRegular style={stylesModal.buttonText}>{i18n._(t `OK`)}</TextRegular>
116
+ </TouchableOpacity>
117
+ </View>)}
118
+ </React.Fragment>);
108
119
  };
109
120
  /**
110
121
  * @returns JSX element for displaying the “first” page of the recommendation modal.
@@ -112,13 +123,7 @@ export default class RecommendationModal extends React.Component {
112
123
  */
113
124
  firstPage = () => {
114
125
  const { limitationMessage } = this.props;
115
- return (<React.Fragment>
116
- <Text style={stylesModal.textTittleMessage}>{t(`Attention`)}</Text>
117
- <Text style={stylesModal.textMessage}>{limitationMessage}</Text>
118
- <TouchableOpacity testID={Testing.Id.RecommendationModalTestIds.LimitationOkButton} style={stylesModal.okButton} onPress={this.props.onlyShowLimitationMessage ? this.props.onClickOkButton : this.onPressNextButton}>
119
- <Text style={stylesModal.buttonText}>{t(`OK`)}</Text>
120
- </TouchableOpacity>
121
- </React.Fragment>);
126
+ return <LimitationMessage limitationMessage={limitationMessage} onPressNextButton={this.onPressNextButton}/>;
122
127
  };
123
128
  /**
124
129
  * @returns JSX element for rendering a modal that is visible if the isVisible prop is true.
@@ -128,114 +133,94 @@ export default class RecommendationModal extends React.Component {
128
133
  render() {
129
134
  const { isVisible } = this.props;
130
135
  const { firstPageVisible } = this.state;
131
- return (<ReactNativeModal isVisible={isVisible} style={stylesModal.modalStyle} backdropColor={colors.darkBlue} backdropOpacity={1} animationIn={`fadeIn`} animationOut={`fadeOut`}>
132
- <StatusBar backgroundColor={colors.transparentLightBlue}/>
133
- <SafeAreaView style={stylesModal.safe}>
134
- <ScrollView contentContainerStyle={stylesModal.scrollViewContainer}>
135
- {firstPageVisible ? this.firstPage() : this.secondPage()}
136
- </ScrollView>
137
- </SafeAreaView>
136
+ return (<ReactNativeModal isVisible={isVisible} style={stylesModal.modalStyle}>
137
+ {firstPageVisible ? this.firstPage() : this.secondPage()}
138
138
  </ReactNativeModal>);
139
139
  }
140
140
  }
141
+ const { height, width } = Dimensions.get(`screen`);
142
+ const buttonHeight = height / 20;
143
+ const buttonWidth = width / 2.5;
144
+ const buttonFontSize = width / 22;
145
+ const buttonBorderRadius = height / 30;
146
+ const buttonBorderWidth = height / 500;
147
+ const sugestionFontSize = width / 19;
148
+ const recommendEatingFontSize = height / 45;
149
+ const textFontSize = width / 20;
150
+ const titleFontSize = width / 13;
141
151
  /** @internal */
142
152
  export const stylesModal = StyleSheet.create({
143
- safe: {
144
- backgroundColor: colors.darkBlue,
145
- },
146
153
  modalStyle: {
147
154
  margin: 0,
148
- },
149
- scrollViewContainer: {
150
- flexGrow: 1,
151
- justifyContent: `center`,
155
+ backgroundColor: colors.darkBlue,
152
156
  },
153
157
  container: {
158
+ flex: 4,
154
159
  justifyContent: `center`,
160
+ paddingHorizontal: `4%`,
155
161
  },
156
- textTittleMessage: {
157
- ...FONTS.Poppins.bold_3XL,
158
- color: colors.white,
159
- textAlign: `center`,
160
- },
161
- textMessage: {
162
- ...FONTS.Poppins.regular_Base,
163
- color: colors.white,
164
- textAlign: `center`,
165
- marginHorizontal: 30,
166
- marginTop: 8,
167
- },
168
- buttonText: {
169
- ...FONTS.Poppins.bold_Base,
170
- color: colors.white,
171
- textAlign: `center`,
172
- paddingHorizontal: 16,
173
- paddingVertical: 12,
162
+ containerAcceptButton: {
163
+ flex: 1,
164
+ justifyContent: `flex-start`,
174
165
  },
166
+ titleContainer: { marginBottom: `5%` },
167
+ recommendationRow: { justifyContent: `center`, alignContent: `center`, marginBottom: `3%` },
168
+ textTittleMessage: { color: `white`, fontSize: titleFontSize, textAlign: `center` },
169
+ textMessage: { color: `white`, fontSize: textFontSize, textAlign: `center` },
170
+ buttonText: { color: colors.teal, fontSize: buttonFontSize, textAlign: `center` },
171
+ addToCalculationContainer: { justifyContent: `flex-start`, marginVertical: `5%` },
175
172
  innerView: {
176
173
  alignContent: `center`,
177
- borderRadius: 8,
178
- backgroundColor: colors.purple,
179
- paddingVertical: 24,
180
- marginHorizontal: 30,
181
- marginTop: 24,
182
- marginBottom: 36,
183
- },
184
- suggestedCarbs: {
185
- ...FONTS.Poppins.bold_XL,
186
- color: colors.white,
187
- },
188
- textCenter: {
189
- ...FONTS.Poppins.regular_Base,
190
- textAlign: `center`,
191
- paddingHorizontal: 26.5,
192
- },
174
+ paddingVertical: `5%`,
175
+ paddingHorizontal: `3%`,
176
+ marginTop: `5%`,
177
+ borderRadius: height / 80,
178
+ borderWidth: height / 300,
179
+ borderColor: colors.teal,
180
+ },
181
+ suggestedContainer: { justifyContent: `center`, flexDirection: `row`, marginBottom: `3%` },
182
+ suggestedCarbs: { color: `white`, fontSize: sugestionFontSize },
183
+ textCenter: { textAlign: `center` },
193
184
  recommendEatingText: {
194
- ...FONTS.Poppins.regular_Base,
195
- color: colors.white,
196
- textAlign: `center`,
197
- paddingHorizontal: 15,
198
- marginBottom: 8,
199
- },
200
- carbohydrateText: {
201
- ...FONTS.Poppins.bold_Base,
202
- color: colors.white,
203
- },
204
- addToCalculation: {
205
- ...FONTS.Poppins.regular_Base,
206
- color: colors.white,
185
+ color: colors.dustyBlue,
186
+ fontSize: recommendEatingFontSize,
207
187
  textAlign: `center`,
208
- marginBottom: 16,
209
- marginHorizontal: 50,
210
188
  },
211
- recommendationButtonsContainer: {
189
+ carbohydrateText: { color: `white`, fontSize: sugestionFontSize },
190
+ addToCalculation: { color: `white`, fontSize: textFontSize, textAlign: `center` },
191
+ recommendationButtonsContainer: { justifyContent: `center`, flexDirection: `row`, margin: `3%` },
192
+ affirmativeCarbsText: { color: colors.teal, fontSize: buttonFontSize, textAlign: `center` },
193
+ negativeCarbsText: { color: `white`, fontSize: buttonFontSize, textAlign: `center` },
194
+ affirmativeCarbsButton: {
195
+ marginTop: `2%`,
196
+ borderRadius: buttonBorderRadius,
197
+ borderWidth: buttonBorderWidth,
198
+ borderColor: colors.teal,
199
+ width: buttonWidth,
200
+ height: buttonHeight,
201
+ alignSelf: `center`,
212
202
  justifyContent: `center`,
213
- flexDirection: `row`,
214
- paddingHorizontal: 47,
215
- },
216
- carbsButtonText: {
217
- ...FONTS.Poppins.bold_Base,
218
- color: colors.white,
219
- textAlign: `center`,
220
- paddingHorizontal: 16,
221
- paddingVertical: 12,
222
- },
223
- button: {
224
- borderRadius: 50,
225
- borderWidth: 1,
226
- borderColor: colors.white,
203
+ marginRight: `2%`,
204
+ },
205
+ negativeCarbsButton: {
206
+ marginTop: `2%`,
207
+ borderRadius: buttonBorderRadius,
208
+ borderWidth: buttonBorderWidth,
209
+ borderColor: `white`,
210
+ width: buttonWidth,
211
+ height: buttonHeight,
227
212
  alignSelf: `center`,
228
- minWidth: 127,
213
+ justifyContent: `center`,
214
+ marginLeft: `2%`,
229
215
  },
230
216
  okButton: {
231
- backgroundColor: colors.darkBlue,
232
- justifyContent: `flex-start`,
233
- marginTop: 24,
234
- borderRadius: 50,
235
- borderWidth: 1,
236
- borderColor: colors.white,
217
+ marginTop: `6%`,
218
+ borderRadius: buttonBorderRadius,
219
+ borderWidth: buttonBorderWidth,
220
+ borderColor: colors.teal,
221
+ width: buttonWidth,
222
+ height: buttonHeight,
237
223
  alignSelf: `center`,
238
- minWidth: 127,
224
+ justifyContent: `center`,
239
225
  },
240
226
  });
241
- //# sourceMappingURL=RecommendationModal.js.map
@@ -1,6 +1,5 @@
1
1
  import React from "react";
2
2
  import { Testing } from "../types/enum";
3
- declare const RecommendedCarbsTestIds: typeof Testing.Id.RecommendedCarbsTestIds;
4
3
  export interface ICalculationRow {
5
4
  label: string;
6
5
  value: string;
@@ -93,4 +92,3 @@ export default class RecommendedCarbs extends React.Component<IProps, IState> {
93
92
  */
94
93
  render(): JSX.Element;
95
94
  }
96
- export {};
@@ -1,15 +1,17 @@
1
+ import { t } from "@lingui/macro";
1
2
  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";
3
+ import { Alert, Dimensions, StyleSheet, TouchableOpacity, View } from "react-native";
4
+ import EditIcon from "../assets/icons/Edit";
5
+ import { i18n } from "../locale/i18nUtils";
6
6
  import { Testing } from "../types/enum";
7
7
  import { colors } from "../utils/Constants";
8
8
  import { CarbohydrateLimitError } from "../utils/RecommendationError";
9
+ import Icon from "./Icon";
10
+ import { infoStyles } from "./InfoBars";
9
11
  import InvisibleNumberInput from "./InvisibleNumberInput";
10
12
  import LineSeparator from "./LineSeparator";
11
- import { FONTS } from "./styles/fonts";
12
- import Text from "./Text";
13
+ import TextBold from "./text/TextBold";
14
+ import TextRegular from "./text/TextRegular";
13
15
  const { RecommendedCarbsTestIds } = Testing.Id;
14
16
  /**
15
17
  * The contents of the RecommendedCarbs component may vary quite a bit depending on data that was entered by the user
@@ -63,7 +65,11 @@ export default class RecommendedCarbs extends React.Component {
63
65
  if (carbs >= 0) {
64
66
  if (carbs > 300) {
65
67
  this.setState({ partialInput: this.props.recommendedCarbs });
66
- return Alert.alert(t(`Attention`), CarbohydrateLimitError().message, [{ text: t(`OK`) }]);
68
+ return Alert.alert(i18n._(t `Attention`), CarbohydrateLimitError().message, [
69
+ {
70
+ text: i18n._(t `OK`),
71
+ },
72
+ ]);
67
73
  }
68
74
  this.props.changedRecommendedCarbs(carbs);
69
75
  }
@@ -84,38 +90,46 @@ export default class RecommendedCarbs extends React.Component {
84
90
  renderRecommendedCarbs = () => {
85
91
  const shownCarbs = this.state.partialInput ?? Math.round(Number(this.props.recommendedCarbs));
86
92
  const totalCarbs = Math.round(parseFloat(this.props.enteredCarbs) + Number(shownCarbs));
87
- return (<React.Fragment>
88
- <LineSeparator borderBottomColor={colors.dustyDarkBlue} marginBottom={8} marginTop={16}/>
89
- <View style={[style.container, { marginBottom: 4 }]}>
90
- <View style={style.recommendedContainer}>
91
- <TouchableOpacity testID={RecommendedCarbsTestIds.RemoveRecommendation} style={style.removeRecommended} onPress={this.props.removeRecommendedCarbs}>
92
- {CloseOutlined({ style: style.removeRecommendedIcon })}
93
+ return (<>
94
+ <LineSeparator color={colors.fadeBlue}/>
95
+ <View style={calculationStyles.borderContainer}>
96
+ <View style={calculationStyles.recommendedContainer}>
97
+ <TouchableOpacity testID={RecommendedCarbsTestIds.RemoveRecommendation} style={calculationStyles.removeRecommended} onPress={this.props.removeRecommendedCarbs}>
98
+ <Icon iconIdentifier={`Ionicons/ios-close-circle-outline`} style={calculationStyles.removeRecommendedIcon}/>
93
99
  </TouchableOpacity>
94
- <Text style={style.recommendedLabel}>{t(`Recommended`)}</Text>
100
+ <TextBold style={calculationStyles.recommendedLabel}>{i18n._(t `Recommended`)}</TextBold>
95
101
  </View>
96
102
  </View>
97
- <View style={style.container}>
98
- <View style={style.recommendedContainer}>
99
- <Text style={{ ...style.recommendedLabel, color: colors.teal }}>{t(`Additional`)}</Text>
103
+ <View style={calculationStyles.borderContainer}>
104
+ <View style={calculationStyles.recommendedContainer}>
105
+ <TextBold style={calculationStyles.recommendedLabel}>{i18n._(t `Additional`)}</TextBold>
100
106
  </View>
101
- <View style={style.valueUnitContainer}>
102
- <TouchableOpacity testID={RecommendedCarbsTestIds.EditRecommendedCarbs} onPress={this.showTextInput} style={[style.valueUnitContainer]}>
103
- <Text testID={RecommendedCarbsTestIds.RecommendedCarbs} style={{ ...style.value, color: colors.teal }}>
104
- {shownCarbs}
105
- </Text>
106
- {Edit({ color: colors.teal, style: style.editIcon })}
107
- <Text style={{ ...style.units, color: colors.teal }}>{t(`grams`)}</Text>
107
+ <View style={calculationStyles.valueUnitContainer}>
108
+ <TouchableOpacity testID={RecommendedCarbsTestIds.EditRecommendedCarbs} onPress={this.showTextInput} style={[calculationStyles.valueUnitContainer]}>
109
+ <View style={calculationStyles.valueContainer}>
110
+ <TextBold testID={RecommendedCarbsTestIds.RecommendedCarbs} style={{ ...calculationStyles.value, color: colors.teal }}>
111
+ {shownCarbs}
112
+ </TextBold>
113
+ </View>
114
+ <View style={[calculationStyles.unitContainer]}>
115
+ <View style={calculationStyles.editIconContainer}>
116
+ <EditIcon />
117
+ </View>
118
+ <TextRegular style={{ ...calculationStyles.units, color: colors.teal }}>
119
+ {i18n._(t `grams`)}
120
+ </TextRegular>
121
+ </View>
108
122
  </TouchableOpacity>
109
123
  </View>
110
124
  </View>
111
- <LineSeparator borderBottomColor={colors.dustyDarkBlue} marginBottom={16} marginTop={8}/>
125
+ <LineSeparator color={colors.fadeBlue}/>
112
126
  {this.renderRow({
113
- label: t(`Total`),
127
+ label: i18n._(t `Total`),
114
128
  value: totalCarbs.toString(),
115
- units: t(`grams`),
129
+ units: i18n._(t `grams`),
116
130
  }, RecommendedCarbsTestIds.TotalCarbs)}
117
131
  <InvisibleNumberInput testID={RecommendedCarbsTestIds.InvisibleCarbInput} negativeAllowed={false} cleanPartialInput={true} decimalPlaces={0} visible={(callback) => (this.callbackInput = callback)} partialInput={this.handlePartialInput} onEnd={this.handleChangedCarbs} startValue={this.props.recommendedCarbs} maxLength={3}/>
118
- </React.Fragment>);
132
+ </>);
119
133
  };
120
134
  /**
121
135
  * Display a row of information for the user. Specifically used to display the amount of carbohydrates that the user has entered.
@@ -124,15 +138,19 @@ export default class RecommendedCarbs extends React.Component {
124
138
  * @returns A JSX element to display 3 strings on the screen: label, value, and a unit.
125
139
  */
126
140
  renderRow = (row, testID) => {
127
- return (<View style={style.container}>
128
- <View style={style.rowContainer}>
129
- <Text style={style.rowLabel}>{row.label}</Text>
141
+ return (<View style={calculationStyles.borderContainer}>
142
+ <View style={calculationStyles.rowContainer}>
143
+ <TextBold style={calculationStyles.rowLabel}>{row.label}</TextBold>
130
144
  </View>
131
- <View style={style.valueUnitContainer}>
132
- <Text testID={testID} style={style.value}>
133
- {row.value}
134
- </Text>
135
- <Text style={style.units}>{row.units}</Text>
145
+ <View style={calculationStyles.valueUnitContainer}>
146
+ <View style={calculationStyles.valueContainer}>
147
+ <TextBold testID={testID} style={calculationStyles.value}>
148
+ {row.value}
149
+ </TextBold>
150
+ </View>
151
+ <View style={calculationStyles.unitContainer}>
152
+ <TextRegular style={calculationStyles.units}>{row.units}</TextRegular>
153
+ </View>
136
154
  </View>
137
155
  </View>);
138
156
  };
@@ -144,91 +162,90 @@ export default class RecommendedCarbs extends React.Component {
144
162
  */
145
163
  render() {
146
164
  const carbs = Number(this.props.recommendedCarbs);
147
- return (<React.Fragment>
148
- <View style={style.foodTitleContainer}>
149
- <Text style={style.label}>{t(`Food`)}</Text>
150
- <Text style={style.foodUnitsLabel}>{`(${t(`Carbohydrates`)})`}</Text>
165
+ return (<>
166
+ <View style={calculationStyles.foodTitleContainer}>
167
+ <TextBold style={infoStyles.label}>{i18n._(t `Food`)}</TextBold>
168
+ <TextRegular style={calculationStyles.foodUnitsLabel}>
169
+ {`(${i18n._(t `Carbohydrates`)})`}
170
+ </TextRegular>
151
171
  </View>
152
172
  {this.renderRow({
153
- label: t(`Entered`),
173
+ label: i18n._(t `Entered`),
154
174
  value: this.props.enteredCarbs,
155
- units: t(`grams`),
175
+ units: i18n._(t `grams`),
156
176
  }, RecommendedCarbsTestIds.EnteredCarbs)}
157
177
  {!isNaN(carbs) && carbs > 0 ? this.renderRecommendedCarbs() : null}
158
- </React.Fragment>);
178
+ </>);
159
179
  }
160
180
  }
161
- const style = StyleSheet.create({
162
- container: {
163
- flexDirection: `row`,
181
+ const { width } = Dimensions.get(`screen`);
182
+ const calculationStyles = StyleSheet.create({
183
+ borderContainer: {
184
+ ...infoStyles.borderContainer,
164
185
  alignItems: `center`,
165
186
  },
166
187
  foodTitleContainer: {
167
- flexDirection: `row`,
188
+ flex: infoStyles.borderContainer.flex,
189
+ flexDirection: infoStyles.borderContainer.flexDirection,
190
+ paddingHorizontal: infoStyles.borderContainer.paddingHorizontal,
168
191
  alignItems: `center`,
169
- marginBottom: 4,
192
+ paddingVertical: `2%`,
170
193
  },
171
194
  foodUnitsLabel: {
172
- ...FONTS.Poppins.regular_XS,
173
- textAlign: `left`,
174
- paddingLeft: 4,
175
- color: colors.lightBlue,
195
+ ...infoStyles.units,
196
+ color: colors.fadeBlue,
197
+ paddingLeft: `1%`,
176
198
  },
177
199
  rowContainer: {
178
200
  flex: 7,
179
201
  },
180
202
  rowLabel: {
181
- ...FONTS.Poppins.regular_Base,
182
- color: colors.white,
203
+ color: `white`,
204
+ fontSize: width / 25,
183
205
  },
184
206
  enteredContainer: {
185
207
  flex: 3,
186
208
  alignItems: `flex-end`,
187
209
  },
210
+ entered: {
211
+ color: `white`,
212
+ fontSize: width / 23,
213
+ },
188
214
  valueUnitContainer: {
189
- flex: 6.5,
190
- justifyContent: `flex-end`,
191
- alignItems: `baseline`,
192
- flexDirection: `row`,
215
+ ...infoStyles.valueUnitContainer,
216
+ },
217
+ valueContainer: {
218
+ ...infoStyles.valueContainer,
193
219
  },
194
220
  value: {
195
- ...FONTS.Poppins.medium_2XL,
196
- color: colors.white,
197
- textAlign: `right`,
221
+ ...infoStyles.value,
222
+ },
223
+ unitContainer: {
224
+ ...infoStyles.unitContainer,
198
225
  },
199
226
  units: {
200
- ...FONTS.Poppins.regular_XS,
201
- color: colors.white,
202
- textAlign: `left`,
203
- paddingLeft: 4,
227
+ ...infoStyles.units,
228
+ },
229
+ editIconContainer: {
230
+ paddingLeft: `20%`,
204
231
  },
205
232
  recommendedContainer: {
206
233
  flex: 7,
207
234
  flexDirection: `row`,
208
235
  },
209
236
  recommendedLabel: {
210
- ...FONTS.Poppins.regular_Base,
211
237
  color: colors.teal,
238
+ fontSize: width / 25,
239
+ alignSelf: `center`,
212
240
  },
213
241
  removeRecommended: {
214
242
  justifyContent: `center`,
215
- alignItems: `center`,
243
+ marginRight: `1%`,
244
+ marginTop: `1%`,
216
245
  },
217
246
  removeRecommendedIcon: {
218
- height: 20,
219
- width: 20,
220
- marginRight: 4,
221
- },
222
- editIcon: {
223
- height: 16,
224
- width: 16,
225
- right: 0,
226
- top: -8,
227
- position: `absolute`,
228
- },
229
- label: {
230
- ...FONTS.Poppins.regular_Base,
231
- color: colors.white,
247
+ color: colors.teal,
248
+ fontSize: width / 20,
249
+ paddingBottom: `0.5%`,
232
250
  },
233
251
  });
234
- //# sourceMappingURL=RecommendedCarbs.js.map
@@ -1,5 +1,5 @@
1
- import React from "react";
2
1
  import { UserSettings } from "@hedia/types";
2
+ import React from "react";
3
3
  export interface IProps {
4
4
  /** The amount of insulin in units to display to the user as a recommendation. */
5
5
  insulinRecommendation: number;