@hedia/recommendation-screen 2.1.52 → 2.1.53-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.
Files changed (86) hide show
  1. package/dist/src/RecommendationScreen.d.ts +3 -0
  2. package/dist/src/RecommendationScreen.js +39 -33
  3. package/dist/src/assets/IconsSVG/Close.d.ts +4 -0
  4. package/dist/src/assets/IconsSVG/Close.js +6 -0
  5. package/dist/src/assets/IconsSVG/Edit.d.ts +4 -0
  6. package/dist/src/assets/IconsSVG/Edit.js +7 -0
  7. package/dist/src/assets/IconsSVG/activity/Cycling.d.ts +4 -0
  8. package/dist/src/assets/IconsSVG/activity/Cycling.js +11 -0
  9. package/dist/src/assets/IconsSVG/activity/Running.d.ts +4 -0
  10. package/dist/src/assets/IconsSVG/activity/Running.js +9 -0
  11. package/dist/src/assets/IconsSVG/activity/Stretching.d.ts +4 -0
  12. package/dist/src/assets/IconsSVG/activity/Stretching.js +9 -0
  13. package/dist/src/assets/IconsSVG/activity/Swimming.d.ts +4 -0
  14. package/dist/src/assets/IconsSVG/activity/Swimming.js +12 -0
  15. package/dist/src/assets/IconsSVG/activity/Walking.d.ts +4 -0
  16. package/dist/src/assets/IconsSVG/activity/Walking.js +10 -0
  17. package/dist/src/assets/assets/IconsSVG/Close.tsx +13 -0
  18. package/dist/src/assets/assets/IconsSVG/Edit.tsx +16 -0
  19. package/dist/src/assets/assets/IconsSVG/activity/Cycling.tsx +40 -0
  20. package/dist/src/assets/assets/IconsSVG/activity/Running.tsx +28 -0
  21. package/dist/src/assets/assets/IconsSVG/activity/Stretching.tsx +28 -0
  22. package/dist/src/assets/assets/IconsSVG/activity/Swimming.tsx +46 -0
  23. package/dist/src/assets/assets/IconsSVG/activity/Walking.tsx +34 -0
  24. package/dist/src/components/ExitModal.d.ts +22 -0
  25. package/dist/src/components/ExitModal.js +89 -0
  26. package/dist/src/components/InfoBars.d.ts +4 -26
  27. package/dist/src/components/InfoBars.js +23 -53
  28. package/dist/src/components/LimitationMessage.js +6 -12
  29. package/dist/src/components/LineSeparator.d.ts +5 -1
  30. package/dist/src/components/LineSeparator.js +1 -3
  31. package/dist/src/components/RecentInsulin.d.ts +2 -1
  32. package/dist/src/components/RecentInsulin.js +38 -38
  33. package/dist/src/components/RecommendationModal.d.ts +24 -59
  34. package/dist/src/components/RecommendationModal.js +58 -95
  35. package/dist/src/components/RecommendedCarbs.js +67 -78
  36. package/dist/src/components/RecommendedInsulin.js +37 -59
  37. package/dist/src/components/Remeasure.js +28 -46
  38. package/dist/src/components/TimeoutModal.d.ts +20 -0
  39. package/dist/src/components/TimeoutModal.js +82 -0
  40. package/dist/src/components/TransferToLogbook.js +13 -12
  41. package/dist/src/components/activity/Activity.js +36 -40
  42. package/dist/src/components/activity/ActivityIcon.d.ts +7 -7
  43. package/dist/src/components/activity/ActivityIcon.js +30 -22
  44. package/dist/src/components/activity/ActivityIntensity.js +10 -17
  45. package/dist/src/components/mood/Emotion.js +6 -8
  46. package/dist/src/components/mood/MoodIcon.js +3 -9
  47. package/dist/src/components/styles/fonts.d.ts +9 -1
  48. package/dist/src/components/styles/fonts.js +8 -0
  49. package/dist/src/locale/da/messages.js +1 -1
  50. package/dist/src/locale/da/messages.po +2 -2
  51. package/dist/src/locale/de/messages.js +1 -1
  52. package/dist/src/locale/de/messages.po +2 -2
  53. package/dist/src/locale/en/messages.js +1 -1
  54. package/dist/src/locale/en/messages.po +2 -2
  55. package/dist/src/locale/es/messages.js +1 -1
  56. package/dist/src/locale/es/messages.po +2 -2
  57. package/dist/src/locale/fr/messages.js +1 -1
  58. package/dist/src/locale/fr/messages.po +2 -2
  59. package/dist/src/locale/it/messages.js +1 -1
  60. package/dist/src/locale/it/messages.po +2 -2
  61. package/dist/src/types/enum.d.ts +7 -2
  62. package/dist/src/types/enum.js +12 -6
  63. package/dist/src/utils/Constants.d.ts +1 -0
  64. package/dist/src/utils/Constants.js +1 -0
  65. package/package.json +2 -2
  66. package/dist/src/assets/activity/Cyclist.png +0 -0
  67. package/dist/src/assets/activity/Other.png +0 -0
  68. package/dist/src/assets/activity/Runner.png +0 -0
  69. package/dist/src/assets/activity/Swimmer.png +0 -0
  70. package/dist/src/assets/activity/Walk.png +0 -0
  71. package/dist/src/components/Header.d.ts +0 -10
  72. package/dist/src/components/Header.js +0 -76
  73. package/dist/src/components/Icon.d.ts +0 -20
  74. package/dist/src/components/Icon.js +0 -43
  75. package/dist/src/components/TwoOptionModal.d.ts +0 -147
  76. package/dist/src/components/TwoOptionModal.js +0 -140
  77. /package/dist/src/assets/{mood → assets/mood}/happy.png +0 -0
  78. /package/dist/src/assets/{mood → assets/mood}/happy_active.png +0 -0
  79. /package/dist/src/assets/{mood → assets/mood}/neutral.png +0 -0
  80. /package/dist/src/assets/{mood → assets/mood}/neutral_active.png +0 -0
  81. /package/dist/src/assets/{mood → assets/mood}/sad.png +0 -0
  82. /package/dist/src/assets/{mood → assets/mood}/sad_active.png +0 -0
  83. /package/dist/src/assets/{mood → assets/mood}/semi_happy.png +0 -0
  84. /package/dist/src/assets/{mood → assets/mood}/semi_happy_active.png +0 -0
  85. /package/dist/src/assets/{mood → assets/mood}/semi_sad.png +0 -0
  86. /package/dist/src/assets/{mood → assets/mood}/semi_sad_active.png +0 -0
