@hedia/recommendation-screen 2.1.3-beta.6 → 2.1.3

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 (88) hide show
  1. package/coverage/clover.xml +29 -29
  2. package/coverage/coverage-final.json +27 -27
  3. package/coverage/lcov-report/index.html +1 -1
  4. package/coverage/lcov-report/src/RecommendationScreen.tsx.html +1 -1
  5. package/coverage/lcov-report/src/__tests__/index.html +1 -1
  6. package/coverage/lcov-report/src/__tests__/utils.tsx.html +1 -1
  7. package/coverage/lcov-report/src/components/Header.tsx.html +1 -1
  8. package/coverage/lcov-report/src/components/InfoBars.tsx.html +1 -1
  9. package/coverage/lcov-report/src/components/InvisibleNumberInput.tsx.html +1 -1
  10. package/coverage/lcov-report/src/components/LimitationMessage.tsx.html +1 -1
  11. package/coverage/lcov-report/src/components/LineSeparator.tsx.html +1 -1
  12. package/coverage/lcov-report/src/components/RecentInsulin.tsx.html +1 -1
  13. package/coverage/lcov-report/src/components/RecommendationModal.tsx.html +1 -1
  14. package/coverage/lcov-report/src/components/RecommendedCarbs.tsx.html +1 -1
  15. package/coverage/lcov-report/src/components/RecommendedInsulin.tsx.html +1 -1
  16. package/coverage/lcov-report/src/components/Remeasure.tsx.html +1 -1
  17. package/coverage/lcov-report/src/components/TransferToLogbook.tsx.html +1 -1
  18. package/coverage/lcov-report/src/components/TwoOptionModal.tsx.html +1 -1
  19. package/coverage/lcov-report/src/components/activity/Activity.tsx.html +1 -1
  20. package/coverage/lcov-report/src/components/activity/ActivityIcon.tsx.html +1 -1
  21. package/coverage/lcov-report/src/components/activity/ActivityIntensity.tsx.html +1 -1
  22. package/coverage/lcov-report/src/components/activity/index.html +1 -1
  23. package/coverage/lcov-report/src/components/index.html +1 -1
  24. package/coverage/lcov-report/src/components/mood/Emotion.tsx.html +1 -1
  25. package/coverage/lcov-report/src/components/mood/MoodIcon.tsx.html +1 -1
  26. package/coverage/lcov-report/src/components/mood/index.html +1 -1
  27. package/coverage/lcov-report/src/index.html +1 -1
  28. package/coverage/lcov-report/src/locale/i18nUtils.ts.html +1 -1
  29. package/coverage/lcov-report/src/locale/index.html +1 -1
  30. package/coverage/lcov-report/src/utils/AttentionMessages.tsx.html +1 -1
  31. package/coverage/lcov-report/src/utils/Constants.ts.html +1 -1
  32. package/coverage/lcov-report/src/utils/RecommendationError.tsx.html +1 -1
  33. package/coverage/lcov-report/src/utils/RecommendationUtils.ts.html +1 -1
  34. package/coverage/lcov-report/src/utils/Translations.ts.html +1 -1
  35. package/coverage/lcov-report/src/utils/Utils.ts.html +1 -1
  36. package/coverage/lcov-report/src/utils/Validations.ts.html +1 -1
  37. package/coverage/lcov-report/src/utils/index.html +1 -1
  38. package/index.js +5 -31
  39. package/package.json +1 -1
  40. package/src/RecommendationScreen.js +76 -101
  41. package/src/__tests__/RecommendationScreen.test.js +404 -409
  42. package/src/__tests__/RecommendationUtils.test.js +117 -119
  43. package/src/__tests__/Translate.test.js +14 -16
  44. package/src/__tests__/Utils.test.js +16 -18
  45. package/src/__tests__/Validations.test.js +30 -51
  46. package/src/__tests__/components/Activity.test.js +51 -56
  47. package/src/__tests__/components/Emotion.test.js +28 -33
  48. package/src/__tests__/components/Header.test.js +24 -29
  49. package/src/__tests__/components/InfoBars.test.js +59 -64
  50. package/src/__tests__/components/InvisibleNumberInput.test.js +22 -27
  51. package/src/__tests__/components/LimitationMessage.test.js +28 -33
  52. package/src/__tests__/components/MoodIcon.test.js +9 -14
  53. package/src/__tests__/components/RecommendationModal.test.js +56 -61
  54. package/src/__tests__/components/RecommendedCarbs.test.js +58 -63
  55. package/src/__tests__/components/RecommendedInsulin.test.js +60 -65
  56. package/src/__tests__/components/Remeasure.test.js +32 -37
  57. package/src/__tests__/components/TransferToLogbook.test.js +15 -20
  58. package/src/__tests__/components/TwoOptionModal.test.js +22 -27
  59. package/src/__tests__/utils.js +22 -38
  60. package/src/components/Header.js +34 -41
  61. package/src/components/Icon.js +2 -8
  62. package/src/components/InfoBars.js +36 -43
  63. package/src/components/InvisibleNumberInput.js +5 -11
  64. package/src/components/LimitationMessage.js +18 -40
  65. package/src/components/LineSeparator.js +7 -13
  66. package/src/components/RecentInsulin.js +33 -39
  67. package/src/components/RecommendationModal.js +59 -85
  68. package/src/components/RecommendedCarbs.js +93 -99
  69. package/src/components/RecommendedInsulin.js +46 -52
  70. package/src/components/Remeasure.js +36 -42
  71. package/src/components/TransferToLogbook.js +20 -26
  72. package/src/components/TwoOptionModal.js +39 -65
  73. package/src/components/activity/Activity.js +42 -48
  74. package/src/components/activity/ActivityIcon.js +15 -21
  75. package/src/components/activity/ActivityIntensity.js +19 -25
  76. package/src/components/mood/Emotion.js +17 -23
  77. package/src/components/mood/MoodIcon.js +11 -17
  78. package/src/locale/i18nUtils.js +17 -24
  79. package/src/types/enum.js +28 -31
  80. package/src/types/types.js +1 -2
  81. package/src/utils/AttentionMessages.js +24 -32
  82. package/src/utils/Constants.js +23 -26
  83. package/src/utils/RecommendationError.js +28 -54
  84. package/src/utils/RecommendationUtils.js +60 -72
  85. package/src/utils/Translations.js +6 -9
  86. package/src/utils/Utils.js +8 -12
  87. package/src/utils/Validations.js +77 -107
  88. package/tsconfig.json +3 -3
