@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,62 +1,38 @@
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
- const react_1 = __importDefault(require("react"));
26
- const react_native_1 = require("react-native");
27
- const Constants_1 = require("./utils/Constants");
28
- const Header_1 = __importDefault(require("./components/Header"));
29
- const InfoBars_1 = __importStar(require("./components/InfoBars"));
30
- const RecentInsulin_1 = __importDefault(require("./components/RecentInsulin"));
31
- const RecommendedCarbs_1 = __importDefault(require("./components/RecommendedCarbs"));
32
- const RecommendedInsulin_1 = __importDefault(require("./components/RecommendedInsulin"));
33
- const Remeasure_1 = __importDefault(require("./components/Remeasure"));
34
- const Calculator = __importStar(require("@hedia/recommendation-calculator"));
35
- const types_1 = require("@hedia/types");
36
- const react_2 = require("@lingui/react");
37
- const Emotion_1 = __importDefault(require("./components/mood/Emotion"));
38
- const TransferToLogbook_1 = __importDefault(require("./components/TransferToLogbook"));
39
- const macro_1 = require("@lingui/macro");
40
- const Activity_1 = __importDefault(require("./components/activity/Activity"));
41
- const LimitationMessage_1 = __importDefault(require("./components/LimitationMessage"));
42
- const RecommendationModal_1 = __importDefault(require("./components/RecommendationModal"));
43
- const TwoOptionModal_1 = __importStar(require("./components/TwoOptionModal"));
44
- const i18nUtils_1 = require("./locale/i18nUtils");
45
- const enum_1 = require("./types/enum");
46
- const AttentionMessages_1 = require("./utils/AttentionMessages");
47
- const RecommendationUtils_1 = require("./utils/RecommendationUtils");
48
- const Utils_1 = require("./utils/Utils");
49
- const Validations_1 = require("./utils/Validations");
1
+ import React from "react";
2
+ import { AppState, ScrollView, StyleSheet, View, YellowBox } from "react-native";
3
+ import { BACKGROUND_COLOUR_PURPLE, BORDER_COLOUR_GREY, BORDER_COLOUR_TEAL } from "./utils/Constants";
4
+ import Header from "./components/Header";
5
+ import InfoBars, { infoStyles } from "./components/InfoBars";
6
+ import RecentInsulin from "./components/RecentInsulin";
7
+ import RecommendedCarbs from "./components/RecommendedCarbs";
8
+ import RecommendedInsulin from "./components/RecommendedInsulin";
9
+ import Remeasure from "./components/Remeasure";
10
+ import * as Calculator from "@hedia/recommendation-calculator";
11
+ import { Milliseconds } from "@hedia/types";
12
+ import { I18nProvider } from "@lingui/react";
13
+ import Emotion from "./components/mood/Emotion";
14
+ import TransferToLogbook from "./components/TransferToLogbook";
15
+ import { t } from "@lingui/macro";
16
+ import Activity from "./components/activity/Activity";
17
+ import LimitationMessage from "./components/LimitationMessage";
18
+ import RecommendationModal from "./components/RecommendationModal";
19
+ import TwoOptionModal, { modalStyle } from "./components/TwoOptionModal";
20
+ import { changeLanguage, i18n } from "./locale/i18nUtils";
21
+ import { InfoBarTestIds } from "./types/enum";
22
+ import { Messages } from "./utils/AttentionMessages";
23
+ import { getAttentionMessage, getBGLevel, getLimitationMessage, getReminder } from "./utils/RecommendationUtils";
24
+ import { Utils } from "./utils/Utils";
25
+ import { validateParams } from "./utils/Validations";
50
26
  // Ignoring long timer warnings
51
27
  // https://github.com/facebook/react-native/issues/12981#issuecomment-652745831