@@ -1,6 +1,6 @@
1
1
  import { t } from "@lingui/macro";
2
2
  import * as React from "react";
3
- import { Dimensions, ScrollView, StyleSheet, TouchableOpacity, View } from "react-native";
3
+ import { ScrollView, StyleSheet, TouchableOpacity, View } from "react-native";
4
4
  import ReactNativeModal from "react-native-modal";
5
5
  import { i18n } from "../locale/i18nUtils";
6
6
  import { Testing } from "../types/enum";
@@ -50,11 +50,11 @@ export default class RecommendationModal extends React.Component {
50
50
  */
51
51
  recommendationButtons = () => {
52
52
  return (<View style={stylesModal.recommendationButtonsContainer}>
53
- <TouchableOpacity testID={RecommendationModalTestIds.AcceptCarbs} style={stylesModal.affirmativeCarbsButton} onPress={this.props.onAcceptCarbohydrates}>
54
- <Text style={stylesModal.affirmativeCarbsText}>{i18n._(t `OK`)}</Text>
53
+ <TouchableOpacity testID={RecommendationModalTestIds.AcceptCarbs} style={[stylesModal.button, { marginRight: 12 }]} onPress={this.props.onAcceptCarbohydrates}>
54
+ <Text style={stylesModal.carbsButtonText}>{i18n._(t `OK`)}</Text>
55
55
  </TouchableOpacity>
56
- <TouchableOpacity testID={RecommendationModalTestIds.DeclineCarbs} style={stylesModal.negativeCarbsButton} onPress={this.props.onDeclineCarbohydrates}>
57
- <Text style={stylesModal.negativeCarbsText}>{i18n._(t `NO`)}</Text>
56
+ <TouchableOpacity testID={RecommendationModalTestIds.DeclineCarbs} style={[stylesModal.button, { marginLeft: 12 }]} onPress={this.props.onDeclineCarbohydrates}>
57
+ <Text style={stylesModal.carbsButtonText}>{i18n._(t `NO`)}</Text>
58
58
  </TouchableOpacity>
59
59
  </View>);
60
60
  };
@@ -67,29 +67,19 @@ export default class RecommendationModal extends React.Component {
67
67
  const displayCarbs = Math.round(suggestedCarbohydrates);
68
68
  return (<React.Fragment>
69
69
  <View style={stylesModal.innerView}>
70
- <View style={stylesModal.recommendationRow}>
71
- <Text style={stylesModal.recommendEatingText}>
72
- {i18n._(t `We recommend eating an additional:`)}
70
+ <Text style={stylesModal.recommendEatingText}>{i18n._(t `We recommend eating an additional:`)}</Text>
71
+ <Text style={stylesModal.textCenter}>
72
+ <Text style={stylesModal.suggestedCarbs} testID={RecommendationModalTestIds.SuggestedCarbs}>
73
+ {`${displayCarbs} `}
73
74
  </Text>
74
- </View>
75
- <View style={stylesModal.suggestedContainer}>
76
- <Text style={stylesModal.textCenter}>
77
- <Text style={stylesModal.suggestedCarbs} testID={RecommendationModalTestIds.SuggestedCarbs}>
78
- {`${displayCarbs} `}
79
- </Text>
80
- <Text style={stylesModal.carbohydrateText}>{i18n._(t `grams of carbohydrates`)}</Text>
81
- </Text>
82
- </View>
83
- <View style={stylesModal.recommendationRow}>
84
- <Text style={stylesModal.recommendEatingText}>{i18n._(t `Instead of taking insulin`)}</Text>
85
- </View>
86
- </View>
87
- <View style={stylesModal.addToCalculationContainer}>
88
- <Text style={stylesModal.addToCalculation}>
89
- {i18n._(t `Would you like to add this to your current calculation?`)}
75
+ <Text style={stylesModal.carbohydrateText}>{i18n._(t `grams of carbohydrates`)}</Text>
90
76
  </Text>
91
- {this.recommendationButtons()}
77
+ <Text style={stylesModal.recommendEatingText}>{i18n._(t `Instead of taking insulin`)}</Text>
92
78
  </View>
79
+ <Text style={stylesModal.addToCalculation}>
80
+ {i18n._(t `Would you like to add this to your current calculation?`)}
81
+ </Text>
82
+ {this.recommendationButtons()}
93
83
  </React.Fragment>);
94
84
  };
95
85
  /**
@@ -98,20 +88,16 @@ export default class RecommendationModal extends React.Component {
98
88
  secondPage = () => {
99
89
  const { attentionMessage, suggestedCarbohydrates } = this.props;
100
90
  const willRecommendCarbs = suggestedCarbohydrates !== null && suggestedCarbohydrates > 0;
101
- return (<View style={{ flex: 1 }}>
91
+ return (<>
102
92
  <View style={stylesModal.container}>
103
- <View style={stylesModal.titleContainer}>
104
- <Text style={stylesModal.textTittleMessage}>{i18n._(t `Attention`)}</Text>
105
- </View>
106
- <Text style={stylesModal.textMessage}>{attentionMessage}</Text>
107
- {willRecommendCarbs ? this.recommendCarbohydrates(suggestedCarbohydrates) : null}
93
+ <Text style={stylesModal.textTittleMessage}>{i18n._(t `Attention`)}</Text>
94
+ {attentionMessage && <Text style={stylesModal.textMessage}>{attentionMessage}</Text>}
95
+ {willRecommendCarbs && this.recommendCarbohydrates(suggestedCarbohydrates)}
108
96
  </View>
109
- {willRecommendCarbs ? null : (<View style={stylesModal.containerAcceptButton}>
110
- <TouchableOpacity testID={RecommendationModalTestIds.OkButton} style={stylesModal.okButton} onPress={this.props.onClickOkButton}>
111
- <Text style={stylesModal.buttonText}>{i18n._(t `OK`)}</Text>
112
- </TouchableOpacity>
113
- </View>)}
114
- </View>);
97
+ {!willRecommendCarbs && (<TouchableOpacity testID={RecommendationModalTestIds.OkButton} style={stylesModal.okButton} onPress={this.props.onClickOkButton}>
98
+ <Text style={stylesModal.buttonText}>{i18n._(t `OK`)}</Text>
99
+ </TouchableOpacity>)}
100
+ </>);
115
101
  };
116
102
  /**
117
103
  * @returns JSX element for displaying the “first” page of the recommendation modal.
@@ -136,30 +122,19 @@ export default class RecommendationModal extends React.Component {
136
122
  </ReactNativeModal>);
137
123
  }
138
124
  }
139
- const { height, width } = Dimensions.get(`screen`);
140
- const buttonHeight = height / 20;
141
- const buttonWidth = width / 2.5;
142
- const buttonBorderRadius = height / 30;
143
- const buttonBorderWidth = height / 500;
144
125
  /** @internal */
145
126
  export const stylesModal = StyleSheet.create({
146
- modalStyle: { margin: 0 },
127
+ modalStyle: {
128
+ margin: 0,
129
+ },
147
130
  scrollViewContainer: {
148
131
  flexGrow: 1,
132
+ justifyContent: `center`,
149
133
  },
150
134
  container: {
151
- flex: 4,
152
135
  backgroundColor: colors.semiDarkBlue,
153
136
  justifyContent: `center`,
154
- paddingHorizontal: `4%`,
155
137
  },
156
- containerAcceptButton: {
157
- flex: 1,
158
- backgroundColor: colors.semiDarkBlue,
159
- justifyContent: `flex-start`,
160
- },
161
- titleContainer: { marginBottom: `5%` },
162
- recommendationRow: { justifyContent: `center`, alignContent: `center`, marginBottom: `3%` },
163
138
  textTittleMessage: {
164
139
  ...FONTS.Poppins.bold_3XL,
165
140
  color: colors.white,
@@ -169,23 +144,25 @@ export const stylesModal = StyleSheet.create({
169
144
  ...FONTS.Poppins.regular_Base,
170
145
  color: colors.white,
171
146
  textAlign: `center`,
147
+ marginHorizontal: 30,
148
+ marginTop: 8,
172
149
  },
173
150
  buttonText: {
174
151
  ...FONTS.Poppins.bold_Base,
175
- color: colors.teal,
152
+ color: colors.white,
176
153
  textAlign: `center`,
154
+ paddingHorizontal: 16,
155
+ paddingVertical: 12,
177
156
  },
178
- addToCalculationContainer: { justifyContent: `flex-start`, marginVertical: `5%` },
179
157
  innerView: {
180
158
  alignContent: `center`,
181
- paddingVertical: `5%`,
182
- paddingHorizontal: `3%`,
183
- marginTop: `5%`,
184
- borderRadius: height / 80,
185
- borderWidth: height / 300,
186
- borderColor: colors.teal,
159
+ borderRadius: 8,
160
+ backgroundColor: colors.purple,
161
+ paddingVertical: 24,
162
+ marginHorizontal: 30,
163
+ marginTop: 24,
164
+ marginBottom: 36,
187
165
  },
188
- suggestedContainer: { justifyContent: `center`, flexDirection: `row`, marginBottom: `3%` },
189
166
  suggestedCarbs: {
190
167
  ...FONTS.Poppins.bold_XL,
191
168
  color: colors.white,
@@ -193,11 +170,14 @@ export const stylesModal = StyleSheet.create({
193
170
  textCenter: {
194
171
  ...FONTS.Poppins.regular_Base,
195
172
  textAlign: `center`,
173
+ paddingHorizontal: 26.5,
196
174
  },
197
175
  recommendEatingText: {
198
176
  ...FONTS.Poppins.regular_Base,
199
- color: colors.dustyBlue,
177
+ color: colors.white,
200
178
  textAlign: `center`,
179
+ paddingHorizontal: 15,
180
+ marginBottom: 8,
201
181
  },
202
182
  carbohydrateText: {
203
183
  ...FONTS.Poppins.bold_Base,
@@ -207,52 +187,35 @@ export const stylesModal = StyleSheet.create({
207
187
  ...FONTS.Poppins.regular_Base,
208
188
  color: colors.white,
209
189
  textAlign: `center`,
190
+ marginBottom: 16,
191
+ marginHorizontal: 50,
210
192
  },
211
193
  recommendationButtonsContainer: {
212
194
  justifyContent: `center`,
213
195
  flexDirection: `row`,
214
- margin: `3%`,
196
+ paddingHorizontal: 47,
215
197
  },
216
- affirmativeCarbsText: {
217
- ...FONTS.Poppins.bold_Base,
218
- color: colors.teal,
219
- textAlign: `center`,
220
- },
221
- negativeCarbsText: {
198
+ carbsButtonText: {
222
199
  ...FONTS.Poppins.bold_Base,
223
200
  color: colors.white,
224
201
  textAlign: `center`,
202
+ paddingHorizontal: 16,
203
+ paddingVertical: 12,
225
204
  },
226
- affirmativeCarbsButton: {
227
- marginTop: `2%`,
228
- borderRadius: buttonBorderRadius,
229
- borderWidth: buttonBorderWidth,
230
- borderColor: colors.teal,
231
- width: buttonWidth,
232
- height: buttonHeight,
233
- alignSelf: `center`,
234
- justifyContent: `center`,
235
- marginRight: `2%`,
236
- },
237
- negativeCarbsButton: {
238
- marginTop: `2%`,
239
- borderRadius: buttonBorderRadius,
240
- borderWidth: buttonBorderWidth,
205
+ button: {
206
+ borderRadius: 50,
207
+ borderWidth: 1,
241
208
  borderColor: colors.white,
242
- width: buttonWidth,
243
- height: buttonHeight,
244
209
  alignSelf: `center`,
245
- justifyContent: `center`,
246
- marginLeft: `2%`,
210
+ minWidth: 127,
247
211
  },
248
212
  okButton: {
249
- marginTop: `6%`,
250
- borderRadius: buttonBorderRadius,
251
- borderWidth: buttonBorderWidth,
252
- borderColor: colors.teal,
253
- width: buttonWidth,
254
- height: buttonHeight,
213
+ backgroundColor: colors.semiDarkBlue,
214
+ justifyContent: `flex-start`,
215
+ borderRadius: 50,
216
+ borderWidth: 1,
217
+ borderColor: colors.white,
255
218
  alignSelf: `center`,
256
- justifyContent: `center`,
219
+ minWidth: 127,
257
220
  },
258
221
  });
@@ -1,15 +1,15 @@
1
1
  import { t } from "@lingui/macro";
2
2
  import React from "react";
3
3
  import { Alert, StyleSheet, TouchableOpacity, View } from "react-native";
4
+ import Close from "../assets/IconsSVG/Close";
5
+ import Edit from "../assets/IconsSVG/Edit";
4
6
  import { i18n } from "../locale/i18nUtils";
5
7
  import { Testing } from "../types/enum";
6
8
  import { colors } from "../utils/Constants";
7
9
  import { CarbohydrateLimitError } from "../utils/RecommendationError";
8
- import Icon from "./Icon";
9
- import { infoStyles } from "./InfoBars";
10
10
  import InvisibleNumberInput from "./InvisibleNumberInput";
11
11
  import LineSeparator from "./LineSeparator";
12
- import { FONTS, ICONS } from "./styles/fonts";
12
+ import { FONTS } from "./styles/fonts";
13
13
  import Text from "./Text";
14
14
  const { RecommendedCarbsTestIds } = Testing.Id;
15
15
  /**
@@ -90,38 +90,30 @@ export default class RecommendedCarbs extends React.Component {
90
90
  const shownCarbs = this.state.partialInput ?? Math.round(Number(this.props.recommendedCarbs));
91
91
  const totalCarbs = Math.round(parseFloat(this.props.enteredCarbs) + Number(shownCarbs));
92
92
  return (<React.Fragment>
93
- <LineSeparator color={colors.mistBlue}/>
94
- <View style={calculationStyles.borderContainer}>
95
- <View style={calculationStyles.recommendedContainer}>
96
- <TouchableOpacity testID={RecommendedCarbsTestIds.RemoveRecommendation} style={calculationStyles.removeRecommended} onPress={this.props.removeRecommendedCarbs}>
97
- <Icon iconIdentifier={`Ionicons/ios-close-circle-outline`} style={calculationStyles.removeRecommendedIcon}/>
93
+ <LineSeparator borderBottomColor={colors.dustyDarkBlue} marginBottom={8} marginTop={16}/>
94
+ <View style={[style.container, { marginBottom: 4 }]}>
95
+ <View style={style.recommendedContainer}>
96
+ <TouchableOpacity testID={RecommendedCarbsTestIds.RemoveRecommendation} style={style.removeRecommended} onPress={this.props.removeRecommendedCarbs}>
97
+ {Close({ color: colors.teal, style: style.removeRecommendedIcon })}
98
98
  </TouchableOpacity>
99
- <Text style={calculationStyles.recommendedLabel}>{i18n._(t `Recommended`)}</Text>
99
+ <Text style={style.recommendedLabel}>{i18n._(t `Recommended`)}</Text>
100
100
  </View>
101
101
  </View>
102
- <View style={calculationStyles.borderContainer}>
103
- <View style={calculationStyles.recommendedContainer}>
104
- <Text style={calculationStyles.recommendedLabel}>{i18n._(t `Additional`)}</Text>
102
+ <View style={style.container}>
103
+ <View style={style.recommendedContainer}>
104
+ <Text style={{ ...style.recommendedLabel, color: colors.white }}>{i18n._(t `Additional`)}</Text>
105
105
  </View>
106
- <View style={calculationStyles.valueUnitContainer}>
107
- <TouchableOpacity testID={RecommendedCarbsTestIds.EditRecommendedCarbs} onPress={this.showTextInput} style={[calculationStyles.valueUnitContainer]}>
108
- <View style={calculationStyles.valueContainer}>
109
- <Text testID={RecommendedCarbsTestIds.RecommendedCarbs} style={{ ...calculationStyles.value, color: colors.teal }}>
110
- {shownCarbs}
111
- </Text>
112
- </View>
113
- <View style={[calculationStyles.unitContainer]}>
114
- <View style={calculationStyles.editIconContainer}>
115
- <Icon style={calculationStyles.editIcon} iconIdentifier={`Feather/edit`}/>
116
- </View>
117
- <Text style={{ ...calculationStyles.units, color: colors.teal }}>
118
- {i18n._(t `grams`)}
119
- </Text>
120
- </View>
106
+ <View style={style.valueUnitContainer}>
107
+ <TouchableOpacity testID={RecommendedCarbsTestIds.EditRecommendedCarbs} onPress={this.showTextInput} style={[style.valueUnitContainer]}>
108
+ <Text testID={RecommendedCarbsTestIds.RecommendedCarbs} style={{ ...style.value, color: colors.teal }}>
109
+ {shownCarbs}
110
+ </Text>
111
+ {Edit({ color: colors.teal, style: style.editIcon })}
112
+ <Text style={{ ...style.units, color: colors.teal }}>{i18n._(t `grams`)}</Text>
121
113
  </TouchableOpacity>
122
114
  </View>
123
115
  </View>
124
- <LineSeparator color={colors.teal}/>
116
+ <LineSeparator borderBottomColor={colors.dustyDarkBlue} marginBottom={16} marginTop={8}/>
125
117
  {this.renderRow({
126
118
  label: i18n._(t `Total`),
127
119
  value: totalCarbs.toString(),
@@ -137,19 +129,15 @@ export default class RecommendedCarbs extends React.Component {
137
129
  * @returns A JSX element to display 3 strings on the screen: label, value, and a unit.
138
130
  */
139
131
  renderRow = (row, testID) => {
140
- return (<View style={[calculationStyles.borderContainer, { paddingVertical: `1%` }]}>
141
- <View style={calculationStyles.rowContainer}>
142
- <Text style={calculationStyles.rowLabel}>{row.label}</Text>
132
+ return (<View style={style.container}>
133
+ <View style={style.rowContainer}>
134
+ <Text style={style.rowLabel}>{row.label}</Text>
143
135
  </View>
144
- <View style={calculationStyles.valueUnitContainer}>
145
- <View style={calculationStyles.valueContainer}>
146
- <Text testID={testID} style={calculationStyles.value}>
147
- {row.value}
148
- </Text>
149
- </View>
150
- <View style={calculationStyles.unitContainer}>
151
- <Text style={calculationStyles.units}>{row.units}</Text>
152
- </View>
136
+ <View style={style.valueUnitContainer}>
137
+ <Text testID={testID} style={style.value}>
138
+ {row.value}
139
+ </Text>
140
+ <Text style={style.units}>{row.units}</Text>
153
141
  </View>
154
142
  </View>);
155
143
  };
@@ -162,9 +150,9 @@ export default class RecommendedCarbs extends React.Component {
162
150
  render() {
163
151
  const carbs = Number(this.props.recommendedCarbs);
164
152
  return (<React.Fragment>
165
- <View style={calculationStyles.foodTitleContainer}>
166
- <Text style={infoStyles.label}>{i18n._(t `Food`)}</Text>
167
- <Text style={calculationStyles.foodUnitsLabel}>{`(${i18n._(t `Carbohydrates`)})`}</Text>
153
+ <View style={style.foodTitleContainer}>
154
+ <Text style={style.label}>{i18n._(t `Food`)}</Text>
155
+ <Text style={style.foodUnitsLabel}>{`(${i18n._(t `Carbohydrates`)})`}</Text>
168
156
  </View>
169
157
  {this.renderRow({
170
158
  label: i18n._(t `Entered`),
@@ -175,28 +163,27 @@ export default class RecommendedCarbs extends React.Component {
175
163
  </React.Fragment>);
176
164
  }
177
165
  }
178
- const calculationStyles = StyleSheet.create({
179
- borderContainer: {
180
- ...infoStyles.borderContainer,
166
+ const style = StyleSheet.create({
167
+ container: {
168
+ flexDirection: `row`,
181
169
  alignItems: `center`,
182
170
  },
183
171
  foodTitleContainer: {
184
- flex: infoStyles.borderContainer.flex,
185
- flexDirection: infoStyles.borderContainer.flexDirection,
186
- paddingHorizontal: infoStyles.borderContainer.paddingHorizontal,
172
+ flexDirection: `row`,
187
173
  alignItems: `center`,
188
- paddingVertical: `2%`,
174
+ marginBottom: 4,
189
175
  },
190
176
  foodUnitsLabel: {
191
- ...infoStyles.units,
177
+ ...FONTS.Poppins.regular_XS,
178
+ textAlign: `left`,
179
+ paddingLeft: 4,
192
180
  color: colors.lightBlue,
193
- paddingLeft: `1%`,
194
181
  },
195
182
  rowContainer: {
196
183
  flex: 7,
197
184
  },
198
185
  rowLabel: {
199
- ...FONTS.Poppins.bold_Base,
186
+ ...FONTS.Poppins.regular_Base,
200
187
  color: colors.white,
201
188
  },
202
189
  enteredContainer: {
@@ -204,46 +191,48 @@ const calculationStyles = StyleSheet.create({
204
191
  alignItems: `flex-end`,
205
192
  },
206
193
  valueUnitContainer: {
207
- ...infoStyles.valueUnitContainer,
208
- },
209
- valueContainer: {
210
- ...infoStyles.valueContainer,
194
+ flex: 6.5,
195
+ justifyContent: `flex-end`,
196
+ alignItems: `center`,
197
+ flexDirection: `row`,
211
198
  },
212
199
  value: {
213
- ...infoStyles.value,
214
- },
215
- unitContainer: {
216
- ...infoStyles.unitContainer,
200
+ ...FONTS.Poppins.regular_LG,
201
+ color: colors.lightBlue,
202
+ textAlign: `right`,
217
203
  },
218
204
  units: {
219
- ...infoStyles.units,
220
- },
221
- editIconContainer: {
222
- justifyContent: `flex-end`,
223
- paddingRight: `20%`,
224
- flexDirection: `row`,
225
- },
226
- editIcon: {
227
- color: colors.teal,
228
- ...ICONS.XS,
205
+ ...FONTS.Poppins.regular_XS,
206
+ color: colors.lightBlue,
207
+ textAlign: `left`,
208
+ paddingLeft: 4,
229
209
  },
230
210
  recommendedContainer: {
231
211
  flex: 7,
232
212
  flexDirection: `row`,
233
213
  },
234
214
  recommendedLabel: {
235
- ...FONTS.Poppins.bold_Base,
215
+ ...FONTS.Poppins.regular_Base,
236
216
  color: colors.teal,
237
- alignSelf: `center`,
238
217
  },
239
218
  removeRecommended: {
240
219
  justifyContent: `center`,
241
- marginRight: `1%`,
242
- marginTop: `1%`,
220
+ alignItems: `center`,
243
221
  },
244
222
  removeRecommendedIcon: {
245
- ...ICONS.XL,
246
- color: colors.teal,
247
- paddingBottom: `0.5%`,
223
+ height: 20,
224
+ width: 20,
225
+ marginRight: 4,
226
+ },
227
+ editIcon: {
228
+ height: 16,
229
+ width: 16,
230
+ right: 0,
231
+ top: -8,
232
+ position: `absolute`,
233
+ },
234
+ label: {
235
+ ...FONTS.Poppins.regular_Base,
236
+ color: colors.white,
248
237
  },
249
238
  });
@@ -1,17 +1,14 @@
1
1
  import { BolusCalculator } from "@hedia/types";
2
2
  import { t } from "@lingui/macro";
3
3
  import React from "react";
4
- import { Alert, Dimensions, Platform, StyleSheet, TouchableOpacity, View } from "react-native";
5
- import LinearGradient from "react-native-linear-gradient";
4
+ import { Alert, StyleSheet, TouchableOpacity } from "react-native";
6
5
  import { i18n } from "../locale/i18nUtils";
7
6
  import { Testing } from "../types/enum";
8
7
  import { Messages } from "../utils/AttentionMessages";
9
8
  import { colors } from "../utils/Constants";
10
9
  import { Utils } from "../utils/Utils";
11
- import Icon from "./Icon";
12
- import { infoStyles } from "./InfoBars";
13
10
  import InvisibleNumberInput from "./InvisibleNumberInput";
14
- import { FONTS, ICONS } from "./styles/fonts";
11
+ import { FONTS } from "./styles/fonts";
15
12
  import Text from "./Text";
16
13
  const { RecommendedInsulinTestIds } = Testing.Id;
17
14
  const SAFETY_INSULIN_LIMIT = BolusCalculator.Constants.SAFETY_INSULIN_LIMIT;
@@ -103,74 +100,55 @@ export default class RecommendedInsulin extends React.Component {
103
100
  * and using an InvisibleNumberInput component to enable input when the insulin amount is tapped.
104
101
  */
105
102
  render = () => {
106
- const paddingBottom = Platform.OS === `ios` ? `3%` : `1%`;
107
103
  const shownInsulin = this.state.partialInput ?? this.props.insulinRecommendation ?? `0`;
104
+ const { EditRecommendedInsulin, ShownInsulinText, InvisibleInsulinInput } = RecommendedInsulinTestIds;
108
105
  return (<React.Fragment>
109
- <TouchableOpacity testID={RecommendedInsulinTestIds.EditRecommendedInsulin} onPress={this.handleOnPress}>
110
- <LinearGradient style={recommendedInsulinStyles.container} colors={[colors.purple, colors.blue]} useAngle={true} angle={135}>
111
- <View style={recommendedInsulinStyles.recommendedTextContainer}>
112
- <Text style={recommendedInsulinStyles.recommendedText}>
113
- {i18n._(t `Recommended amount of insulin`)}
114
- </Text>
115
- </View>
116
- <View style={[recommendedInsulinStyles.recommendedContainer, { paddingBottom }]}>
117
- <View style={recommendedInsulinStyles.valueContainer}>
118
- <Text style={recommendedInsulinStyles.value} testID={RecommendedInsulinTestIds.ShownInsulinText}>
119
- {shownInsulin}
120
- </Text>
121
- <Text style={recommendedInsulinStyles.units}>{i18n._(t `Units`)}</Text>
122
- </View>
123
- <Icon style={recommendedInsulinStyles.editIcon} iconIdentifier={`Feather/edit`} testID={RecommendedInsulinTestIds.EditRecommendedInsulinIcon}/>
124
- </View>
125
- </LinearGradient>
106
+ <TouchableOpacity testID={EditRecommendedInsulin} onPress={this.handleOnPress} style={style.container}>
107
+ <Text style={style.titleText}>{i18n._(t `Recommended amount of insulin`)}</Text>
108
+ <Text style={style.insulinText} testID={ShownInsulinText}>
109
+ {shownInsulin}
110
+ </Text>
111
+ <Text style={style.unitsText}>{i18n._(t `Units`)}</Text>
112
+ <Text style={style.editText}>{i18n._(t `Enter Manually`)}</Text>
126
113
  </TouchableOpacity>
127
- <InvisibleNumberInput testID={RecommendedInsulinTestIds.InvisibleInsulinInput} decimalPlaces={3} negativeAllowed={false} cleanPartialInput={false} partialInput={this.updatePartially} onEnd={this.handleUpdatedInsulin} visible={(visible) => (this.callbackInput = visible)} startValue={`${shownInsulin}`}/>
114
+
115
+ <InvisibleNumberInput testID={InvisibleInsulinInput} decimalPlaces={1} maxLength={4} negativeAllowed={false} cleanPartialInput={false} partialInput={this.updatePartially} onEnd={this.handleUpdatedInsulin} visible={(visible) => (this.callbackInput = visible)} startValue={`${shownInsulin}`}/>
128
116
  </React.Fragment>);
129
117
  };
130
118
  }
131
- const recommendedInsulinStyles = StyleSheet.create({
119
+ const style = StyleSheet.create({
132
120
  container: {
133
- marginHorizontal: infoStyles.margin.margin,
134
- marginTop: infoStyles.margin.margin,
135
121
  borderRadius: 5,
122
+ paddingVertical: 16,
123
+ paddingHorizontal: 24.5,
124
+ backgroundColor: colors.deepPurple,
125
+ marginBottom: 32,
126
+ minHeight: 200,
136
127
  },
137
- recommendedTextContainer: {
138
- flex: 1,
139
- alignItems: `center`,
140
- marginTop: `3%`,
141
- },
142
- recommendedText: {
143
- paddingTop: `1%`,
144
- ...infoStyles.label,
145
- },
146
- recommendedContainer: {
147
- flex: 1,
148
- flexDirection: `row`,
149
- marginLeft: `10%`,
150
- },
151
- valueContainer: {
152
- flex: 1,
153
- flexDirection: `row`,
154
- justifyContent: `center`,
155
- minHeight: Dimensions.get(`screen`).width / 4,
128
+ editText: {
129
+ ...FONTS.Poppins.regular_SM,
130
+ color: colors.teal,
131
+ textAlign: `center`,
156
132
  },
157
- value: {
158
- ...FONTS.Poppins.bold_4XL,
159
- fontSize: 78,
160
- lineHeight: 92,
133
+ unitsText: {
134
+ ...FONTS.Poppins.medium_XS,
161
135
  color: colors.white,
136
+ textAlign: `center`,
137
+ marginTop: -16,
138
+ marginBottom: 16,
162
139
  },
163
- units: {
164
- ...FONTS.Poppins.regular_SM,
165
- alignSelf: `flex-end`,
140
+ insulinText: {
141
+ ...FONTS.Oswald.bold_7XL,
166
142
  color: colors.white,
167
- paddingBottom: `6%`,
143
+ textAlign: `center`,
144
+ minHeight: 90,
145
+ lineHeight: 90,
146
+ justifyContent: `center`,
168
147
  },
169
- editIcon: {
148
+ titleText: {
149
+ ...FONTS.Poppins.medium_Base,
170
150
  color: colors.white,
171
- ...ICONS.SM,
172
- textAlignVertical: `center`,
173
- paddingBottom: `10%`,
174
- marginRight: `5%`,
151
+ textAlign: `center`,
152
+ marginBottom: 16,
175
153
  },
176
154
  });