@hedia/recommendation-screen 2.2.0-alpha.45 → 2.2.0-alpha.6

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,15 +1,17 @@
1
- import React from "react";
2
- import { Alert, StyleSheet, TouchableOpacity, View } from "react-native";
3
1
  import { BolusCalculator } from "@hedia/types";
4
- import Edit from "../assets/IconsSVG/Edit";
5
- import { t } from "../locales/translate";
2
+ import { t } from "@lingui/macro";
3
+ import React from "react";
4
+ import { Alert, Dimensions, StyleSheet, TouchableOpacity, View } from "react-native";
5
+ import LinearGradient from "react-native-linear-gradient";
6
+ import EditIcon from "../assets/icons/Edit";
7
+ import { i18n } from "../locale/i18nUtils";
6
8
  import { Testing } from "../types/enum";
7
9
  import { Messages } from "../utils/AttentionMessages";
8
10
  import { colors } from "../utils/Constants";
9
11
  import { Utils } from "../utils/Utils";
10
12
  import InvisibleNumberInput from "./InvisibleNumberInput";
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 { RecommendedInsulinTestIds } = Testing.Id;
14
16
  const SAFETY_INSULIN_LIMIT = BolusCalculator.Constants.SAFETY_INSULIN_LIMIT;
15
17
  /** Input field for displaying the entered amount of insulin (which defaults to HDA’s recommendation) and allowing the user to edit it. */