52
- react_native_1.YellowBox.ignoreWarnings([`Setting a timer`]);
53
- class RecommendationScreen extends react_1.default.Component {
28
+ YellowBox.ignoreWarnings([`Setting a timer`]);
29
+ export default class RecommendationScreen extends React.Component {
54
30
  constructor(props) {
55
31
  super(props);
56
32
  this.hasError = false;
57
33
  this.handleAppStateChange = (nextAppState) => {
58
34
  const time = this.recommendationDate.getTime();
59
- const isOlderThan15Minutes = global.Date.now() - time > types_1.Milliseconds.Minute * 15;
35
+ const isOlderThan15Minutes = global.Date.now() - time > Milliseconds.Minute * 15;
60
36
  if (nextAppState === `active` && isOlderThan15Minutes) {
61
37
  this.showTimeoutModal();
62
38
  }
@@ -67,7 +43,7 @@ class RecommendationScreen extends react_1.default.Component {
67
43
  this.recalculateInsulin = (calculatorParams) => {
68
44
  const { bolus, wasLimited, activityReduction } = Calculator.calculateRecommendation(calculatorParams);
69
45
  this.setState({
70
- insulinRecommendation: Utils_1.Utils.roundValue(bolus, this.props.injectionMethod),
46
+ insulinRecommendation: Utils.roundValue(bolus, this.props.injectionMethod),
71
47
  enteredInsulin: null,
72
48
  wasLimited,
73
49
  activityReduction,
@@ -146,30 +122,30 @@ class RecommendationScreen extends react_1.default.Component {
146
122
  this.getBGLevelAttentionMessage = () => {
147
123
  const { calculatorParams, latestLogbookFrom6Hours } = this.props;
148
124
  const { currentBGL, activity } = calculatorParams;
149
- const bgLevel = RecommendationUtils_1.getBGLevel(currentBGL, latestLogbookFrom6Hours);
150
- return RecommendationUtils_1.getAttentionMessage(bgLevel, activity);
125
+ const bgLevel = getBGLevel(currentBGL, latestLogbookFrom6Hours);
126
+ return getAttentionMessage(bgLevel, activity);
151
127
  };
152
128
  this.getBGLevelRemeasurementReminder = () => {
153
129
  const { calculatorParams, userReminder, latestLogbookFrom6Hours } = this.props;
154
130
  const { currentBGL, activity, carbohydrates } = calculatorParams;
155
- const bgLevel = RecommendationUtils_1.getBGLevel(currentBGL, latestLogbookFrom6Hours);
156
- return RecommendationUtils_1.getReminder(bgLevel, carbohydrates, userReminder, activity);
131
+ const bgLevel = getBGLevel(currentBGL, latestLogbookFrom6Hours);
132
+ return getReminder(bgLevel, carbohydrates, userReminder, activity);
157
133
  };
158
134
  this.getLimitationAttentionMessage = () => {
159
135
  const { wasLimited, activityReduction } = this.state;
160
- return RecommendationUtils_1.getLimitationMessage(wasLimited, activityReduction);
136
+ return getLimitationMessage(wasLimited, activityReduction);
161
137
  };
162
138
  try {
163
- Validations_1.validateParams(props);
139
+ validateParams(props);
164
140
  this.recommendationDate = new Date(global.Date.now());
165
- i18nUtils_1.changeLanguage(props.language);
141
+ changeLanguage(props.language);
166
142
  const { recentBoluses } = props.calculatorParams;
167
143
  const { bolus, carbRecommendation, activityReduction, wasLimited, activeInsulin, } = Calculator.calculateRecommendation(props.calculatorParams);
168
144
  this.suggestedCarbs = carbRecommendation;
169
145
  this.state = {
170
146
  remeasureTime: this.getBGLevelRemeasurementReminder(),
171
147
  isRecommendationDisplayed: recentBoluses?.length !== 0,
172
- insulinRecommendation: Utils_1.Utils.roundValue(bolus, props.injectionMethod),
148
+ insulinRecommendation: Utils.roundValue(bolus, props.injectionMethod),
173
149
  wasLimited,
174
150
  activityReduction,
175
151
  carbRecommendation,
@@ -182,7 +158,7 @@ class RecommendationScreen extends react_1.default.Component {
182
158
  showLimitationMessage: false,
183
159
  showTimeoutModal: false,
184
160
  };
185
- this.timer = setTimeout(this.showTimeoutModal, types_1.Milliseconds.Minute * 15);
161
+ this.timer = setTimeout(this.showTimeoutModal, Milliseconds.Minute * 15);
186
162
  }
187
163
  catch (error) {
188
164
  this.hasError = true;
@@ -190,69 +166,68 @@ class RecommendationScreen extends react_1.default.Component {
190
166
  }
191
167
  }
192
168
  componentDidMount() {
193
- react_native_1.AppState.addEventListener(`change`, this.handleAppStateChange);
169
+ AppState.addEventListener(`change`, this.handleAppStateChange);
194
170
  }
195
171
  componentWillUnmount() {
196
172
  if (this.timer !== undefined) {
197
173
  clearTimeout(this.timer);
198
174
  }
199
- react_native_1.AppState.removeEventListener(`change`, this.handleAppStateChange);
175
+ AppState.removeEventListener(`change`, this.handleAppStateChange);
200
176
  }
201
177
  render() {
202
178
  if (this.hasError) {
203
- return <react_native_1.View style={containerStyles.container}/>;
179
+ return <View style={containerStyles.container}/>;
204
180
  }
205
181
  const { activeInsulin, recommendationModal, carbRecommendation: carbRecommendationProp, enteredCarbs, enteredInsulin, insulinRecommendation, activityReduction, isRecommendationDisplayed, } = this.state;
206
- const { BloodGlucose: BGValueTestID, BloodKetone: BKValueTestID, ActiveInsulin: ActiveInsulinValueTestID, } = enum_1.InfoBarTestIds.Value;
207
- const { ActiveInsulin: ActiveInsulinUnitTestID, BloodGlucose: BGUnitTestID, BloodKetone: BKUnitTestID, } = enum_1.InfoBarTestIds.Unit;
182
+ const { BloodGlucose: BGValueTestID, BloodKetone: BKValueTestID, ActiveInsulin: ActiveInsulinValueTestID, } = InfoBarTestIds.Value;
183
+ const { ActiveInsulin: ActiveInsulinUnitTestID, BloodGlucose: BGUnitTestID, BloodKetone: BKUnitTestID, } = InfoBarTestIds.Unit;
208
184
  const carbRecommendation = carbRecommendationProp !== null ? Math.round(carbRecommendationProp) : null;
209
185
  const recommendedCarbs = enteredCarbs ?? carbRecommendation;
210
186
  const { calculatorParams, bloodGlucoseUnit, currentBKL, bloodKetoneUnit } = this.props;
211
187
  const { currentBGL, carbohydrates: providedCarbs } = calculatorParams;
212
- const displayedBGL = currentBGL ? Utils_1.Utils.displayedBGLValue(currentBGL, bloodGlucoseUnit) : null;
213
- const displayedBKL = currentBKL !== null && bloodKetoneUnit ? Utils_1.Utils.displayedBKLValue(currentBKL, bloodKetoneUnit) : null;
214
- return (<react_2.I18nProvider language={this.props.language} i18n={i18nUtils_1.i18n}>
215
- <react_native_1.ScrollView style={containerStyles.container} ref={(view) => {
188
+ const displayedBGL = currentBGL ? Utils.displayedBGLValue(currentBGL, bloodGlucoseUnit) : null;
189
+ const displayedBKL = currentBKL !== null && bloodKetoneUnit ? Utils.displayedBKLValue(currentBKL, bloodKetoneUnit) : null;
190
+ return (<I18nProvider language={this.props.language} i18n={i18n}>
191
+ <ScrollView style={containerStyles.container} ref={(view) => {
216
192
  if (view !== null) {
217
193
  this.scrollView = view;
218
194
  }
219
195
  }}>
220
- <Header_1.default exitCallback={this.onExit}/>
221
- <InfoBars_1.default label={i18nUtils_1.i18n._(macro_1.t `Active Insulin`)} value={activeInsulin ? `${activeInsulin.toFixed(1)}` : null} unit={i18nUtils_1.i18n._(macro_1.t `units`)} showNullAsDash={false} testID={{ unitID: ActiveInsulinUnitTestID, valueID: ActiveInsulinValueTestID }}/>
222
- <InfoBars_1.default label={i18nUtils_1.i18n._(macro_1.t `Blood Glucose Level`)} value={displayedBGL} unit={this.props.bloodGlucoseUnit} showNullAsDash={true} testID={{ unitID: BGUnitTestID, valueID: BGValueTestID }}/>
223
- <InfoBars_1.default label={i18nUtils_1.i18n._(macro_1.t `Blood Ketone Level`)} value={displayedBKL} unit={this.props.bloodKetoneUnit} showNullAsDash={true} testID={{ unitID: BKUnitTestID, valueID: BKValueTestID }}/>
224
- <react_native_1.View style={containerStyles.calcContainer}>
225
- <react_native_1.View style={containerStyles.calcMargin}>
226
- <react_native_1.View style={[
196
+ <Header exitCallback={this.onExit}/>
197
+ <InfoBars label={i18n._(t `Active Insulin`)} value={activeInsulin ? `${activeInsulin.toFixed(1)}` : null} unit={i18n._(t `units`)} showNullAsDash={false} testID={{ unitID: ActiveInsulinUnitTestID, valueID: ActiveInsulinValueTestID }}/>
198
+ <InfoBars label={i18n._(t `Blood Glucose Level`)} value={displayedBGL} unit={this.props.bloodGlucoseUnit} showNullAsDash={true} testID={{ unitID: BGUnitTestID, valueID: BGValueTestID }}/>
199
+ <InfoBars label={i18n._(t `Blood Ketone Level`)} value={displayedBKL} unit={this.props.bloodKetoneUnit} showNullAsDash={true} testID={{ unitID: BKUnitTestID, valueID: BKValueTestID }}/>
200
+ <View style={containerStyles.calcContainer}>
201
+ <View style={containerStyles.calcMargin}>
202
+ <View style={[
227
203
  containerStyles.calcBorder,
228
204
  {
229
- borderColor: recommendedCarbs ? Constants_1.BORDER_COLOUR_TEAL : Constants_1.BORDER_COLOUR_GREY,
205
+ borderColor: recommendedCarbs ? BORDER_COLOUR_TEAL : BORDER_COLOUR_GREY,
230
206
  },
231
207
  ]}>
232
- <RecommendedCarbs_1.default enteredCarbs={`${providedCarbs}`} changedRecommendedCarbs={this.updateCarbRecommendation} recommendedCarbs={`${recommendedCarbs}`} removeRecommendedCarbs={this.removeCarbRecommendation}/>
233
- </react_native_1.View>
234
- </react_native_1.View>
235
- </react_native_1.View>
236
- {this.props.calculatorParams.activity && this.props.activityDisplayProps ? (<Activity_1.default activity={this.props.calculatorParams.activity} activityType={this.props.activityDisplayProps.activityType} activityTitle={this.props.activityDisplayProps.activityTitle} activityReduction={this.state.activityReduction}/>) : null}
237
- <Remeasure_1.default onSliderChange={this.updateRemeasureTime} remeasureTime={this.state.remeasureTime}/>
238
- {!this.state.isRecommendationDisplayed ? (<RecentInsulin_1.default onRecentInsulinYes={this.props.onRecentInsulinYes} onRecentInsulinNo={this.handleNoRecentInsulin}/>) : (<RecommendedInsulin_1.default injectionMethod={this.props.injectionMethod} insulinRecommendation={insulinRecommendation} enteredInsulin={enteredInsulin} activityReduction={activityReduction} updateRecommendedInsulin={this.updateInsulinRecommendation}/>)}
239
- <Emotion_1.default moodSelected={this.handleMoodSelected} currentMood={this.state.selectedMood}/>
240
- <TransferToLogbook_1.default visible={isRecommendationDisplayed} transfer={this.handleTransfer}/>
241
- <RecommendationModal_1.default isVisible={recommendationModal} suggestedCarbohydrates={carbRecommendationProp} attentionMessage={this.getBGLevelAttentionMessage()} limitationMessage={this.getLimitationAttentionMessage()} onClickOkButton={this.hideAttentionModal} onAcceptCarbohydrates={this.acceptCarbRecommendation} onDeclineCarbohydrates={this.declineCarbRecommendation}/>
242
- </react_native_1.ScrollView>
243
- {this.state.showExitModal ? (<TwoOptionModal_1.default title={i18nUtils_1.i18n._(macro_1.t `Save data before closing?`)} message={i18nUtils_1.i18n._(macro_1.t `Your saved data will be used for future calculations.`)} textFirstOption={i18nUtils_1.i18n._(macro_1.t `Save to logbook`)} textSecondOption={i18nUtils_1.i18n._(macro_1.t `Close calculation`)} isCancelable={true} rowAsButtonLayout={true} firstOption={this.handleTransfer} secondOption={this.closeCalculation} onClose={this.hideExitModal}/>) : null}
244
- {this.state.showLimitationMessage ? (<react_native_1.View style={TwoOptionModal_1.modalStyle.container}>
245
- <LimitationMessage_1.default limitationMessage={this.getLimitationAttentionMessage()} onPressNextButton={this.hideLimitationMessage}/>
246
- </react_native_1.View>) : null}
247
- {this.state.showTimeoutModal ? (this.state.isRecommendationDisplayed ? (<TwoOptionModal_1.default title={AttentionMessages_1.Messages.TimeoutPrompTitle()} message={AttentionMessages_1.Messages.TimeoutRecommendationVisible(this.recommendationDate)} textFirstOption={i18nUtils_1.i18n._(macro_1.t `Yes, save to logbook`)} textSecondOption={i18nUtils_1.i18n._(macro_1.t `No, return to dashboard`)} rowAsButtonLayout={false} firstOption={this.handleTransfer} secondOption={this.closeCalculation}/>) : (<TwoOptionModal_1.default title={AttentionMessages_1.Messages.TimeoutPrompTitle()} message={AttentionMessages_1.Messages.TimeoutRecommendationNotVisible()} textFirstOption={i18nUtils_1.i18n._(macro_1.t `Start new calculation`)} textSecondOption={i18nUtils_1.i18n._(macro_1.t `Return to dashboard`)} rowAsButtonLayout={false} firstOption={this.restartCalculation} secondOption={this.closeCalculation}/>)) : null}
248
- </react_2.I18nProvider>);
208
+ <RecommendedCarbs enteredCarbs={`${providedCarbs}`} changedRecommendedCarbs={this.updateCarbRecommendation} recommendedCarbs={`${recommendedCarbs}`} removeRecommendedCarbs={this.removeCarbRecommendation}/>
209
+ </View>
210
+ </View>
211
+ </View>
212
+ {this.props.calculatorParams.activity && this.props.activityDisplayProps ? (<Activity activity={this.props.calculatorParams.activity} activityType={this.props.activityDisplayProps.activityType} activityTitle={this.props.activityDisplayProps.activityTitle} activityReduction={this.state.activityReduction}/>) : null}
213
+ <Remeasure onSliderChange={this.updateRemeasureTime} remeasureTime={this.state.remeasureTime}/>
214
+ {!this.state.isRecommendationDisplayed ? (<RecentInsulin onRecentInsulinYes={this.props.onRecentInsulinYes} onRecentInsulinNo={this.handleNoRecentInsulin}/>) : (<RecommendedInsulin injectionMethod={this.props.injectionMethod} insulinRecommendation={insulinRecommendation} enteredInsulin={enteredInsulin} activityReduction={activityReduction} updateRecommendedInsulin={this.updateInsulinRecommendation}/>)}
215
+ <Emotion moodSelected={this.handleMoodSelected} currentMood={this.state.selectedMood}/>
216
+ <TransferToLogbook visible={isRecommendationDisplayed} transfer={this.handleTransfer}/>
217
+ <RecommendationModal isVisible={recommendationModal} suggestedCarbohydrates={carbRecommendationProp} attentionMessage={this.getBGLevelAttentionMessage()} limitationMessage={this.getLimitationAttentionMessage()} onClickOkButton={this.hideAttentionModal} onAcceptCarbohydrates={this.acceptCarbRecommendation} onDeclineCarbohydrates={this.declineCarbRecommendation}/>
218
+ </ScrollView>
219
+ {this.state.showExitModal ? (<TwoOptionModal title={i18n._(t `Save data before closing?`)} message={i18n._(t `Your saved data will be used for future calculations.`)} textFirstOption={i18n._(t `Save to logbook`)} textSecondOption={i18n._(t `Close calculation`)} isCancelable={true} rowAsButtonLayout={true} firstOption={this.handleTransfer} secondOption={this.closeCalculation} onClose={this.hideExitModal}/>) : null}
220
+ {this.state.showLimitationMessage ? (<View style={modalStyle.container}>
221
+ <LimitationMessage limitationMessage={this.getLimitationAttentionMessage()} onPressNextButton={this.hideLimitationMessage}/>
222
+ </View>) : null}
223
+ {this.state.showTimeoutModal ? (this.state.isRecommendationDisplayed ? (<TwoOptionModal title={Messages.TimeoutPrompTitle()} message={Messages.TimeoutRecommendationVisible(this.recommendationDate)} textFirstOption={i18n._(t `Yes, save to logbook`)} textSecondOption={i18n._(t `No, return to dashboard`)} rowAsButtonLayout={false} firstOption={this.handleTransfer} secondOption={this.closeCalculation}/>) : (<TwoOptionModal title={Messages.TimeoutPrompTitle()} message={Messages.TimeoutRecommendationNotVisible()} textFirstOption={i18n._(t `Start new calculation`)} textSecondOption={i18n._(t `Return to dashboard`)} rowAsButtonLayout={false} firstOption={this.restartCalculation} secondOption={this.closeCalculation}/>)) : null}
224
+ </I18nProvider>);
249
225
  }
250
226
  }
251
- exports.default = RecommendationScreen;
252
- const containerStyles = react_native_1.StyleSheet.create({
227
+ const containerStyles = StyleSheet.create({
253
228
  container: {
254
229
  flex: 1,
255
- backgroundColor: Constants_1.BACKGROUND_COLOUR_PURPLE,
230
+ backgroundColor: BACKGROUND_COLOUR_PURPLE,
256
231
  },
257
232
  calcContainer: {
258
233
  flex: 1,
@@ -263,7 +238,7 @@ const containerStyles = react_native_1.StyleSheet.create({
263
238
  margin: `3%`,
264
239
  },
265
240
  calcBorder: {
266
- ...InfoBars_1.infoStyles.border,
267
- borderColor: Constants_1.BORDER_COLOUR_TEAL,
241
+ ...infoStyles.border,
242
+ borderColor: BORDER_COLOUR_TEAL,
268
243
  },
269
244
  });