@hedia/recommendation-screen 2.1.47 → 2.1.48-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/src/RecommendationScreen.d.ts +8 -0
  2. package/dist/src/RecommendationScreen.js +42 -39
  3. package/dist/src/assets/fonts/Poppins-Bold.ttf +0 -0
  4. package/dist/src/assets/fonts/Poppins-SemiBold.ttf +0 -0
  5. package/dist/src/assets/icons/Edit.d.ts +4 -0
  6. package/dist/src/assets/icons/Edit.js +7 -0
  7. package/dist/src/assets/icons/Edit.tsx +22 -0
  8. package/dist/src/assets/icons/X.d.ts +4 -0
  9. package/dist/src/assets/icons/X.js +6 -0
  10. package/dist/src/assets/icons/X.tsx +14 -0
  11. package/dist/src/components/ForecastInfoBar.d.ts +117 -0
  12. package/dist/src/components/ForecastInfoBar.js +150 -0
  13. package/dist/src/components/Header.d.ts +3 -5
  14. package/dist/src/components/Header.js +38 -59
  15. package/dist/src/components/InfoBars.d.ts +3 -2
  16. package/dist/src/components/InfoBars.js +10 -8
  17. package/dist/src/components/RecentInsulin.d.ts +1 -1
  18. package/dist/src/components/RecentInsulin.js +34 -54
  19. package/dist/src/components/RecommendationModal.d.ts +1 -2
  20. package/dist/src/components/RecommendationModal.js +15 -10
  21. package/dist/src/components/RecommendedCarbs.js +21 -25
  22. package/dist/src/components/RecommendedInsulin.js +50 -41
  23. package/dist/src/components/Remeasure.js +4 -3
  24. package/dist/src/components/{TransferToLogbook.d.ts → SaveButton.d.ts} +1 -1
  25. package/dist/src/components/SaveButton.js +71 -0
  26. package/dist/src/components/TwoOptionModal.d.ts +1 -0
  27. package/dist/src/components/TwoOptionModal.js +10 -9
  28. package/dist/src/components/mood/Emotion.js +3 -1
  29. package/dist/src/components/mood/MoodIcon.js +3 -3
  30. package/dist/src/locale/da/messages.js +1 -1
  31. package/dist/src/locale/da/messages.po +72 -64
  32. package/dist/src/locale/de/messages.js +1 -1
  33. package/dist/src/locale/de/messages.po +72 -64
  34. package/dist/src/locale/en/messages.js +1 -1
  35. package/dist/src/locale/en/messages.po +72 -64
  36. package/dist/src/locale/es/messages.js +1 -1
  37. package/dist/src/locale/es/messages.po +72 -64
  38. package/dist/src/locale/fr/messages.js +1 -1
  39. package/dist/src/locale/fr/messages.po +72 -64
  40. package/dist/src/locale/it/messages.js +1 -1
  41. package/dist/src/locale/it/messages.po +72 -64
  42. package/dist/src/types/enum.d.ts +6 -3
  43. package/dist/src/types/enum.js +3 -0
  44. package/dist/src/utils/Constants.d.ts +12 -6
  45. package/dist/src/utils/Constants.js +12 -6
  46. package/package.json +5 -3
  47. package/dist/src/components/TransferToLogbook.js +0 -92
@@ -3,7 +3,7 @@ import { t } from "@lingui/macro";
3
3
  import React from "react";
4
4
  import { Dimensions, StyleSheet, View } from "react-native";
5
5
  import { i18n } from "../locale/i18nUtils";
6
- import { BORDER_COLOUR_GREY } from "../utils/Constants";
6
+ import { colors } from "../utils/Constants";
7
7
  import { Utils } from "../utils/Utils";
8
8
  import TextBold from "./text/TextBold";
9
9
  import TextRegular from "./text/TextRegular";
@@ -70,17 +70,19 @@ export default class InfoBars extends React.Component {
70
70
  </View>);
71
71
  }
72
72
  }
73
+ const { width } = Dimensions.get(`screen`);
73
74
  /** @internal */