@@ -86,8 +88,10 @@ export default class RecommendedInsulin extends React.Component {
86
88
  if (rounded > limited) {
87
89
  this.setState({ partialInput: this.props.insulinRecommendation?.toString() ?? null });
88
90
  this.props.updateRecommendedInsulin(this.props.insulinRecommendation);
89
- return Alert.alert(t(`Attention`), Messages.InsulinInputWasLimited(this.props.activityReduction), [
90
- { text: t(`OK`) },
91
+ return Alert.alert(i18n._(t `Attention`), Messages.InsulinInputWasLimited(this.props.activityReduction), [
92
+ {
93
+ text: i18n._(t `OK`),
94
+ },
91
95
  ]);
92
96
  }
93
97
  this.updatePartially(`${rounded}`);
@@ -99,68 +103,80 @@ export default class RecommendedInsulin extends React.Component {
99
103
  */
100
104
  render = () => {
101
105
  const shownInsulin = this.state.partialInput ?? this.props.insulinRecommendation ?? `0`;
102
- const { EditRecommendedInsulin, EditRecommendedInsulinIcon, ShownInsulinText, InvisibleInsulinInput } = RecommendedInsulinTestIds;
103
- return (<React.Fragment>
104
- <TouchableOpacity testID={EditRecommendedInsulin} onPress={this.handleOnPress} style={style.container}>
105
- <Text style={style.titleText}>{t(`Recommended amount of insulin`)}</Text>
106
- <Text style={style.insulinText} testID={ShownInsulinText}>
107
- {shownInsulin}
108
- </Text>
109
- <Text style={style.unitsText}>{t(`Units`)}</Text>
110
- <View style={style.enterManually}>
111
- {Edit({ color: colors.teal, style: style.editIcon, testID: EditRecommendedInsulinIcon })}
112
- <Text style={style.editText}>{t(`Enter Manually`)}</Text>
113
- </View>
106
+ const { container, editText, title, recommendedContainer, valueContainer, value, units, editButton } = styles;
107
+ return (<>
108
+ <TouchableOpacity testID={RecommendedInsulinTestIds.EditRecommendedInsulin} onPress={this.handleOnPress}>
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}>
116
+ {shownInsulin}
117
+ </TextBold>
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>
123
+ </View>
124
+ </View>
125
+ </LinearGradient>
114
126
  </TouchableOpacity>
115
127
 
116
- <InvisibleNumberInput testID={InvisibleInsulinInput} decimalPlaces={1} maxLength={4} negativeAllowed={false} cleanPartialInput={false} partialInput={this.updatePartially} onEnd={this.handleUpdatedInsulin} visible={(visible) => (this.callbackInput = visible)} startValue={`${shownInsulin}`}/>
117
- </React.Fragment>);
128
+ <InvisibleNumberInput testID={RecommendedInsulinTestIds.InvisibleInsulinInput} decimalPlaces={3} negativeAllowed={false} cleanPartialInput={false} partialInput={this.updatePartially} onEnd={this.handleUpdatedInsulin} visible={(visible) => (this.callbackInput = visible)} startValue={`${shownInsulin}`}/>
129
+ </>);
118
130
  };
119
131
  }
120
- const style = StyleSheet.create({
132
+ const { width } = Dimensions.get(`screen`);
133
+ const styles = StyleSheet.create({
121
134
  container: {
135
+ marginHorizontal: width / 17,
136
+ marginTop: width / 35,
122
137
  borderRadius: 5,
123
- padding: 16,
124
- backgroundColor: colors.deepPurple,
125
- marginBottom: 32,
126
- minHeight: 200,
138
+ paddingTop: width / 30,
127
139
  },
128
- editText: {
129
- ...FONTS.Poppins.regular_SM,
130
- color: colors.teal,
140
+ title: {
141
+ fontFamily: `Poppins-Bold`,
142
+ fontSize: width / 28,
143
+ lineHeight: width / 19,
144
+ color: `white`,
131
145
  textAlign: `center`,
146
+ paddingHorizontal: width / 12,
132
147
  },
133
- unitsText: {
134
- ...FONTS.Poppins.medium_XS,
135
- color: colors.white,
136
- textAlign: `center`,
137
- marginTop: -16,
138
- marginBottom: 16,
148
+ recommendedContainer: {
149
+ marginHorizontal: width / 12,
150
+ alignContent: `center`,
139
151
  },
140
- insulinText: {
141
- ...FONTS.Oswald.bold_7XL,
142
- color: colors.white,
143
- textAlign: `center`,
144
- minHeight: 110,
145
- lineHeight: 90,
146
- letterSpacing: 6,
152
+ valueContainer: {
153
+ flexDirection: `row`,
147
154
  justifyContent: `center`,
148
155
  },
149
- titleText: {
150
- ...FONTS.Poppins.medium_Base,
151
- color: colors.white,
152
- textAlign: `center`,
153
- marginBottom: 16,
156
+ value: {
157
+ fontFamily: `Poppins-Bold`,
158
+ color: `white`,
159
+ fontSize: width / 6,
160
+ lineHeight: width / 4,
161
+ marginLeft: width / 15,
154
162
  },
155
- editIcon: {
156
- height: 16,
157
- width: 16,
158
- marginRight: 4,
159
- alignSelf: `center`,
163
+ units: {
164
+ alignSelf: `flex-end`,
165
+ color: `white`,
166
+ fontSize: width / 28,
167
+ paddingBottom: `8%`,
168
+ marginLeft: width / 100,
160
169
  },
161
- enterManually: {
170
+ editButton: {
171
+ position: `absolute`,
162
172
  flexDirection: `row`,
163
- justifyContent: `center`,
173
+ right: width / 20,
174
+ top: width / 16,
175
+ },
176
+ editText: {
177
+ fontSize: width / 28,
178
+ color: `white`,
179
+ opacity: 0.8,
180
+ marginLeft: width / 80,
164
181
  },
165
182
  });
166
- //# sourceMappingURL=RecommendedInsulin.js.map
@@ -8,15 +8,25 @@ export interface IProps {
8
8
  */
9
9
  onSliderChange(value: number): void;
10
10
  }
11
- export interface IState {
12
- remeasureTime: number;
13
- }
14
11
  /**
15
12
  * The Remeasure component has a slider child component that the user can drag to change
16
13
  * when they will get a reminder notification about measuring their BGL again.
17
14
  */
18
- export default class Remeasure extends React.Component<IProps, IState> {
19
- constructor(props: IProps);
15
+ export default class Remeasure extends React.Component<IProps> {
16
+ /** For holding a reference to the slider component so its initial value can be set (only one time) when the Remeasure component has been mounted. */
17
+ private slider?;
18
+ /**
19
+ * Called immediately after a component is mounted. Setting state here will trigger re-rendering.
20
+ *
21
+ * If the value of a slider component in React Native is set to track an outside state,
22
+ * the slider indicator may jump back and forth while updates to the value are propagated through the affected objects and components.
23
+ * Since we don’t need to change the value of the slider from the outside after initialising it to the default value,
24
+ * we simply set the default value (using setNativeProp) upon initialisation instead of using the slider’s normal value prop to set it.
25
+ *
26
+ * Steps:
27
+ * 1. Call the setNativeProps() method on the slider to set its value to the remeasureTime prop.
28
+ */
29
+ componentDidMount(): void;
20
30
  /**
21
31
  * Steps:
22
32
  * 1. Use limitTime() to limit/clamp the value of remeasureTime in the range 0 to 6.
@@ -1,19 +1,35 @@
1
+ import { t } from "@lingui/macro";
1
2
  import Slider from "@react-native-community/slider";
2
3
  import React from "react";
3
- import { StyleSheet, View } from "react-native";
4
- import { t } from "../locales/translate";
4
+ import { Dimensions, Platform, StyleSheet, View } from "react-native";
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 { infoStyles } from "./InfoBars";
9
+ import TextBold from "./text/TextBold";
10
+ import TextRegular from "./text/TextRegular";
9
11
  /**
10
12
  * The Remeasure component has a slider child component that the user can drag to change
11
13
  * when they will get a reminder notification about measuring their BGL again.
12
14
  */
13
15
  export default class Remeasure extends React.Component {
14
- constructor(props) {
15
- super(props);
16
- this.state = { remeasureTime: props.remeasureTime };
16
+ /** For holding a reference to the slider component so its initial value can be set (only one time) when the Remeasure component has been mounted. */
17
+ slider;
18
+ /**
19
+ * Called immediately after a component is mounted. Setting state here will trigger re-rendering.
20
+ *
21
+ * If the value of a slider component in React Native is set to track an outside state,
22
+ * the slider indicator may jump back and forth while updates to the value are propagated through the affected objects and components.
23
+ * Since we don’t need to change the value of the slider from the outside after initialising it to the default value,
24
+ * we simply set the default value (using setNativeProp) upon initialisation instead of using the slider’s normal value prop to set it.
25
+ *
26
+ * Steps:
27
+ * 1. Call the setNativeProps() method on the slider to set its value to the remeasureTime prop.
28
+ */
29
+ componentDidMount() {
30
+ this.slider?.setNativeProps({
31
+ value: this.props.remeasureTime,
32
+ });
17
33
  }
18
34
  /**
19
35
  * Steps:
@@ -22,7 +38,6 @@ export default class Remeasure extends React.Component {
22
38
  * @param remeasureTime The value of the remeasurement slider.
23
39
  */
24
40
  handleSliderChange = (remeasureTime) => {
25
- this.setState({ remeasureTime });
26
41
  const limited = this.limitTime(remeasureTime);
27
42
  this.props.onSliderChange(limited);
28
43
  };
@@ -40,64 +55,76 @@ export default class Remeasure extends React.Component {
40
55
  * with a horizontal slider for changing it in increments of 0.5 hours in the range 0 to 6.
41
56
  */
42
57
  render() {
43
- const measure = this.state.remeasureTime > 0;
44
- const limited = this.limitTime(this.state.remeasureTime);
45
- const { RemeasureHours, RemeasureSlider } = Testing.Id.RemeasureTestIds;
46
- return (<View style={styles.container}>
47
- <View style={styles.textContainer}>
48
- <Text style={styles.remeasureLabel} maxFontSizeMultiplier={1}>
49
- {t(`Remind me to remeasure in`)}
50
- </Text>
51
- <View style={styles.valueUnitContainer}>
52
- <Text style={styles.value} testID={RemeasureHours} maxFontSizeMultiplier={1}>
53
- {measure ? limited : t(`OFF`)}
54
- </Text>
55
- {measure && (<Text style={styles.units} maxFontSizeMultiplier={1}>
56
- {t(`hours`)}
57
- </Text>)}
58
+ const measure = this.props.remeasureTime > 0;
59
+ const limited = this.limitTime(this.props.remeasureTime);
60
+ const marginHorizontal = Platform.OS === `ios` ? `3%` : `0%`;
61
+ const valueContainer = measure ? remeasureStyles.valueContainer : variantStyles.centeredValueContainer;
62
+ return (<View style={remeasureStyles.container}>
63
+ <View style={remeasureStyles.borderContainer}>
64
+ <View style={remeasureStyles.remeasureContainer}>
65
+ <TextBold style={remeasureStyles.remeasureLabel}>
66
+ {i18n._(t `Remind me to remeasure in`)}
67
+ </TextBold>
68
+ </View>
69
+ <View style={remeasureStyles.valueUnitContainer}>
70
+ <View style={valueContainer}>
71
+ <TextBold style={remeasureStyles.value} testID={Testing.Id.RemeasureTestIds.RemeasureHours}>
72
+ {measure ? limited : i18n._(t `OFF`)}
73
+ </TextBold>
74
+ </View>
75
+ {measure ? (<View style={remeasureStyles.unitContainer}>
76
+ <TextRegular style={remeasureStyles.units}>{i18n._(t `hours`)}</TextRegular>
77
+ </View>) : null}
58
78
  </View>
59
79
  </View>
60
-
61
- <Slider testID={RemeasureSlider} maximumTrackTintColor={colors.mistBlue} minimumTrackTintColor={colors.blue} thumbTintColor={colors.white} maximumValue={6} minimumValue={0} step={0.5} onValueChange={this.handleSliderChange} value={limited}/>
80
+ <Slider ref={(slider) => {
81
+ if (slider !== null) {
82
+ this.slider = slider;
83
+ }
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}/>
62
85
  </View>);
63
86
  }
64
87
  }
65
- const styles = StyleSheet.create({
88
+ const remeasureStyles = StyleSheet.create({
66
89
  container: {
67
90
  flexDirection: `column`,
68
- marginVertical: 32,
91
+ padding: `3%`,
69
92
  },
70
- textContainer: {
71
- flexDirection: `row`,
72
- marginBottom: 18,
93
+ borderContainer: {
94
+ ...infoStyles.borderContainer,
95
+ alignItems: `center`,
73
96
  },
74
- remeasureLabel: {
75
- ...FONTS.Poppins.regular_Base,
76
- color: colors.white,
97
+ remeasureContainer: {
77
98
  flex: 7,
78
- alignSelf: `center`,
79
99
  },
80
- offText: {
81
- ...FONTS.Poppins.bold_Base,
82
- color: colors.white,
100
+ remeasureLabel: {
101
+ color: `white`,
102
+ fontSize: Dimensions.get(`screen`).width / 28,
83
103
  },
84
104
  valueUnitContainer: {
85
- flex: 3,
86
- justifyContent: `center`,
87
- alignItems: `baseline`,
88
- flexDirection: `row`,
89
- alignSelf: `center`,
105
+ ...infoStyles.valueUnitContainer,
106
+ },
107
+ valueContainer: {
108
+ ...infoStyles.valueContainer,
90
109
  },
91
110
  value: {
92
- ...FONTS.Poppins.medium_2XL,
93
- textAlign: `right`,
94
- color: colors.white,
111
+ ...infoStyles.value,
112
+ },
113
+ unitContainer: {
114
+ ...infoStyles.unitContainer,
115
+ marginRight: `7%`,
95
116
  },
96
117
  units: {
97
- ...FONTS.Poppins.regular_XS,
98
- textAlign: `left`,
99
- paddingLeft: 4,
100
- color: colors.white,
118
+ ...infoStyles.units,
119
+ },
120
+ sliderStyle: {
121
+ marginTop: `3%`,
122
+ marginBottom: `2%`,
123
+ },
124
+ });
125
+ const variantStyles = StyleSheet.create({
126
+ centeredValueContainer: {
127
+ ...remeasureStyles.valueContainer,
128
+ alignItems: `center`,
101
129
  },
102
130
  });
103
- //# sourceMappingURL=Remeasure.js.map
@@ -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
  /**
@@ -30,5 +30,5 @@ export default class TransferToLogbook extends React.Component<IProps, IState> {
30
30
  * 2. Return a JSX element to display a touchable button (that is disabled when the pressed state is true)
31
31
  * @returns JSX element for displaying the transfer button
32
32
  */
33
- render(): JSX.Element | undefined;
33
+ render(): JSX.Element;
34
34
  }
@@ -1,15 +1,15 @@
1
1
  import React from "react";
2
- import { StyleSheet, TouchableOpacity, View } from "react-native";
3
- import { t } from "../locales/translate";
2
+ import { Dimensions, StyleSheet, TouchableOpacity, View } from "react-native";
3
+ import { t } from "@lingui/macro";
4
+ import { i18n } from "../locale/i18nUtils";
4
5
  import { Testing } from "../types/enum";
5
6
  import { colors } from "../utils/Constants";
6
- import { FONTS } from "./styles/fonts";
7
- import Text from "./Text";
7
+ import TextBold from "./text/TextBold";
8
8
  /**
9
9
  * Render a button for transferring the recommendation to a logbook entry.
10
10
  * 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.
11
11
  */
12
- export default class TransferToLogbook extends React.Component {
12
+ export default class SaveButton extends React.Component {
13
13
  /** Initialise the state pressed variable with false */
14
14
  state = {
15
15
  pressed: false,
@@ -35,34 +35,37 @@ export default class TransferToLogbook extends React.Component {
35
35
  */
36
36
  render() {
37
37
  if (!this.props.visible) {
38
- return;
38
+ return <View style={styles.marginContainer}/>;
39
39
  }
40
- return (<TouchableOpacity testID={Testing.Id.TransferToLogbookTestIds.TransferButton} onPress={this.handlePress} disabled={this.state.pressed} style={addToLogbookStyles.container}>
41
- <View style={addToLogbookStyles.textContainer}>
42
- <Text style={addToLogbookStyles.transferText}>{t(`Transfer to logbook`)}</Text>
43
- </View>
44
- </TouchableOpacity>);
40
+ return (<View style={styles.wrapper}>
41
+ <TouchableOpacity testID={Testing.Id.TransferToLogbookTestIds.TransferButton} onPress={this.handlePress} disabled={this.state.pressed} style={styles.button}>
42
+ <TextBold style={styles.text}>{i18n._(t `Save to logbook`)}</TextBold>
43
+ </TouchableOpacity>
44
+ </View>);
45
45
  }
46
46
  }
47
- const addToLogbookStyles = StyleSheet.create({
48
- container: {
49
- minWidth: 230,
50
- borderRadius: 50,
51
- backgroundColor: colors.teal,
52
- marginBottom: 32,
53
- justifyContent: `center`,
54
- alignSelf: `center`,
47
+ const { width } = Dimensions.get(`screen`);
48
+ const styles = StyleSheet.create({
49
+ marginContainer: {
50
+ marginVertical: `3%`,
55
51
  },
56
- textContainer: {
52
+ wrapper: {
57
53
  flexDirection: `row`,
58
- justifyContent: `center`,
54
+ alignSelf: `center`,
55
+ },
56
+ button: {
57
+ backgroundColor: colors.teal,
58
+ borderRadius: 40,
59
+ marginTop: width / 5,
60
+ marginBottom: width / 18,
59
61
  },
60
- transferText: {
61
- ...FONTS.Poppins.bold_Base,
62
- color: colors.black,
63
- paddingVertical: 12,
64
- paddingHorizontal: 16,
62
+ text: {
63
+ fontFamily: `Poppins-Bold`,
64
+ paddingVertical: width / 26,
65
+ paddingHorizontal: width / 10,
65
66
  textAlign: `center`,
67
+ color: colors.semiDarkBlue,
68
+ fontSize: width / 22,
69
+ lineHeight: width / 16,
66
70
  },
67
71
  });
68
- //# sourceMappingURL=TransferToLogbook.js.map
@@ -0,0 +1,136 @@
1
+ import * as React from "react";
2
+ export interface ITwoOptionModalProps {
3
+ /** The title of the modal. */
4
+ title: string;
5
+ /** The message to show in the modal. */
6
+ message: string;
7
+ /** The label of the first option. */
8
+ textFirstOption: string;
9
+ /** The label of the second option. */
10
+ textSecondOption: string;
11
+ /** Whether or not the modal shall have a cancel button in the corner to close the modal. */
12
+ isCancelable?: boolean;
13
+ /** If true the buttons will be displayed side-by-side. If false the buttons will be displayed on top of each other. */
14
+ rowAsButtonLayout: boolean;
15
+ /** To be called if the user taps the first option button. */
16
+ firstOption(): void;
17
+ /** To be called if the user taps the second option button. */
18
+ secondOption(): void;
19
+ /** To be called if the user taps the optionally shown close button. */
20
+ onClose?(): void;
21
+ }
22
+ /** Display a modal with two buttons for the user to choose between. */
23
+ export default class TwoOptionModal extends React.Component<ITwoOptionModalProps> {
24
+ /** Compose a JSX element for displaying the modal. */
25
+ render(): JSX.Element;
26
+ }
27
+ /** @internal */
28
+ export declare const modalStyle: {
29
+ container: {
30
+ justifyContent: "center";
31
+ backgroundColor: string;
32
+ height: number;
33
+ position: "absolute";
34
+ left: 0;
35
+ right: 0;
36
+ top: 0;
37
+ bottom: 0;
38
+ };
39
+ modalContainer: {
40
+ margin: string;
41
+ backgroundColor: string;
42
+ borderRadius: number;
43
+ };
44
+ iconWrapper: {
45
+ alignSelf: "flex-end";
46
+ marginRight: string;
47
+ marginTop: string;
48
+ };
49
+ icon: {
50
+ color: string;
51
+ fontSize: number;
52
+ };
53
+ textContainer: {
54
+ marginHorizontal: string;
55
+ marginBottom: string;
56
+ marginTop: string;
57
+ alignSelf: "flex-start";
58
+ };
59
+ textContainerNotCancelable: {
60
+ marginHorizontal: string;
61
+ marginVertical: string;
62
+ alignSelf: "flex-start";
63
+ };
64
+ titleRowLayout: {
65
+ color: string;
66
+ fontSize: number;
67
+ textAlign: "center";
68
+ marginBottom: string;
69
+ };
70
+ titleColumnLayout: {
71
+ color: string;
72
+ fontSize: number;
73
+ textAlign: "center";
74
+ marginBottom: string;
75
+ };
76
+ message: {
77
+ color: string;
78
+ fontSize: number;
79
+ textAlign: "center";
80
+ };
81
+ buttonContainerRow: {
82
+ flexDirection: "row";
83
+ justifyContent: "space-around";
84
+ marginHorizontal: string;
85
+ marginVertical: string;
86
+ };
87
+ buttonContainerColumn: {
88
+ flexDirection: "column";
89
+ justifyContent: "space-around";
90
+ margin: string;
91
+ };
92
+ buttonRow: {
93
+ height: number;
94
+ marginTop: number;
95
+ borderRadius: number;
96
+ borderWidth: number;
97
+ borderColor: string;
98
+ width: number;
99
+ alignSelf: "center";
100
+ justifyContent: "center";
101
+ };
102
+ firstButtonColumn: {
103
+ height: number;
104
+ width: number;
105
+ marginTop: number;
106
+ backgroundColor: string;
107
+ borderRadius: number;
108
+ borderWidth: number;
109
+ borderColor: string;
110
+ alignSelf: "center";
111
+ justifyContent: "center";
112
+ };
113
+ secondButtonColumn: {
114
+ alignSelf: "center";
115
+ justifyContent: "center";
116
+ height: number;
117
+ width: number;
118
+ marginTop: string;
119
+ };
120
+ textButtonRow: {
121
+ textAlign: "center";
122
+ fontSize: number;
123
+ color: string;
124
+ };
125
+ textFirstButtonColumn: {
126
+ textAlign: "center";
127
+ fontSize: number;
128
+ paddingHorizontal: number;
129
+ color: string;
130
+ };
131
+ textSecondButtonColumn: {
132
+ textAlign: "center";
133
+ fontSize: number;
134
+ color: string;
135
+ };
136
+ };