@@ -1,37 +1,12 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- var __importDefault = (this && this.__importDefault) || function (mod) {
22
- return (mod && mod.__esModule) ? mod : { "default": mod };
23
- };
24
- Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.stylesModal = void 0;
26
- const macro_1 = require("@lingui/macro");
27
- const React = __importStar(require("react"));
28
- const react_native_1 = require("react-native");
29
- const react_native_modal_1 = __importDefault(require("react-native-modal"));
30
- const i18nUtils_1 = require("../locale/i18nUtils");
31
- const enum_1 = require("../types/enum");
32
- const Constants_1 = require("../utils/Constants");
33
- const LimitationMessage_1 = __importDefault(require("./LimitationMessage"));
34
- class RecommendationModal extends React.Component {
1
+ import { t } from "@lingui/macro";
2
+ import * as React from "react";
3
+ import { Dimensions, StyleSheet, Text, TouchableOpacity, View } from "react-native";
4
+ import ReactNativeModal from "react-native-modal";
5
+ import { i18n } from "../locale/i18nUtils";
6
+ import { RecommendationModalTestIds } from "../types/enum";
7
+ import { BORDER_COLOUR_TEAL } from "../utils/Constants";
8
+ import LimitationMessage from "./LimitationMessage";
9
+ export default class RecommendationModal extends React.Component {
35
10
  constructor(props) {
36
11
  super(props);
37
12
  this.onPressNextButton = () => {
@@ -40,63 +15,63 @@ class RecommendationModal extends React.Component {
40
15
  return isPageVisible ? this.setState({ firstPageVisible: false }) : this.props.onClickOkButton();
41
16
  };
42
17
  this.recommendationButtons = () => {
43
- return (<react_native_1.View style={exports.stylesModal.recommendationButtonsContainer}>
44
- <react_native_1.TouchableOpacity testID={enum_1.RecommendationModalTestIds.AcceptCarbs} accessibilityLabel="yesButtonModal" style={exports.stylesModal.affirmativeCarbsButton} onPress={this.props.onAcceptCarbohydrates}>
45
- <react_native_1.Text style={exports.stylesModal.affirmativeCarbsText}>{i18nUtils_1.i18n._(macro_1.t `OK`)}</react_native_1.Text>
46
- </react_native_1.TouchableOpacity>
47
- <react_native_1.TouchableOpacity testID={enum_1.RecommendationModalTestIds.DeclineCarbs} accessibilityLabel="noButtonModal" style={exports.stylesModal.negativeCarbsButton} onPress={this.props.onDeclineCarbohydrates}>
48
- <react_native_1.Text style={exports.stylesModal.negativeCarbsText}>{i18nUtils_1.i18n._(macro_1.t `NO`)}</react_native_1.Text>
49
- </react_native_1.TouchableOpacity>
50
- </react_native_1.View>);
18
+ return (<View style={stylesModal.recommendationButtonsContainer}>
19
+ <TouchableOpacity testID={RecommendationModalTestIds.AcceptCarbs} accessibilityLabel="yesButtonModal" style={stylesModal.affirmativeCarbsButton} onPress={this.props.onAcceptCarbohydrates}>
20
+ <Text style={stylesModal.affirmativeCarbsText}>{i18n._(t `OK`)}</Text>
21
+ </TouchableOpacity>
22
+ <TouchableOpacity testID={RecommendationModalTestIds.DeclineCarbs} accessibilityLabel="noButtonModal" style={stylesModal.negativeCarbsButton} onPress={this.props.onDeclineCarbohydrates}>
23
+ <Text style={stylesModal.negativeCarbsText}>{i18n._(t `NO`)}</Text>
24
+ </TouchableOpacity>
25
+ </View>);
51
26
  };
52
27
  this.recommendCarbohydrates = (suggestedCarbohydrates) => {
53
28
  const displayCarbs = Math.round(suggestedCarbohydrates);
54
29
  return (<React.Fragment>
55
- <react_native_1.View style={exports.stylesModal.innerView}>
56
- <react_native_1.View style={exports.stylesModal.recommendationRow}>
57
- <react_native_1.Text style={exports.stylesModal.recommendEatingText}>
58
- {i18nUtils_1.i18n._(macro_1.t `We recommend eating an additional:`)}
59
- </react_native_1.Text>
60
- </react_native_1.View>
61
- <react_native_1.View style={exports.stylesModal.suggestedContainer}>
62
- <react_native_1.Text style={exports.stylesModal.textCenter}>
63
- <react_native_1.Text style={exports.stylesModal.suggestedCarbs} testID={enum_1.RecommendationModalTestIds.SuggestedCarbs}>{`${displayCarbs} `}</react_native_1.Text>
64
- <react_native_1.Text style={exports.stylesModal.carbohydrateText}>{i18nUtils_1.i18n._(macro_1.t `grams of carbohydrates`)}</react_native_1.Text>
65
- </react_native_1.Text>
66
- </react_native_1.View>
67
- <react_native_1.View style={exports.stylesModal.recommendationRow}>
68
- <react_native_1.Text style={exports.stylesModal.recommendEatingText}>{i18nUtils_1.i18n._(macro_1.t `Instead of taking insulin`)}</react_native_1.Text>
69
- </react_native_1.View>
70
- </react_native_1.View>
71
- <react_native_1.View style={exports.stylesModal.addToCalculationContainer}>
72
- <react_native_1.Text style={exports.stylesModal.addToCalculation}>
73
- {i18nUtils_1.i18n._(macro_1.t `Would you like to add this to your current calculation?`)}
74
- </react_native_1.Text>
30
+ <View style={stylesModal.innerView}>
31
+ <View style={stylesModal.recommendationRow}>
32
+ <Text style={stylesModal.recommendEatingText}>
33
+ {i18n._(t `We recommend eating an additional:`)}
34
+ </Text>
35
+ </View>
36
+ <View style={stylesModal.suggestedContainer}>
37
+ <Text style={stylesModal.textCenter}>
38
+ <Text style={stylesModal.suggestedCarbs} testID={RecommendationModalTestIds.SuggestedCarbs}>{`${displayCarbs} `}</Text>
39
+ <Text style={stylesModal.carbohydrateText}>{i18n._(t `grams of carbohydrates`)}</Text>
40
+ </Text>
41
+ </View>
42
+ <View style={stylesModal.recommendationRow}>
43
+ <Text style={stylesModal.recommendEatingText}>{i18n._(t `Instead of taking insulin`)}</Text>
44
+ </View>
45
+ </View>
46
+ <View style={stylesModal.addToCalculationContainer}>
47
+ <Text style={stylesModal.addToCalculation}>
48
+ {i18n._(t `Would you like to add this to your current calculation?`)}
49
+ </Text>
75
50
  {this.recommendationButtons()}
76
- </react_native_1.View>
51
+ </View>
77
52
  </React.Fragment>);
78
53
  };
79
54
  this.secondPage = () => {
80
55
  const { attentionMessage, suggestedCarbohydrates } = this.props;
81
56
  const willRecommendCarbs = suggestedCarbohydrates !== null && suggestedCarbohydrates > 0;
82
57
  return (<React.Fragment>
83
- <react_native_1.View style={exports.stylesModal.container}>
84
- <react_native_1.View style={exports.stylesModal.titleContainer}>
85
- <react_native_1.Text style={exports.stylesModal.textTittleMessage}>{i18nUtils_1.i18n._(macro_1.t `Attention`)}</react_native_1.Text>
86
- </react_native_1.View>
87
- <react_native_1.Text style={exports.stylesModal.textMessage}>{attentionMessage}</react_native_1.Text>
58
+ <View style={stylesModal.container}>
59
+ <View style={stylesModal.titleContainer}>
60
+ <Text style={stylesModal.textTittleMessage}>{i18n._(t `Attention`)}</Text>
61
+ </View>
62
+ <Text style={stylesModal.textMessage}>{attentionMessage}</Text>
88
63
  {willRecommendCarbs ? this.recommendCarbohydrates(suggestedCarbohydrates) : null}
89
- </react_native_1.View>
90
- {willRecommendCarbs ? null : (<react_native_1.View style={exports.stylesModal.containerAcceptButton}>
91
- <react_native_1.TouchableOpacity testID={enum_1.RecommendationModalTestIds.OkButton} accessibilityLabel="okayButtonModal" style={exports.stylesModal.okButton} onPress={this.props.onClickOkButton}>
92
- <react_native_1.Text style={exports.stylesModal.buttonText}>{i18nUtils_1.i18n._(macro_1.t `OK`)}</react_native_1.Text>
93
- </react_native_1.TouchableOpacity>
94
- </react_native_1.View>)}
64
+ </View>
65
+ {willRecommendCarbs ? null : (<View style={stylesModal.containerAcceptButton}>
66
+ <TouchableOpacity testID={RecommendationModalTestIds.OkButton} accessibilityLabel="okayButtonModal" style={stylesModal.okButton} onPress={this.props.onClickOkButton}>
67
+ <Text style={stylesModal.buttonText}>{i18n._(t `OK`)}</Text>
68
+ </TouchableOpacity>
69
+ </View>)}
95
70
  </React.Fragment>);
96
71
  };
97
72
  this.firstPage = () => {
98
73
  const { limitationMessage } = this.props;
99
- return <LimitationMessage_1.default limitationMessage={limitationMessage} onPressNextButton={this.onPressNextButton}/>;
74
+ return <LimitationMessage limitationMessage={limitationMessage} onPressNextButton={this.onPressNextButton}/>;
100
75
  };
101
76
  this.state = {
102
77
  firstPageVisible: !!this.props.limitationMessage,
@@ -105,13 +80,12 @@ class RecommendationModal extends React.Component {
105
80
  render() {
106
81
  const { isVisible } = this.props;
107
82
  const { firstPageVisible } = this.state;
108
- return (<react_native_modal_1.default isVisible={isVisible} style={exports.stylesModal.modalStyle}>
83
+ return (<ReactNativeModal isVisible={isVisible} style={stylesModal.modalStyle}>
109
84
  {firstPageVisible ? this.firstPage() : this.secondPage()}
110
- </react_native_modal_1.default>);
85
+ </ReactNativeModal>);
111
86
  }
112
87
  }
113
- exports.default = RecommendationModal;
114
- const { height, width } = react_native_1.Dimensions.get(`screen`);
88
+ const { height, width } = Dimensions.get(`screen`);
115
89
  const buttonHeight = height / 20;
116
90
  const buttonWidth = width / 2.5;
117
91
  const buttonFontSize = width / 22;
@@ -121,7 +95,7 @@ const sugestionFontSize = width / 19;
121
95
  const recommendEatingFontSize = height / 45;
122
96
  const textFontSize = width / 20;
123
97
  const titleFontSize = width / 13;
124
- exports.stylesModal = react_native_1.StyleSheet.create({
98
+ export const stylesModal = StyleSheet.create({
125
99
  modalStyle: { margin: 0 },
126
100
  container: {
127
101
  flex: 4,
@@ -138,7 +112,7 @@ exports.stylesModal = react_native_1.StyleSheet.create({
138
112
  recommendationRow: { justifyContent: `center`, alignContent: `center`, marginBottom: `3%` },
139
113
  textTittleMessage: { color: `white`, fontSize: titleFontSize, textAlign: `center` },
140
114
  textMessage: { color: `white`, fontSize: textFontSize, textAlign: `center` },
141
- buttonText: { color: Constants_1.BORDER_COLOUR_TEAL, fontSize: buttonFontSize, textAlign: `center` },
115
+ buttonText: { color: BORDER_COLOUR_TEAL, fontSize: buttonFontSize, textAlign: `center` },
142
116
  addToCalculationContainer: { justifyContent: `flex-start`, marginVertical: `5%` },
143
117
  innerView: {
144
118
  alignContent: `center`,
@@ -147,7 +121,7 @@ exports.stylesModal = react_native_1.StyleSheet.create({
147
121
  marginTop: `5%`,
148
122
  borderRadius: height / 80,
149
123
  borderWidth: height / 300,
150
- borderColor: Constants_1.BORDER_COLOUR_TEAL,
124
+ borderColor: BORDER_COLOUR_TEAL,
151
125
  },
152
126
  suggestedContainer: { justifyContent: `center`, flexDirection: `row`, marginBottom: `3%` },
153
127
  suggestedCarbs: { color: `white`, fontSize: sugestionFontSize, fontWeight: `bold` },
@@ -156,13 +130,13 @@ exports.stylesModal = react_native_1.StyleSheet.create({
156
130
  carbohydrateText: { color: `white`, fontSize: sugestionFontSize },
157
131
  addToCalculation: { color: `white`, fontSize: textFontSize, textAlign: `center` },
158
132
  recommendationButtonsContainer: { justifyContent: `center`, flexDirection: `row`, margin: `3%` },
159
- affirmativeCarbsText: { color: Constants_1.BORDER_COLOUR_TEAL, fontSize: buttonFontSize, textAlign: `center` },
133
+ affirmativeCarbsText: { color: BORDER_COLOUR_TEAL, fontSize: buttonFontSize, textAlign: `center` },
160
134
  negativeCarbsText: { color: `white`, fontSize: buttonFontSize, textAlign: `center` },
161
135
  affirmativeCarbsButton: {
162
136
  marginTop: `2%`,
163
137
  borderRadius: buttonBorderRadius,
164
138
  borderWidth: buttonBorderWidth,
165
- borderColor: Constants_1.BORDER_COLOUR_TEAL,
139
+ borderColor: BORDER_COLOUR_TEAL,
166
140
  width: buttonWidth,
167
141
  height: buttonHeight,
168
142
  alignSelf: `center`,
@@ -184,7 +158,7 @@ exports.stylesModal = react_native_1.StyleSheet.create({
184
158
  marginTop: `6%`,
185
159
  borderRadius: buttonBorderRadius,
186
160
  borderWidth: buttonBorderWidth,
187
- borderColor: Constants_1.BORDER_COLOUR_TEAL,
161
+ borderColor: BORDER_COLOUR_TEAL,
188
162
  width: buttonWidth,
189
163
  height: buttonHeight,
190
164
  alignSelf: `center`,
@@ -1,20 +1,15 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const macro_1 = require("@lingui/macro");
7
- const react_1 = __importDefault(require("react"));
8
- const react_native_1 = require("react-native");
9
- const i18nUtils_1 = require("../locale/i18nUtils");
10
- const enum_1 = require("../types/enum");
11
- const Constants_1 = require("../utils/Constants");
12
- const RecommendationError_1 = require("../utils/RecommendationError");
13
- const Icon_1 = __importDefault(require("./Icon"));
14
- const InfoBars_1 = require("./InfoBars");
15
- const InvisibleNumberInput_1 = __importDefault(require("./InvisibleNumberInput"));
16
- const LineSeparator_1 = __importDefault(require("./LineSeparator"));
17
- class RecommendedCarbs extends react_1.default.Component {
1
+ import { t } from "@lingui/macro";
2
+ import React from "react";
3
+ import { Alert, Dimensions, StyleSheet, Text, TouchableOpacity, View } from "react-native";
4
+ import { i18n } from "../locale/i18nUtils";
5
+ import { RecommendedCarbsTestIds } from "../types/enum";
6
+ import { BORDER_COLOUR_GREY, BORDER_COLOUR_TEAL } from "../utils/Constants";
7
+ import { CarbohydrateLimitError } from "../utils/RecommendationError";
8
+ import Icon from "./Icon";
9
+ import { infoStyles } from "./InfoBars";
10
+ import InvisibleNumberInput from "./InvisibleNumberInput";
11
+ import LineSeparator from "./LineSeparator";
12
+ export default class RecommendedCarbs extends React.Component {
18
13
  constructor() {
19
14
  super(...arguments);
20
15
  this.state = {
@@ -32,9 +27,9 @@ class RecommendedCarbs extends react_1.default.Component {
32
27
  if (carbs >= 0) {
33
28
  if (carbs > 300) {
34
29
  this.setState({ partialInput: this.props.recommendedCarbs });
35
- return react_native_1.Alert.alert(i18nUtils_1.i18n._(macro_1.t `Attention`), RecommendationError_1.CarbohydrateLimitError().message, [
30
+ return Alert.alert(i18n._(t `Attention`), CarbohydrateLimitError().message, [
36
31
  {
37
- text: i18nUtils_1.i18n._(macro_1.t `OK`),
32
+ text: i18n._(t `OK`),
38
33
  },
39
34
  ]);
40
35
  }
@@ -44,96 +39,95 @@ class RecommendedCarbs extends react_1.default.Component {
44
39
  this.renderRecommendedCarbs = () => {
45
40
  const shownCarbs = this.state.partialInput ?? Math.round(Number(this.props.recommendedCarbs));
46
41
  const totalCarbs = Math.round(parseFloat(this.props.enteredCarbs) + Number(shownCarbs));
47
- return (<react_1.default.Fragment>
48
- <LineSeparator_1.default color={Constants_1.BORDER_COLOUR_GREY}/>
49
- <react_native_1.View style={calculationStyles.borderContainer}>
50
- <react_native_1.View style={calculationStyles.recommendedContainer}>
51
- <react_native_1.TouchableOpacity testID={enum_1.RecommendedCarbsTestIds.RemoveRecommendation} accessibilityLabel="removeRecommendedCarbs" style={calculationStyles.removeRecommended} onPress={this.props.removeRecommendedCarbs}>
52
- <Icon_1.default iconIdentifier={`Ionicons/ios-close-circle-outline`} style={calculationStyles.removeRecommendedIcon}/>
53
- </react_native_1.TouchableOpacity>
54
- <react_native_1.Text style={calculationStyles.recommendedLabel}>{i18nUtils_1.i18n._(macro_1.t `Recommended`)}</react_native_1.Text>
55
- </react_native_1.View>
56
- </react_native_1.View>
57
- <react_native_1.View style={calculationStyles.borderContainer}>
58
- <react_native_1.View style={calculationStyles.recommendedContainer}>
59
- <react_native_1.Text style={calculationStyles.recommendedLabel}>{i18nUtils_1.i18n._(macro_1.t `Additional`)}</react_native_1.Text>
60
- </react_native_1.View>
61
- <react_native_1.View style={calculationStyles.valueUnitContainer}>
62
- <react_native_1.TouchableOpacity testID={enum_1.RecommendedCarbsTestIds.EditRecommendedCarbs} accessibilityLabel="editRecommendedCarbsButton" onPress={this.showTextInput} style={[calculationStyles.valueUnitContainer]}>
63
- <react_native_1.View style={calculationStyles.valueContainer}>
64
- <react_native_1.Text testID={enum_1.RecommendedCarbsTestIds.RecommendedCarbs} style={[calculationStyles.value, { color: Constants_1.BORDER_COLOUR_TEAL }]}>
42
+ return (<React.Fragment>
43
+ <LineSeparator color={BORDER_COLOUR_GREY}/>
44
+ <View style={calculationStyles.borderContainer}>
45
+ <View style={calculationStyles.recommendedContainer}>
46
+ <TouchableOpacity testID={RecommendedCarbsTestIds.RemoveRecommendation} accessibilityLabel="removeRecommendedCarbs" style={calculationStyles.removeRecommended} onPress={this.props.removeRecommendedCarbs}>
47
+ <Icon iconIdentifier={`Ionicons/ios-close-circle-outline`} style={calculationStyles.removeRecommendedIcon}/>
48
+ </TouchableOpacity>
49
+ <Text style={calculationStyles.recommendedLabel}>{i18n._(t `Recommended`)}</Text>
50
+ </View>
51
+ </View>
52
+ <View style={calculationStyles.borderContainer}>
53
+ <View style={calculationStyles.recommendedContainer}>
54
+ <Text style={calculationStyles.recommendedLabel}>{i18n._(t `Additional`)}</Text>
55
+ </View>
56
+ <View style={calculationStyles.valueUnitContainer}>
57
+ <TouchableOpacity testID={RecommendedCarbsTestIds.EditRecommendedCarbs} accessibilityLabel="editRecommendedCarbsButton" onPress={this.showTextInput} style={[calculationStyles.valueUnitContainer]}>
58
+ <View style={calculationStyles.valueContainer}>
59
+ <Text testID={RecommendedCarbsTestIds.RecommendedCarbs} style={[calculationStyles.value, { color: BORDER_COLOUR_TEAL }]}>
65
60
  {shownCarbs}
66
- </react_native_1.Text>
67
- </react_native_1.View>
68
- <react_native_1.View style={[calculationStyles.unitContainer]}>
69
- <react_native_1.View style={calculationStyles.editIconContainer}>
70
- <Icon_1.default style={calculationStyles.editIcon} iconIdentifier={`Feather/edit`}/>
71
- </react_native_1.View>
72
- <react_native_1.Text style={[calculationStyles.units, { color: Constants_1.BORDER_COLOUR_TEAL }]}>
73
- {i18nUtils_1.i18n._(macro_1.t `grams`)}
74
- </react_native_1.Text>
75
- </react_native_1.View>
76
- </react_native_1.TouchableOpacity>
77
- </react_native_1.View>
78
- </react_native_1.View>
79
- <LineSeparator_1.default color={Constants_1.BORDER_COLOUR_TEAL}/>
61
+ </Text>
62
+ </View>
63
+ <View style={[calculationStyles.unitContainer]}>
64
+ <View style={calculationStyles.editIconContainer}>
65
+ <Icon style={calculationStyles.editIcon} iconIdentifier={`Feather/edit`}/>
66
+ </View>
67
+ <Text style={[calculationStyles.units, { color: BORDER_COLOUR_TEAL }]}>
68
+ {i18n._(t `grams`)}
69
+ </Text>
70
+ </View>
71
+ </TouchableOpacity>
72
+ </View>
73
+ </View>
74
+ <LineSeparator color={BORDER_COLOUR_TEAL}/>
80
75
  {this.renderRow({
81
- label: i18nUtils_1.i18n._(macro_1.t `Total`),
76
+ label: i18n._(t `Total`),
82
77
  value: totalCarbs.toString(),
83
- units: i18nUtils_1.i18n._(macro_1.t `grams`),
84
- }, enum_1.RecommendedCarbsTestIds.TotalCarbs)}
85
- <InvisibleNumberInput_1.default testID={enum_1.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}/>
86
- </react_1.default.Fragment>);
78
+ units: i18n._(t `grams`),
79
+ }, RecommendedCarbsTestIds.TotalCarbs)}
80
+ <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}/>
81
+ </React.Fragment>);
87
82
  };
88
83
  this.renderRow = (row, testID) => {
89
- return (<react_native_1.View style={[calculationStyles.borderContainer, { paddingVertical: `1%` }]}>
90
- <react_native_1.View style={calculationStyles.rowContainer}>
91
- <react_native_1.Text style={calculationStyles.rowLabel}>{row.label}</react_native_1.Text>
92
- </react_native_1.View>
93
- <react_native_1.View style={calculationStyles.valueUnitContainer}>
94
- <react_native_1.View style={calculationStyles.valueContainer}>
95
- <react_native_1.Text testID={testID} style={calculationStyles.value}>
84
+ return (<View style={[calculationStyles.borderContainer, { paddingVertical: `1%` }]}>
85
+ <View style={calculationStyles.rowContainer}>
86
+ <Text style={calculationStyles.rowLabel}>{row.label}</Text>
87
+ </View>
88
+ <View style={calculationStyles.valueUnitContainer}>
89
+ <View style={calculationStyles.valueContainer}>
90
+ <Text testID={testID} style={calculationStyles.value}>
96
91
  {row.value}
97
- </react_native_1.Text>
98
- </react_native_1.View>
99
- <react_native_1.View style={calculationStyles.unitContainer}>
100
- <react_native_1.Text style={calculationStyles.units}>{row.units}</react_native_1.Text>
101
- </react_native_1.View>
102
- </react_native_1.View>
103
- </react_native_1.View>);
92
+ </Text>
93
+ </View>
94
+ <View style={calculationStyles.unitContainer}>
95
+ <Text style={calculationStyles.units}>{row.units}</Text>
96
+ </View>
97
+ </View>
98
+ </View>);
104
99
  };
105
100
  }
106
101
  render() {
107
102
  const carbs = Number(this.props.recommendedCarbs);
108
- return (<react_1.default.Fragment>
109
- <react_native_1.View style={calculationStyles.foodTitleContainer}>
110
- <react_native_1.Text style={InfoBars_1.infoStyles.label}>{i18nUtils_1.i18n._(macro_1.t `Food`)}</react_native_1.Text>
111
- <react_native_1.Text style={calculationStyles.foodUnitsLabel}>{`(${i18nUtils_1.i18n._(macro_1.t `Carbohydrates`)})`}</react_native_1.Text>
112
- </react_native_1.View>
103
+ return (<React.Fragment>
104
+ <View style={calculationStyles.foodTitleContainer}>
105
+ <Text style={infoStyles.label}>{i18n._(t `Food`)}</Text>
106
+ <Text style={calculationStyles.foodUnitsLabel}>{`(${i18n._(t `Carbohydrates`)})`}</Text>
107
+ </View>
113
108
  {this.renderRow({
114
- label: i18nUtils_1.i18n._(macro_1.t `Entered`),
109
+ label: i18n._(t `Entered`),
115
110
  value: this.props.enteredCarbs,
116
- units: i18nUtils_1.i18n._(macro_1.t `grams`),
117
- }, enum_1.RecommendedCarbsTestIds.EnteredCarbs)}
111
+ units: i18n._(t `grams`),
112
+ }, RecommendedCarbsTestIds.EnteredCarbs)}
118
113
  {!isNaN(carbs) && carbs > 0 ? this.renderRecommendedCarbs() : null}
119
- </react_1.default.Fragment>);
114
+ </React.Fragment>);
120
115
  }
121
116
  }
122
- exports.default = RecommendedCarbs;
123
- const calculationStyles = react_native_1.StyleSheet.create({
117
+ const calculationStyles = StyleSheet.create({
124
118
  borderContainer: {
125
- ...InfoBars_1.infoStyles.borderContainer,
119
+ ...infoStyles.borderContainer,
126
120
  alignItems: `center`,
127
121
  },
128
122
  foodTitleContainer: {
129
- flex: InfoBars_1.infoStyles.borderContainer.flex,
130
- flexDirection: InfoBars_1.infoStyles.borderContainer.flexDirection,
131
- paddingHorizontal: InfoBars_1.infoStyles.borderContainer.paddingHorizontal,
123
+ flex: infoStyles.borderContainer.flex,
124
+ flexDirection: infoStyles.borderContainer.flexDirection,
125
+ paddingHorizontal: infoStyles.borderContainer.paddingHorizontal,
132
126
  alignItems: `center`,
133
127
  paddingVertical: `2%`,
134
128
  },
135
129
  foodUnitsLabel: {
136
- ...InfoBars_1.infoStyles.units,
130
+ ...infoStyles.units,
137
131
  color: `rgba(160, 180, 240, 1)`,
138
132
  paddingLeft: `1%`,
139
133
  },
@@ -142,7 +136,7 @@ const calculationStyles = react_native_1.StyleSheet.create({
142
136
  },
143
137
  rowLabel: {
144
138
  color: `white`,
145
- fontSize: react_native_1.Dimensions.get(`screen`).width / 25,
139
+ fontSize: Dimensions.get(`screen`).width / 25,
146
140
  fontWeight: `bold`,
147
141
  },
148
142
  enteredContainer: {
@@ -151,22 +145,22 @@ const calculationStyles = react_native_1.StyleSheet.create({
151
145
  },
152
146
  entered: {
153
147
  color: `white`,
154
- fontSize: react_native_1.Dimensions.get(`screen`).width / 23,
148
+ fontSize: Dimensions.get(`screen`).width / 23,
155
149
  },
156
150
  valueUnitContainer: {
157
- ...InfoBars_1.infoStyles.valueUnitContainer,
151
+ ...infoStyles.valueUnitContainer,
158
152
  },
159
153
  valueContainer: {
160
- ...InfoBars_1.infoStyles.valueContainer,
154
+ ...infoStyles.valueContainer,
161
155
  },
162
156
  value: {
163
- ...InfoBars_1.infoStyles.value,
157
+ ...infoStyles.value,
164
158
  },
165
159
  unitContainer: {
166
- ...InfoBars_1.infoStyles.unitContainer,
160
+ ...infoStyles.unitContainer,
167
161
  },
168
162
  units: {
169
- ...InfoBars_1.infoStyles.units,
163
+ ...infoStyles.units,
170
164
  },
171
165
  editIconContainer: {
172
166
  justifyContent: `flex-end`,
@@ -174,16 +168,16 @@ const calculationStyles = react_native_1.StyleSheet.create({
174
168
  flexDirection: `row`,
175
169
  },
176
170
  editIcon: {
177
- color: Constants_1.BORDER_COLOUR_TEAL,
178
- fontSize: react_native_1.Dimensions.get(`screen`).width / 30,
171
+ color: BORDER_COLOUR_TEAL,
172
+ fontSize: Dimensions.get(`screen`).width / 30,
179
173
  },
180
174
  recommendedContainer: {
181
175
  flex: 7,
182
176
  flexDirection: `row`,
183
177
  },
184
178
  recommendedLabel: {
185
- color: Constants_1.BORDER_COLOUR_TEAL,
186
- fontSize: react_native_1.Dimensions.get(`screen`).width / 25,
179
+ color: BORDER_COLOUR_TEAL,
180
+ fontSize: Dimensions.get(`screen`).width / 25,
187
181
  alignSelf: `center`,
188
182
  fontWeight: `bold`,
189
183
  },
@@ -193,8 +187,8 @@ const calculationStyles = react_native_1.StyleSheet.create({
193
187
  marginTop: `1%`,
194
188
  },
195
189
  removeRecommendedIcon: {
196
- color: Constants_1.BORDER_COLOUR_TEAL,
197
- fontSize: react_native_1.Dimensions.get(`screen`).width / 20,
190
+ color: BORDER_COLOUR_TEAL,
191
+ fontSize: Dimensions.get(`screen`).width / 20,
198
192
  paddingBottom: `0.5%`,
199
193
  },
200
194
  });