74
75
  export const infoStyles = StyleSheet.create({
75
76
  container: { flex: 1 },
76
77
  margin: {
77
78
  flex: 1,
78
- margin: `3%`,
79
+ marginVertical: width / 35,
80
+ marginHorizontal: width / 17,
79
81
  marginBottom: 0,
80
82
  },
81
83
  border: {
82
84
  borderWidth: 2,
83
- borderColor: BORDER_COLOUR_GREY,
85
+ borderColor: colors.mistBlue,
84
86
  borderRadius: 5,
85
87
  paddingVertical: `1%`,
86
88
  },
@@ -96,7 +98,7 @@ export const infoStyles = StyleSheet.create({
96
98
  },
97
99
  label: {
98
100
  color: `white`,
99
- fontSize: Dimensions.get(`screen`).width / 22,
101
+ fontSize: width / 22,
100
102
  },
101
103
  valueUnitContainer: {
102
104
  flex: 6.5,
@@ -109,18 +111,18 @@ export const infoStyles = StyleSheet.create({
109
111
  },
110
112
  value: {
111
113
  color: `white`,
112
- fontSize: Dimensions.get(`screen`).width / 15,
114
+ fontSize: width / 16,
113
115
  textAlign: `right`,
114
116
  },
115
117
  unitContainer: {
116
118
  flex: 3,
117
119
  justifyContent: `flex-end`,
118
- paddingBottom: `3%`,
119
120
  },
120
121
  units: {
121
122
  color: `white`,
122
- fontSize: Dimensions.get(`screen`).width / 30,
123
+ fontSize: width / 30,
123
124
  textAlign: `left`,
124
- paddingLeft: `5%`,
125
+ paddingLeft: `15%`,
126
+ marginBottom: 4,
125
127
  },
126
128
  });
@@ -9,7 +9,7 @@ export interface IProps {
9
9
  export default class RecentInsulin extends React.Component<IProps> {
10
10
  /**
11
11
  *
12
- * @returns JSX element that displays a card with the question “Have you taken insulin within the last 4 hours? Along with two buttons labeled “Yes” and “No” respectively.
12
+ * @returns JSX element that displays a card with the question “Have you taken rapid-acting insulin within the last 4 hours? Along with two buttons labeled “Yes” and “No” respectively.
13
13
  * If the user taps the “Yes” button, the onRecentInsulinYes prop callback function should be called.
14
14
  * If the user taps the “No” button, the onRecentInsulinNo prop callback function should be called.
15
15
  */
@@ -1,93 +1,73 @@
1
1
  import { t } from "@lingui/macro";
2
2
  import React from "react";
3
3
  import { Dimensions, StyleSheet, TouchableOpacity, View } from "react-native";
4
+ import LinearGradient from "react-native-linear-gradient";
4
5
  import { i18n } from "../locale/i18nUtils";
5
6
  import { Testing } from "../types/enum";
7
+ import { colors } from "../utils/Constants";
6
8
  import { infoStyles } from "./InfoBars";
7
9
  import TextBold from "./text/TextBold";
8
10
  /** Display a card that prompts the user to recall if they injected insulin recently. */
9
11
  export default class RecentInsulin extends React.Component {
10
12
  /**
11
13
  *
12
- * @returns JSX element that displays a card with the question “Have you taken insulin within the last 4 hours? Along with two buttons labeled “Yes” and “No” respectively.
14
+ * @returns JSX element that displays a card with the question “Have you taken rapid-acting insulin within the last 4 hours? Along with two buttons labeled “Yes” and “No” respectively.
13
15
  * If the user taps the “Yes” button, the onRecentInsulinYes prop callback function should be called.
14
16
  * If the user taps the “No” button, the onRecentInsulinNo prop callback function should be called.
15
17
  */
16
18
  render = () => {
17
- return (<View style={recentInsulinStyles.container}>
18
- <View style={recentInsulinStyles.titleContainer}>
19
- <TextBold style={recentInsulinStyles.recommended}>
20
- {i18n._(t `Recommended amount of insulin`)}
21
- </TextBold>
22
- </View>
23
- <View style={recentInsulinStyles.takenInsulinContainer}>
24
- <TextBold style={recentInsulinStyles.takenInsulin}>
25
- {i18n._(t `Have you taken insulin within the last 4 hours?`)}
26
- </TextBold>
27
- </View>
28
- <View style={recentInsulinStyles.buttonContainer}>
29
- <View style={recentInsulinStyles.filler}/>
30
- <TouchableOpacity testID={Testing.Id.RecentInsulinTestIds.Yes} onPress={this.props.onRecentInsulinYes} style={[recentInsulinStyles.yesNoContainer, { marginRight: `2%` }]}>
31
- <TextBold style={recentInsulinStyles.yesNoText}>{i18n._(t `Yes`)}</TextBold>
19
+ const { container, title, buttonContainer, yesNoContainer, yesNoText } = styles;
20
+ return (<LinearGradient style={container} colors={[`rgba(87, 138, 255, 0.3)`, `rgba(162, 0, 255, 0.3)`]} useAngle={true} angle={170}>
21
+ <TextBold style={title}>
22
+ {i18n._(t `Have you taken rapid-acting insulin within the last 4 hours?`)}
23
+ </TextBold>
24
+
25
+ <View style={buttonContainer}>
26
+ <TouchableOpacity testID={Testing.Id.RecentInsulinTestIds.Yes} onPress={this.props.onRecentInsulinYes} style={[yesNoContainer, { marginRight: `2%` }]}>
27
+ <TextBold style={yesNoText}>{i18n._(t `Yes`)}</TextBold>
32
28
  </TouchableOpacity>
33
- <TouchableOpacity testID={Testing.Id.RecentInsulinTestIds.No} onPress={this.props.onRecentInsulinNo} style={[recentInsulinStyles.yesNoContainer, { marginLeft: `2%` }]}>
34
- <TextBold style={recentInsulinStyles.yesNoText}>{i18n._(t `No`)}</TextBold>
29
+ <TouchableOpacity testID={Testing.Id.RecentInsulinTestIds.No} onPress={this.props.onRecentInsulinNo} style={[yesNoContainer, { marginLeft: `2%` }]}>
30
+ <TextBold style={yesNoText}>{i18n._(t `No`)}</TextBold>
35
31
  </TouchableOpacity>
36
- <View style={recentInsulinStyles.filler}/>
37
32
  </View>
38
- </View>);
33
+ </LinearGradient>);
39
34
  };
40
35
  }
41
- const recentInsulinStyles = StyleSheet.create({
36
+ const { width } = Dimensions.get(`screen`);
37
+ const styles = StyleSheet.create({
42
38
  container: {
43
39
  ...infoStyles.margin,
44
- backgroundColor: `rgba(118, 82, 255, 0.5)`,
45
40
  borderRadius: 5,
46
41
  },
47
- titleContainer: {
48
- flex: 1,
49
- justifyContent: `center`,
50
- alignItems: `center`,
51
- marginTop: `4%`,
52
- marginBottom: `4%`,
53
- },
54
- recommended: {
42
+ title: {
43
+ fontFamily: `Poppins-Bold`,
55
44
  ...infoStyles.label,
56
- },
57
- takenInsulinContainer: {
58
- flex: 1,
59
- justifyContent: `center`,
60
- alignItems: `center`,
61
- marginTop: `2%`,
62
- },
63
- takenInsulin: {
64
- ...infoStyles.label,
65
- fontSize: Dimensions.get(`screen`).width / 27,
45
+ fontSize: width / 24,
46
+ lineHeight: width / 16,
66
47
  textAlign: `center`,
48
+ paddingHorizontal: width / 13,
49
+ marginTop: width / 32,
67
50
  },
68
51
  buttonContainer: {
69
52
  flex: 1,
70
53
  flexDirection: `row`,
71
- justifyContent: `space-evenly`,
72
- marginTop: `4%`,
73
- marginBottom: `5%`,
54
+ justifyContent: `center`,
55
+ marginVertical: width / 26,
74
56
  },
75
57
  yesNoContainer: {
76
58
  flex: 1,
77
- borderColor: `white`,
78
- borderRadius: 100,
59
+ maxWidth: width / 4,
60
+ backgroundColor: colors.teal,
61
+ borderColor: colors.teal,
62
+ borderRadius: 50,
79
63
  borderWidth: 2,
80
- paddingHorizontal: `2%`,
81
- paddingVertical: `1%`,
82
64
  },
83
65
  yesNoText: {
84
66
  textAlign: `center`,
85
- paddingTop: `1%`,
86
- paddingBottom: `1%`,
87
- color: `white`,
88
- fontSize: Dimensions.get(`screen`).width / 25,
89
- },
90
- filler: {
91
- flex: 1,
67
+ paddingVertical: width / 43,
68
+ color: colors.darkBlue,
69
+ fontSize: width / 25,
70
+ lineHeight: width / 16,
71
+ fontFamily: `Poppins-Bold`,
92
72
  },
93
73
  });
@@ -82,16 +82,15 @@ export default class RecommendationModal extends React.Component<IModalProps, IM
82
82
  export declare const stylesModal: {
83
83
  modalStyle: {
84
84
  margin: number;
85
+ backgroundColor: string;
85
86
  };
86
87
  container: {
87
88
  flex: number;
88
- backgroundColor: string;
89
89
  justifyContent: "center";
90
90
  paddingHorizontal: string;
91
91
  };
92
92
  containerAcceptButton: {
93
93
  flex: number;
94
- backgroundColor: string;
95
94
  justifyContent: "flex-start";
96
95
  };
97
96
  titleContainer: {
@@ -4,7 +4,7 @@ import { Dimensions, 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";
7
- import { BORDER_COLOUR_TEAL } from "../utils/Constants";
7
+ import { colors } from "../utils/Constants";
8
8
  import LimitationMessage from "./LimitationMessage";
9
9
  import TextBold from "./text/TextBold";
10
10
  import TextRegular from "./text/TextRegular";
@@ -150,23 +150,24 @@ const textFontSize = width / 20;
150
150
  const titleFontSize = width / 13;
151
151
  /** @internal */
152
152
  export const stylesModal = StyleSheet.create({
153
- modalStyle: { margin: 0 },
153
+ modalStyle: {
154
+ margin: 0,
155
+ backgroundColor: colors.darkBlue,
156
+ },
154
157
  container: {
155
158
  flex: 4,
156
- backgroundColor: `rgba(30, 35, 87, 0.9)`,
157
159
  justifyContent: `center`,
158
160
  paddingHorizontal: `4%`,
159
161
  },
160
162
  containerAcceptButton: {
161
163
  flex: 1,
162
- backgroundColor: `rgba(30, 35, 87, 0.9)`,
163
164
  justifyContent: `flex-start`,
164
165
  },
165
166
  titleContainer: { marginBottom: `5%` },
166
167
  recommendationRow: { justifyContent: `center`, alignContent: `center`, marginBottom: `3%` },
167
168
  textTittleMessage: { color: `white`, fontSize: titleFontSize, textAlign: `center` },
168
169
  textMessage: { color: `white`, fontSize: textFontSize, textAlign: `center` },
169
- buttonText: { color: BORDER_COLOUR_TEAL, fontSize: buttonFontSize, textAlign: `center` },
170
+ buttonText: { color: colors.teal, fontSize: buttonFontSize, textAlign: `center` },
170
171
  addToCalculationContainer: { justifyContent: `flex-start`, marginVertical: `5%` },
171
172
  innerView: {
172
173
  alignContent: `center`,
@@ -175,22 +176,26 @@ export const stylesModal = StyleSheet.create({
175
176
  marginTop: `5%`,
176
177
  borderRadius: height / 80,
177
178
  borderWidth: height / 300,
178
- borderColor: BORDER_COLOUR_TEAL,
179
+ borderColor: colors.teal,
179
180
  },
180
181
  suggestedContainer: { justifyContent: `center`, flexDirection: `row`, marginBottom: `3%` },
181
182
  suggestedCarbs: { color: `white`, fontSize: sugestionFontSize },
182
183
  textCenter: { textAlign: `center` },
183
- recommendEatingText: { color: `#C5D0E7`, fontSize: recommendEatingFontSize, textAlign: `center` },
184
+ recommendEatingText: {
185
+ color: colors.dustyBlue,
186
+ fontSize: recommendEatingFontSize,
187
+ textAlign: `center`,
188
+ },
184
189
  carbohydrateText: { color: `white`, fontSize: sugestionFontSize },
185
190
  addToCalculation: { color: `white`, fontSize: textFontSize, textAlign: `center` },
186
191
  recommendationButtonsContainer: { justifyContent: `center`, flexDirection: `row`, margin: `3%` },
187
- affirmativeCarbsText: { color: BORDER_COLOUR_TEAL, fontSize: buttonFontSize, textAlign: `center` },
192
+ affirmativeCarbsText: { color: colors.teal, fontSize: buttonFontSize, textAlign: `center` },
188
193
  negativeCarbsText: { color: `white`, fontSize: buttonFontSize, textAlign: `center` },
189
194
  affirmativeCarbsButton: {
190
195
  marginTop: `2%`,
191
196
  borderRadius: buttonBorderRadius,
192
197
  borderWidth: buttonBorderWidth,
193
- borderColor: BORDER_COLOUR_TEAL,
198
+ borderColor: colors.teal,
194
199
  width: buttonWidth,
195
200
  height: buttonHeight,
196
201
  alignSelf: `center`,
@@ -212,7 +217,7 @@ export const stylesModal = StyleSheet.create({
212
217
  marginTop: `6%`,
213
218
  borderRadius: buttonBorderRadius,
214
219
  borderWidth: buttonBorderWidth,
215
- borderColor: BORDER_COLOUR_TEAL,
220
+ borderColor: colors.teal,
216
221
  width: buttonWidth,
217
222
  height: buttonHeight,
218
223
  alignSelf: `center`,
@@ -1,9 +1,10 @@
1
1
  import { t } from "@lingui/macro";
2
2
  import React from "react";
3
3
  import { Alert, Dimensions, StyleSheet, TouchableOpacity, View } from "react-native";
4
+ import EditIcon from "../assets/icons/Edit";
4
5
  import { i18n } from "../locale/i18nUtils";
5
6
  import { Testing } from "../types/enum";
6
- import { BORDER_COLOUR_GREY, BORDER_COLOUR_TEAL } from "../utils/Constants";
7
+ import { colors } from "../utils/Constants";
7
8
  import { CarbohydrateLimitError } from "../utils/RecommendationError";
8
9
  import Icon from "./Icon";
9
10
  import { infoStyles } from "./InfoBars";
@@ -89,8 +90,8 @@ export default class RecommendedCarbs extends React.Component {
89
90
  renderRecommendedCarbs = () => {
90
91
  const shownCarbs = this.state.partialInput ?? Math.round(Number(this.props.recommendedCarbs));
91
92
  const totalCarbs = Math.round(parseFloat(this.props.enteredCarbs) + Number(shownCarbs));
92
- return (<React.Fragment>
93
- <LineSeparator color={BORDER_COLOUR_GREY}/>
93
+ return (<>
94
+ <LineSeparator color={colors.fadeBlue}/>
94
95
  <View style={calculationStyles.borderContainer}>
95
96
  <View style={calculationStyles.recommendedContainer}>
96
97
  <TouchableOpacity testID={RecommendedCarbsTestIds.RemoveRecommendation} style={calculationStyles.removeRecommended} onPress={this.props.removeRecommendedCarbs}>
@@ -106,29 +107,29 @@ export default class RecommendedCarbs extends React.Component {
106
107
  <View style={calculationStyles.valueUnitContainer}>
107
108
  <TouchableOpacity testID={RecommendedCarbsTestIds.EditRecommendedCarbs} onPress={this.showTextInput} style={[calculationStyles.valueUnitContainer]}>
108
109
  <View style={calculationStyles.valueContainer}>
109
- <TextBold testID={RecommendedCarbsTestIds.RecommendedCarbs} style={{ ...calculationStyles.value, color: BORDER_COLOUR_TEAL }}>
110
+ <TextBold testID={RecommendedCarbsTestIds.RecommendedCarbs} style={{ ...calculationStyles.value, color: colors.teal }}>
110
111
  {shownCarbs}
111
112
  </TextBold>
112
113
  </View>
113
114
  <View style={[calculationStyles.unitContainer]}>
114
115
  <View style={calculationStyles.editIconContainer}>
115
- <Icon style={calculationStyles.editIcon} iconIdentifier={`Feather/edit`}/>
116
+ <EditIcon />
116
117
  </View>
117
- <TextRegular style={{ ...calculationStyles.units, color: BORDER_COLOUR_TEAL }}>
118
+ <TextRegular style={{ ...calculationStyles.units, color: colors.teal }}>
118
119
  {i18n._(t `grams`)}
119
120
  </TextRegular>
120
121
  </View>
121
122
  </TouchableOpacity>
122
123
  </View>
123
124
  </View>
124
- <LineSeparator color={BORDER_COLOUR_TEAL}/>
125
+ <LineSeparator color={colors.fadeBlue}/>
125
126
  {this.renderRow({
126
127
  label: i18n._(t `Total`),
127
128
  value: totalCarbs.toString(),
128
129
  units: i18n._(t `grams`),
129
130
  }, RecommendedCarbsTestIds.TotalCarbs)}
130
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}/>
131
- </React.Fragment>);
132
+ </>);
132
133
  };
133
134
  /**
134
135
  * Display a row of information for the user. Specifically used to display the amount of carbohydrates that the user has entered.
@@ -137,7 +138,7 @@ export default class RecommendedCarbs extends React.Component {
137
138
  * @returns A JSX element to display 3 strings on the screen: label, value, and a unit.
138
139
  */
139
140
  renderRow = (row, testID) => {
140
- return (<View style={[calculationStyles.borderContainer, { paddingVertical: `1%` }]}>
141
+ return (<View style={calculationStyles.borderContainer}>
141
142
  <View style={calculationStyles.rowContainer}>
142
143
  <TextBold style={calculationStyles.rowLabel}>{row.label}</TextBold>
143
144
  </View>
@@ -161,7 +162,7 @@ export default class RecommendedCarbs extends React.Component {
161
162
  */
162
163
  render() {
163
164
  const carbs = Number(this.props.recommendedCarbs);
164
- return (<React.Fragment>
165
+ return (<>
165
166
  <View style={calculationStyles.foodTitleContainer}>
166
167
  <TextBold style={infoStyles.label}>{i18n._(t `Food`)}</TextBold>
167
168
  <TextRegular style={calculationStyles.foodUnitsLabel}>
@@ -174,9 +175,10 @@ export default class RecommendedCarbs extends React.Component {
174
175
  units: i18n._(t `grams`),
175
176
  }, RecommendedCarbsTestIds.EnteredCarbs)}
176
177
  {!isNaN(carbs) && carbs > 0 ? this.renderRecommendedCarbs() : null}
177
- </React.Fragment>);
178
+ </>);
178
179
  }
179
180
  }
181
+ const { width } = Dimensions.get(`screen`);
180
182
  const calculationStyles = StyleSheet.create({
181
183
  borderContainer: {
182
184
  ...infoStyles.borderContainer,
@@ -191,7 +193,7 @@ const calculationStyles = StyleSheet.create({
191
193
  },
192
194
  foodUnitsLabel: {
193
195
  ...infoStyles.units,
194
- color: `rgba(160, 180, 240, 1)`,
196
+ color: colors.fadeBlue,
195
197
  paddingLeft: `1%`,
196
198
  },
197
199
  rowContainer: {
@@ -199,7 +201,7 @@ const calculationStyles = StyleSheet.create({
199
201
  },
200
202
  rowLabel: {
201
203
  color: `white`,
202
- fontSize: Dimensions.get(`screen`).width / 25,
204
+ fontSize: width / 25,
203
205
  },
204
206
  enteredContainer: {
205
207
  flex: 3,
@@ -207,7 +209,7 @@ const calculationStyles = StyleSheet.create({
207
209
  },
208
210
  entered: {
209
211
  color: `white`,
210
- fontSize: Dimensions.get(`screen`).width / 23,
212
+ fontSize: width / 23,
211
213
  },
212
214
  valueUnitContainer: {
213
215
  ...infoStyles.valueUnitContainer,
@@ -225,21 +227,15 @@ const calculationStyles = StyleSheet.create({
225
227
  ...infoStyles.units,
226
228
  },
227
229
  editIconContainer: {
228
- justifyContent: `flex-end`,
229
- paddingRight: `20%`,
230
- flexDirection: `row`,
231
- },
232
- editIcon: {
233
- color: BORDER_COLOUR_TEAL,
234
- fontSize: Dimensions.get(`screen`).width / 30,
230
+ paddingLeft: `20%`,
235
231
  },
236
232
  recommendedContainer: {
237
233
  flex: 7,
238
234
  flexDirection: `row`,
239
235
  },
240
236
  recommendedLabel: {
241
- color: BORDER_COLOUR_TEAL,
242
- fontSize: Dimensions.get(`screen`).width / 25,
237
+ color: colors.teal,
238
+ fontSize: width / 25,
243
239
  alignSelf: `center`,
244
240
  },
245
241
  removeRecommended: {
@@ -248,8 +244,8 @@ const calculationStyles = StyleSheet.create({
248
244
  marginTop: `1%`,
249
245
  },
250
246
  removeRecommendedIcon: {
251
- color: BORDER_COLOUR_TEAL,
252
- fontSize: Dimensions.get(`screen`).width / 20,
247
+ color: colors.teal,
248
+ fontSize: width / 20,
253
249
  paddingBottom: `0.5%`,
254
250
  },
255
251
  });
@@ -1,14 +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";
4
+ import { Alert, Dimensions, StyleSheet, TouchableOpacity, View } from "react-native";
5
5
  import LinearGradient from "react-native-linear-gradient";
6
+ import EditIcon from "../assets/icons/Edit";
6
7
  import { i18n } from "../locale/i18nUtils";
7
8
  import { Testing } from "../types/enum";
8
9
  import { Messages } from "../utils/AttentionMessages";
10
+ import { colors } from "../utils/Constants";
9
11
  import { Utils } from "../utils/Utils";
10
- import Icon from "./Icon";
11
- import { infoStyles } from "./InfoBars";
12
12
  import InvisibleNumberInput from "./InvisibleNumberInput";
13
13
  import TextBold from "./text/TextBold";
14
14
  import TextRegular from "./text/TextRegular";
@@ -102,72 +102,81 @@ export default class RecommendedInsulin extends React.Component {
102
102
  * and using an InvisibleNumberInput component to enable input when the insulin amount is tapped.
103
103
  */
104
104
  render = () => {
105
- const paddingBottom = Platform.OS === `ios` ? `3%` : `1%`;
106
105
  const shownInsulin = this.state.partialInput ?? this.props.insulinRecommendation ?? `0`;
107
- return (<React.Fragment>
106
+ const { container, editText, title, recommendedContainer, valueContainer, value, units, editButton } = styles;
107
+ return (<>
108
108
  <TouchableOpacity testID={RecommendedInsulinTestIds.EditRecommendedInsulin} onPress={this.handleOnPress}>
109
- <LinearGradient style={recommendedInsulinStyles.container} colors={[`#a200ff`, `#578aff`]} start={{ x: 0, y: 0 }} end={{ x: 1, y: 0 }}>
110
- <View style={recommendedInsulinStyles.recommendedTextContainer}>
111
- <TextBold style={recommendedInsulinStyles.recommendedText}>
112
- {i18n._(t `Recommended amount of insulin`)}
113
- </TextBold>
114
- </View>
115
- <View style={[recommendedInsulinStyles.recommendedContainer, { paddingBottom }]}>
116
- <View style={recommendedInsulinStyles.valueContainer}>
117
- <TextBold style={recommendedInsulinStyles.value} testID={RecommendedInsulinTestIds.ShownInsulinText}>
109
+ <LinearGradient style={container} colors={[colors.purple, colors.blue]} useAngle={true} angle={315}>
110
+ <TextBold style={title}>
111
+ {i18n._(t `Recommended amount of rapid-acting insulin for immidiate injection based on forecasted glucose`)}
112
+ </TextBold>
113
+ <View style={recommendedContainer}>
114
+ <View style={valueContainer}>
115
+ <TextBold style={value} testID={RecommendedInsulinTestIds.ShownInsulinText}>
118
116
  {shownInsulin}
119
117
  </TextBold>
120
- <TextRegular style={recommendedInsulinStyles.units}>{i18n._(t `Units`)}</TextRegular>
118
+ <TextRegular style={units}>{i18n._(t `Units`)}</TextRegular>
119
+ </View>
120
+ <View testID={RecommendedInsulinTestIds.EditRecommendedInsulinIcon} style={editButton}>
121
+ <EditIcon />
122
+ <TextRegular style={editText}>{i18n._(t `Edit`)}</TextRegular>
121
123
  </View>
122
- <Icon style={recommendedInsulinStyles.editIcon} iconIdentifier={`Feather/edit`} testID={RecommendedInsulinTestIds.EditRecommendedInsulinIcon}/>
123
124
  </View>
124
125
  </LinearGradient>
125
126
  </TouchableOpacity>
127
+
126
128
  <InvisibleNumberInput testID={RecommendedInsulinTestIds.InvisibleInsulinInput} decimalPlaces={3} negativeAllowed={false} cleanPartialInput={false} partialInput={this.updatePartially} onEnd={this.handleUpdatedInsulin} visible={(visible) => (this.callbackInput = visible)} startValue={`${shownInsulin}`}/>
127
- </React.Fragment>);
129
+ </>);
128
130
  };
129
131
  }
130
- const recommendedInsulinStyles = StyleSheet.create({
132
+ const { width } = Dimensions.get(`screen`);
133
+ const styles = StyleSheet.create({
131
134
  container: {
132
- marginHorizontal: infoStyles.margin.margin,
133
- marginTop: infoStyles.margin.margin,
135
+ marginHorizontal: width / 17,
136
+ marginTop: width / 35,
134
137
  borderRadius: 5,
138
+ paddingTop: width / 30,
135
139
  },
136
- recommendedTextContainer: {
137
- flex: 1,
138
- alignItems: `center`,
139
- marginTop: `3%`,
140
- },
141
- recommendedText: {
142
- paddingTop: `1%`,
143
- ...infoStyles.label,
140
+ title: {
141
+ fontFamily: `Poppins-Bold`,
142
+ fontSize: width / 28,
143
+ lineHeight: width / 19,
144
+ color: `white`,
145
+ textAlign: `center`,
146
+ paddingHorizontal: width / 12,
144
147
  },
145
148
  recommendedContainer: {
146
- flex: 1,
147
- flexDirection: `row`,
148
- marginLeft: `10%`,
149
+ marginHorizontal: width / 12,
150
+ alignContent: `center`,
149
151
  },
150
152
  valueContainer: {
151
- flex: 1,
152
153
  flexDirection: `row`,
153
154
  justifyContent: `center`,
154
- minHeight: Dimensions.get(`screen`).width / 4,
155
155
  },
156
156
  value: {
157
+ fontFamily: `Poppins-Bold`,
157
158
  color: `white`,
158
- fontSize: Dimensions.get(`screen`).width / 5,
159
+ fontSize: width / 6,
160
+ lineHeight: width / 4,
161
+ marginLeft: width / 15,
159
162
  },
160
163
  units: {
161
164
  alignSelf: `flex-end`,
162
165
  color: `white`,
163
- fontSize: Dimensions.get(`screen`).width / 28,
164
- paddingBottom: `6%`,
166
+ fontSize: width / 28,
167
+ paddingBottom: `8%`,
168
+ marginLeft: width / 100,
169
+ },
170
+ editButton: {
171
+ position: `absolute`,
172
+ flexDirection: `row`,
173
+ right: width / 20,
174
+ top: width / 16,
165
175
  },
166
- editIcon: {
176
+ editText: {
177
+ fontSize: width / 28,
167
178
  color: `white`,
168
- fontSize: Dimensions.get(`screen`).width / 28,
169
- textAlignVertical: `center`,
170
- paddingBottom: `10%`,
171
- marginRight: `5%`,
179
+ opacity: 0.8,
180
+ marginLeft: width / 80,
172
181
  },
173
182
  });
@@ -4,7 +4,7 @@ import React from "react";
4
4
  import { Dimensions, Platform, StyleSheet, View } from "react-native";
5
5
  import { i18n } from "../locale/i18nUtils";
6
6
  import { Testing } from "../types/enum";
7
- import { BORDER_COLOUR_GREY, BORDER_COLOUR_TEAL } from "../utils/Constants";
7
+ import { colors } from "../utils/Constants";
8
8
  import { infoStyles } from "./InfoBars";
9
9
  import TextBold from "./text/TextBold";
10
10
  import TextRegular from "./text/TextRegular";
@@ -81,7 +81,7 @@ export default class Remeasure extends React.Component {
81
81
  if (slider !== null) {
82
82
  this.slider = slider;
83
83
  }
84
- }} testID={Testing.Id.RemeasureTestIds.RemeasureSlider} maximumTrackTintColor={BORDER_COLOUR_GREY} minimumTrackTintColor={BORDER_COLOUR_TEAL} thumbTintColor={BORDER_COLOUR_TEAL} maximumValue={6} minimumValue={0} step={0.5} style={[remeasureStyles.sliderStyle, { marginHorizontal }]} onValueChange={this.handleSliderChange}/>
84
+ }} testID={Testing.Id.RemeasureTestIds.RemeasureSlider} maximumTrackTintColor={colors.mistBlue} minimumTrackTintColor={colors.teal} thumbTintColor={colors.teal} maximumValue={6} minimumValue={0} step={0.5} style={[remeasureStyles.sliderStyle, { marginHorizontal }]} onValueChange={this.handleSliderChange}/>
85
85
  </View>);
86
86
  }
87
87
  }
@@ -99,7 +99,7 @@ const remeasureStyles = StyleSheet.create({
99
99
  },
100
100
  remeasureLabel: {
101
101
  color: `white`,
102
- fontSize: Dimensions.get(`screen`).width / 25,
102
+ fontSize: Dimensions.get(`screen`).width / 28,
103
103
  },
104
104
  valueUnitContainer: {
105
105
  ...infoStyles.valueUnitContainer,
@@ -112,6 +112,7 @@ const remeasureStyles = StyleSheet.create({
112
112
  },
113
113
  unitContainer: {
114
114
  ...infoStyles.unitContainer,
115
+ marginRight: `7%`,
115
116
  },
116
117
  units: {
117
118
  ...infoStyles.units,
@@ -13,7 +13,7 @@ export interface IState {
13
13
  * Render a button for transferring the recommendation to a logbook entry.
14
14
  * 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.
15
15
  */
16
- export default class TransferToLogbook extends React.Component<IProps, IState> {
16
+ export default class SaveButton extends React.Component<IProps, IState> {
17
17
  /** Initialise the state pressed variable with false */
18
18
  state: IState;
19
19
  /**