@hedia/recommendation-screen 2.1.15 → 2.1.16
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.
- package/coverage/clover.xml +586 -588
- package/coverage/coverage-final.json +27 -27
- package/coverage/lcov-report/index.html +7 -7
- package/coverage/lcov-report/src/RecommendationScreen.tsx.html +979 -10
- package/coverage/lcov-report/src/__tests__/index.html +1 -1
- package/coverage/lcov-report/src/__tests__/utils.tsx.html +29 -8
- package/coverage/lcov-report/src/components/Header.tsx.html +13 -4
- package/coverage/lcov-report/src/components/InfoBars.tsx.html +86 -2
- package/coverage/lcov-report/src/components/InvisibleNumberInput.tsx.html +196 -4
- package/coverage/lcov-report/src/components/LimitationMessage.tsx.html +20 -2
- package/coverage/lcov-report/src/components/LineSeparator.tsx.html +12 -3
- package/coverage/lcov-report/src/components/RecentInsulin.tsx.html +30 -3
- package/coverage/lcov-report/src/components/RecommendationModal.tsx.html +184 -4
- package/coverage/lcov-report/src/components/RecommendedCarbs.tsx.html +205 -7
- package/coverage/lcov-report/src/components/RecommendedInsulin.tsx.html +187 -19
- package/coverage/lcov-report/src/components/Remeasure.tsx.html +114 -3
- package/coverage/lcov-report/src/components/TransferToLogbook.tsx.html +67 -4
- package/coverage/lcov-report/src/components/TwoOptionModal.tsx.html +34 -10
- package/coverage/lcov-report/src/components/activity/Activity.tsx.html +58 -7
- package/coverage/lcov-report/src/components/activity/ActivityIcon.tsx.html +42 -3
- package/coverage/lcov-report/src/components/activity/ActivityIntensity.tsx.html +30 -6
- package/coverage/lcov-report/src/components/activity/index.html +1 -1
- package/coverage/lcov-report/src/components/index.html +10 -10
- package/coverage/lcov-report/src/components/mood/Emotion.tsx.html +78 -3
- package/coverage/lcov-report/src/components/mood/MoodIcon.tsx.html +80 -5
- package/coverage/lcov-report/src/components/mood/index.html +1 -1
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/locale/i18nUtils.ts.html +41 -2
- package/coverage/lcov-report/src/locale/index.html +1 -1
- package/coverage/lcov-report/src/utils/AttentionMessages.tsx.html +231 -3
- package/coverage/lcov-report/src/utils/Constants.ts.html +71 -2
- package/coverage/lcov-report/src/utils/RecommendationError.tsx.html +89 -2
- package/coverage/lcov-report/src/utils/RecommendationUtils.ts.html +306 -9
- package/coverage/lcov-report/src/utils/Translations.ts.html +27 -3
- package/coverage/lcov-report/src/utils/Utils.ts.html +278 -2
- package/coverage/lcov-report/src/utils/Validations.ts.html +716 -14
- package/coverage/lcov-report/src/utils/index.html +1 -1
- package/coverage/lcov.info +1158 -1164
- package/ignore-git.sh +1 -0
- package/ignore-publish.sh +1 -0
- package/package.json +5 -3
- package/src/RecommendationScreen.d.ts +323 -6
- package/src/RecommendationScreen.js +234 -1
- package/src/__tests__/RecommendationScreen.test.js +1 -1
- package/src/__tests__/utils.d.ts +5 -5
- package/src/__tests__/utils.js +1 -1
- package/src/components/Header.d.ts +4 -43
- package/src/components/Header.js +3 -1
- package/src/components/Icon.d.ts +9 -2
- package/src/components/Icon.js +6 -1
- package/src/components/InfoBars.d.ts +28 -0
- package/src/components/InfoBars.js +23 -0
- package/src/components/InvisibleNumberInput.d.ts +66 -3
- package/src/components/InvisibleNumberInput.js +53 -0
- package/src/components/LimitationMessage.d.ts +6 -0
- package/src/components/LimitationMessage.js +4 -0
- package/src/components/LineSeparator.d.ts +4 -2
- package/src/components/LineSeparator.js +2 -0
- package/src/components/RecentInsulin.d.ts +10 -2
- package/src/components/RecentInsulin.js +7 -0
- package/src/components/RecommendationModal.d.ts +61 -3
- package/src/components/RecommendationModal.js +45 -0
- package/src/components/RecommendedCarbs.d.ts +71 -4
- package/src/components/RecommendedCarbs.js +56 -0
- package/src/components/RecommendedInsulin.d.ts +66 -4
- package/src/components/RecommendedInsulin.js +51 -5
- package/src/components/Remeasure.d.ts +38 -2
- package/src/components/Remeasure.js +31 -0
- package/src/components/TransferToLogbook.d.ts +23 -3
- package/src/components/TransferToLogbook.js +18 -0
- package/src/components/TwoOptionModal.d.ts +12 -1
- package/src/components/TwoOptionModal.js +3 -3
- package/src/components/activity/Activity.d.ts +21 -5
- package/src/components/activity/Activity.js +14 -0
- package/src/components/activity/ActivityIcon.d.ts +15 -0
- package/src/components/activity/ActivityIcon.js +14 -1
- package/src/components/activity/ActivityIntensity.d.ts +11 -4
- package/src/components/activity/ActivityIntensity.js +7 -0
- package/src/components/mood/Emotion.d.ts +26 -1
- package/src/components/mood/Emotion.js +20 -0
- package/src/components/mood/MoodIcon.d.ts +28 -2
- package/src/components/mood/MoodIcon.js +20 -2
- package/src/locale/i18nUtils.d.ts +13 -0
- package/src/locale/i18nUtils.js +13 -0
- package/src/types/enum.d.ts +10 -0
- package/src/types/enum.js +9 -0
- package/src/types/types.d.ts +9 -7
- package/src/utils/AttentionMessages.d.ts +65 -0
- package/src/utils/AttentionMessages.js +65 -1
- package/src/utils/Constants.d.ts +23 -0
- package/src/utils/Constants.js +23 -0
- package/src/utils/RecommendationError.d.ts +29 -0
- package/src/utils/RecommendationError.js +29 -0
- package/src/utils/RecommendationUtils.d.ts +98 -6
- package/src/utils/RecommendationUtils.js +92 -0
- package/src/utils/Translations.d.ts +7 -0
- package/src/utils/Translations.js +7 -0
- package/src/utils/Utils.d.ts +92 -0
- package/src/utils/Utils.js +92 -0
- package/src/utils/Validations.d.ts +232 -9
- package/src/utils/Validations.js +225 -2
- package/typedoc.json +13 -0
|
@@ -94,7 +94,19 @@
|
|
|
94
94
|
<a name='L35'></a><a href='#L35'>35</a>
|
|
95
95
|
<a name='L36'></a><a href='#L36'>36</a>
|
|
96
96
|
<a name='L37'></a><a href='#L37'>37</a>
|
|
97
|
-
<a name='L38'></a><a href='#L38'>38</a
|
|
97
|
+
<a name='L38'></a><a href='#L38'>38</a>
|
|
98
|
+
<a name='L39'></a><a href='#L39'>39</a>
|
|
99
|
+
<a name='L40'></a><a href='#L40'>40</a>
|
|
100
|
+
<a name='L41'></a><a href='#L41'>41</a>
|
|
101
|
+
<a name='L42'></a><a href='#L42'>42</a>
|
|
102
|
+
<a name='L43'></a><a href='#L43'>43</a>
|
|
103
|
+
<a name='L44'></a><a href='#L44'>44</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
104
|
+
<span class="cline-any cline-neutral"> </span>
|
|
105
|
+
<span class="cline-any cline-neutral"> </span>
|
|
106
|
+
<span class="cline-any cline-neutral"> </span>
|
|
107
|
+
<span class="cline-any cline-neutral"> </span>
|
|
108
|
+
<span class="cline-any cline-neutral"> </span>
|
|
109
|
+
<span class="cline-any cline-neutral"> </span>
|
|
98
110
|
<span class="cline-any cline-neutral"> </span>
|
|
99
111
|
<span class="cline-any cline-neutral"> </span>
|
|
100
112
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -139,11 +151,17 @@ import { Testing } from "../types/enum";
|
|
|
139
151
|
import { stylesModal } from "./RecommendationModal";
|
|
140
152
|
|
|
141
153
|
export interface ILimitationMessageProps {
|
|
154
|
+
/** The message to display to the user. */
|
|
142
155
|
limitationMessage: string | null;
|
|
156
|
+
/** Callback function taking no arguments and giving no return value - To be called when the user presses the “OK” button. */
|
|
143
157
|
onPressNextButton(): void;
|
|
144
158
|
}
|
|
145
159
|
|
|
160
|
+
/** Display a message on the screen to inform the user that their insulin recommendation was limited. */
|
|
146
161
|
export default class LimitationMessage extends React.Component<ILimitationMessageProps> {
|
|
162
|
+
/**
|
|
163
|
+
* @returns JSX element for displaying a dialog with the limitationMessage and an “OK” button that calls the onPressNextButton prop callback when tapped.
|
|
164
|
+
*/
|
|
147
165
|
public render = (): JSX.Element => {
|
|
148
166
|
const { limitationMessage } = this.props;
|
|
149
167
|
return (
|
|
@@ -175,7 +193,7 @@ export default class LimitationMessage extends React.Component<ILimitationMes
|
|
|
175
193
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
176
194
|
Code coverage generated by
|
|
177
195
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
178
|
-
at
|
|
196
|
+
at Thu Jul 29 2021 07:55:43 GMT+0000 (Coordinated Universal Time)
|
|
179
197
|
</div>
|
|
180
198
|
</div>
|
|
181
199
|
<script src="../../prettify.js"></script>
|
|
@@ -81,7 +81,13 @@
|
|
|
81
81
|
<a name='L22'></a><a href='#L22'>22</a>
|
|
82
82
|
<a name='L23'></a><a href='#L23'>23</a>
|
|
83
83
|
<a name='L24'></a><a href='#L24'>24</a>
|
|
84
|
-
<a name='L25'></a><a href='#L25'>25</a
|
|
84
|
+
<a name='L25'></a><a href='#L25'>25</a>
|
|
85
|
+
<a name='L26'></a><a href='#L26'>26</a>
|
|
86
|
+
<a name='L27'></a><a href='#L27'>27</a>
|
|
87
|
+
<a name='L28'></a><a href='#L28'>28</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
88
|
+
<span class="cline-any cline-neutral"> </span>
|
|
89
|
+
<span class="cline-any cline-neutral"> </span>
|
|
90
|
+
<span class="cline-any cline-neutral"> </span>
|
|
85
91
|
<span class="cline-any cline-neutral"> </span>
|
|
86
92
|
<span class="cline-any cline-neutral"> </span>
|
|
87
93
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -108,11 +114,14 @@
|
|
|
108
114
|
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import React from "react";
|
|
109
115
|
import { StyleSheet, View } from "react-native";
|
|
110
116
|
|
|
111
|
-
interface IProps {
|
|
117
|
+
export interface IProps {
|
|
118
|
+
/** The color that the line should have. */
|
|
112
119
|
color: string;
|
|
113
120
|
}
|
|
114
121
|
|
|
122
|
+
/** Display a horizontal line for visually separating elements in the user interface. */
|
|
115
123
|
export default class LineSeparator extends React.Component<IProps> {
|
|
124
|
+
/** @return JSX element for displaying a thin horizontal line in the given color. */
|
|
116
125
|
public render(): JSX.Element {
|
|
117
126
|
return (
|
|
118
127
|
<React.Fragment>
|
|
@@ -136,7 +145,7 @@ const lineSeparatorStyles = StyleSheet.create({
|
|
|
136
145
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
137
146
|
Code coverage generated by
|
|
138
147
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
139
|
-
at
|
|
148
|
+
at Thu Jul 29 2021 07:55:43 GMT+0000 (Coordinated Universal Time)
|
|
140
149
|
</div>
|
|
141
150
|
</div>
|
|
142
151
|
<script src="../../prettify.js"></script>
|
|
@@ -158,7 +158,25 @@
|
|
|
158
158
|
<a name='L99'></a><a href='#L99'>99</a>
|
|
159
159
|
<a name='L100'></a><a href='#L100'>100</a>
|
|
160
160
|
<a name='L101'></a><a href='#L101'>101</a>
|
|
161
|
-
<a name='L102'></a><a href='#L102'>102</a
|
|
161
|
+
<a name='L102'></a><a href='#L102'>102</a>
|
|
162
|
+
<a name='L103'></a><a href='#L103'>103</a>
|
|
163
|
+
<a name='L104'></a><a href='#L104'>104</a>
|
|
164
|
+
<a name='L105'></a><a href='#L105'>105</a>
|
|
165
|
+
<a name='L106'></a><a href='#L106'>106</a>
|
|
166
|
+
<a name='L107'></a><a href='#L107'>107</a>
|
|
167
|
+
<a name='L108'></a><a href='#L108'>108</a>
|
|
168
|
+
<a name='L109'></a><a href='#L109'>109</a>
|
|
169
|
+
<a name='L110'></a><a href='#L110'>110</a>
|
|
170
|
+
<a name='L111'></a><a href='#L111'>111</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
171
|
+
<span class="cline-any cline-neutral"> </span>
|
|
172
|
+
<span class="cline-any cline-neutral"> </span>
|
|
173
|
+
<span class="cline-any cline-neutral"> </span>
|
|
174
|
+
<span class="cline-any cline-neutral"> </span>
|
|
175
|
+
<span class="cline-any cline-neutral"> </span>
|
|
176
|
+
<span class="cline-any cline-neutral"> </span>
|
|
177
|
+
<span class="cline-any cline-neutral"> </span>
|
|
178
|
+
<span class="cline-any cline-neutral"> </span>
|
|
179
|
+
<span class="cline-any cline-neutral"> </span>
|
|
162
180
|
<span class="cline-any cline-neutral"> </span>
|
|
163
181
|
<span class="cline-any cline-neutral"> </span>
|
|
164
182
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -266,12 +284,21 @@ import { i18n } from "../locale/i18nUtils";
|
|
|
266
284
|
import { Testing } from "../types/enum";
|
|
267
285
|
import { infoStyles } from "./InfoBars";
|
|
268
286
|
|
|
269
|
-
interface IProps {
|
|
287
|
+
export interface IProps {
|
|
288
|
+
/** Callback function taking no arguments and returning no value - To be called if the user presses the “Yes” button. */
|
|
270
289
|
onRecentInsulinYes(): void;
|
|
290
|
+
/** Callback function taking no arguments and returning no value - To be called if the user presses the “No” button. */
|
|
271
291
|
onRecentInsulinNo(): void;
|
|
272
292
|
}
|
|
273
293
|
|
|
294
|
+
/** Display a card that prompts the user to recall if they injected insulin recently. */
|
|
274
295
|
export default class RecentInsulin extends React.Component<IProps> {
|
|
296
|
+
/**
|
|
297
|
+
*
|
|
298
|
+
* @returns JSX element that displays a card with the question “Have you taken insulin within the last 4 hours? Along with two buttons labeled “Yes” and “No” respectively.
|
|
299
|
+
* If the user taps the “Yes” button, the onRecentInsulinYes prop callback function should be called.
|
|
300
|
+
* If the user taps the “No” button, the onRecentInsulinNo prop callback function should be called.
|
|
301
|
+
*/
|
|
275
302
|
public render = (): JSX.Element => {
|
|
276
303
|
return (
|
|
277
304
|
<View style={recentInsulinStyles.container}>
|
|
@@ -367,7 +394,7 @@ const recentInsulinStyles = StyleSheet.create({
|
|
|
367
394
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
368
395
|
Code coverage generated by
|
|
369
396
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
370
|
-
at
|
|
397
|
+
at Thu Jul 29 2021 07:55:43 GMT+0000 (Coordinated Universal Time)
|
|
371
398
|
</div>
|
|
372
399
|
</div>
|
|
373
400
|
<script src="../../prettify.js"></script>
|
|
@@ -278,7 +278,67 @@
|
|
|
278
278
|
<a name='L219'></a><a href='#L219'>219</a>
|
|
279
279
|
<a name='L220'></a><a href='#L220'>220</a>
|
|
280
280
|
<a name='L221'></a><a href='#L221'>221</a>
|
|
281
|
-
<a name='L222'></a><a href='#L222'>222</a
|
|
281
|
+
<a name='L222'></a><a href='#L222'>222</a>
|
|
282
|
+
<a name='L223'></a><a href='#L223'>223</a>
|
|
283
|
+
<a name='L224'></a><a href='#L224'>224</a>
|
|
284
|
+
<a name='L225'></a><a href='#L225'>225</a>
|
|
285
|
+
<a name='L226'></a><a href='#L226'>226</a>
|
|
286
|
+
<a name='L227'></a><a href='#L227'>227</a>
|
|
287
|
+
<a name='L228'></a><a href='#L228'>228</a>
|
|
288
|
+
<a name='L229'></a><a href='#L229'>229</a>
|
|
289
|
+
<a name='L230'></a><a href='#L230'>230</a>
|
|
290
|
+
<a name='L231'></a><a href='#L231'>231</a>
|
|
291
|
+
<a name='L232'></a><a href='#L232'>232</a>
|
|
292
|
+
<a name='L233'></a><a href='#L233'>233</a>
|
|
293
|
+
<a name='L234'></a><a href='#L234'>234</a>
|
|
294
|
+
<a name='L235'></a><a href='#L235'>235</a>
|
|
295
|
+
<a name='L236'></a><a href='#L236'>236</a>
|
|
296
|
+
<a name='L237'></a><a href='#L237'>237</a>
|
|
297
|
+
<a name='L238'></a><a href='#L238'>238</a>
|
|
298
|
+
<a name='L239'></a><a href='#L239'>239</a>
|
|
299
|
+
<a name='L240'></a><a href='#L240'>240</a>
|
|
300
|
+
<a name='L241'></a><a href='#L241'>241</a>
|
|
301
|
+
<a name='L242'></a><a href='#L242'>242</a>
|
|
302
|
+
<a name='L243'></a><a href='#L243'>243</a>
|
|
303
|
+
<a name='L244'></a><a href='#L244'>244</a>
|
|
304
|
+
<a name='L245'></a><a href='#L245'>245</a>
|
|
305
|
+
<a name='L246'></a><a href='#L246'>246</a>
|
|
306
|
+
<a name='L247'></a><a href='#L247'>247</a>
|
|
307
|
+
<a name='L248'></a><a href='#L248'>248</a>
|
|
308
|
+
<a name='L249'></a><a href='#L249'>249</a>
|
|
309
|
+
<a name='L250'></a><a href='#L250'>250</a>
|
|
310
|
+
<a name='L251'></a><a href='#L251'>251</a>
|
|
311
|
+
<a name='L252'></a><a href='#L252'>252</a>
|
|
312
|
+
<a name='L253'></a><a href='#L253'>253</a>
|
|
313
|
+
<a name='L254'></a><a href='#L254'>254</a>
|
|
314
|
+
<a name='L255'></a><a href='#L255'>255</a>
|
|
315
|
+
<a name='L256'></a><a href='#L256'>256</a>
|
|
316
|
+
<a name='L257'></a><a href='#L257'>257</a>
|
|
317
|
+
<a name='L258'></a><a href='#L258'>258</a>
|
|
318
|
+
<a name='L259'></a><a href='#L259'>259</a>
|
|
319
|
+
<a name='L260'></a><a href='#L260'>260</a>
|
|
320
|
+
<a name='L261'></a><a href='#L261'>261</a>
|
|
321
|
+
<a name='L262'></a><a href='#L262'>262</a>
|
|
322
|
+
<a name='L263'></a><a href='#L263'>263</a>
|
|
323
|
+
<a name='L264'></a><a href='#L264'>264</a>
|
|
324
|
+
<a name='L265'></a><a href='#L265'>265</a>
|
|
325
|
+
<a name='L266'></a><a href='#L266'>266</a>
|
|
326
|
+
<a name='L267'></a><a href='#L267'>267</a>
|
|
327
|
+
<a name='L268'></a><a href='#L268'>268</a>
|
|
328
|
+
<a name='L269'></a><a href='#L269'>269</a>
|
|
329
|
+
<a name='L270'></a><a href='#L270'>270</a>
|
|
330
|
+
<a name='L271'></a><a href='#L271'>271</a>
|
|
331
|
+
<a name='L272'></a><a href='#L272'>272</a>
|
|
332
|
+
<a name='L273'></a><a href='#L273'>273</a>
|
|
333
|
+
<a name='L274'></a><a href='#L274'>274</a>
|
|
334
|
+
<a name='L275'></a><a href='#L275'>275</a>
|
|
335
|
+
<a name='L276'></a><a href='#L276'>276</a>
|
|
336
|
+
<a name='L277'></a><a href='#L277'>277</a>
|
|
337
|
+
<a name='L278'></a><a href='#L278'>278</a>
|
|
338
|
+
<a name='L279'></a><a href='#L279'>279</a>
|
|
339
|
+
<a name='L280'></a><a href='#L280'>280</a>
|
|
340
|
+
<a name='L281'></a><a href='#L281'>281</a>
|
|
341
|
+
<a name='L282'></a><a href='#L282'>282</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
282
342
|
<span class="cline-any cline-neutral"> </span>
|
|
283
343
|
<span class="cline-any cline-neutral"> </span>
|
|
284
344
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -303,18 +363,60 @@
|
|
|
303
363
|
<span class="cline-any cline-neutral"> </span>
|
|
304
364
|
<span class="cline-any cline-neutral"> </span>
|
|
305
365
|
<span class="cline-any cline-neutral"> </span>
|
|
366
|
+
<span class="cline-any cline-neutral"> </span>
|
|
367
|
+
<span class="cline-any cline-neutral"> </span>
|
|
368
|
+
<span class="cline-any cline-neutral"> </span>
|
|
369
|
+
<span class="cline-any cline-neutral"> </span>
|
|
370
|
+
<span class="cline-any cline-neutral"> </span>
|
|
371
|
+
<span class="cline-any cline-neutral"> </span>
|
|
372
|
+
<span class="cline-any cline-neutral"> </span>
|
|
373
|
+
<span class="cline-any cline-neutral"> </span>
|
|
374
|
+
<span class="cline-any cline-neutral"> </span>
|
|
375
|
+
<span class="cline-any cline-neutral"> </span>
|
|
376
|
+
<span class="cline-any cline-neutral"> </span>
|
|
377
|
+
<span class="cline-any cline-neutral"> </span>
|
|
378
|
+
<span class="cline-any cline-neutral"> </span>
|
|
379
|
+
<span class="cline-any cline-neutral"> </span>
|
|
380
|
+
<span class="cline-any cline-neutral"> </span>
|
|
381
|
+
<span class="cline-any cline-neutral"> </span>
|
|
382
|
+
<span class="cline-any cline-neutral"> </span>
|
|
383
|
+
<span class="cline-any cline-neutral"> </span>
|
|
384
|
+
<span class="cline-any cline-neutral"> </span>
|
|
385
|
+
<span class="cline-any cline-neutral"> </span>
|
|
386
|
+
<span class="cline-any cline-neutral"> </span>
|
|
387
|
+
<span class="cline-any cline-neutral"> </span>
|
|
388
|
+
<span class="cline-any cline-neutral"> </span>
|
|
389
|
+
<span class="cline-any cline-neutral"> </span>
|
|
390
|
+
<span class="cline-any cline-neutral"> </span>
|
|
391
|
+
<span class="cline-any cline-neutral"> </span>
|
|
392
|
+
<span class="cline-any cline-neutral"> </span>
|
|
393
|
+
<span class="cline-any cline-neutral"> </span>
|
|
394
|
+
<span class="cline-any cline-neutral"> </span>
|
|
306
395
|
<span class="cline-any cline-yes">73x</span>
|
|
307
396
|
<span class="cline-any cline-yes">73x</span>
|
|
308
397
|
<span class="cline-any cline-neutral"> </span>
|
|
309
398
|
<span class="cline-any cline-neutral"> </span>
|
|
310
399
|
<span class="cline-any cline-neutral"> </span>
|
|
311
400
|
<span class="cline-any cline-neutral"> </span>
|
|
401
|
+
<span class="cline-any cline-neutral"> </span>
|
|
402
|
+
<span class="cline-any cline-neutral"> </span>
|
|
403
|
+
<span class="cline-any cline-neutral"> </span>
|
|
404
|
+
<span class="cline-any cline-neutral"> </span>
|
|
405
|
+
<span class="cline-any cline-neutral"> </span>
|
|
406
|
+
<span class="cline-any cline-neutral"> </span>
|
|
407
|
+
<span class="cline-any cline-neutral"> </span>
|
|
408
|
+
<span class="cline-any cline-neutral"> </span>
|
|
312
409
|
<span class="cline-any cline-yes">73x</span>
|
|
313
410
|
<span class="cline-any cline-yes">3x</span>
|
|
314
411
|
<span class="cline-any cline-yes">3x</span>
|
|
315
412
|
<span class="cline-any cline-yes">3x</span>
|
|
316
413
|
<span class="cline-any cline-neutral"> </span>
|
|
317
414
|
<span class="cline-any cline-neutral"> </span>
|
|
415
|
+
<span class="cline-any cline-neutral"> </span>
|
|
416
|
+
<span class="cline-any cline-neutral"> </span>
|
|
417
|
+
<span class="cline-any cline-neutral"> </span>
|
|
418
|
+
<span class="cline-any cline-neutral"> </span>
|
|
419
|
+
<span class="cline-any cline-neutral"> </span>
|
|
318
420
|
<span class="cline-any cline-yes">73x</span>
|
|
319
421
|
<span class="cline-any cline-yes">36x</span>
|
|
320
422
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -338,6 +440,11 @@
|
|
|
338
440
|
<span class="cline-any cline-neutral"> </span>
|
|
339
441
|
<span class="cline-any cline-neutral"> </span>
|
|
340
442
|
<span class="cline-any cline-neutral"> </span>
|
|
443
|
+
<span class="cline-any cline-neutral"> </span>
|
|
444
|
+
<span class="cline-any cline-neutral"> </span>
|
|
445
|
+
<span class="cline-any cline-neutral"> </span>
|
|
446
|
+
<span class="cline-any cline-neutral"> </span>
|
|
447
|
+
<span class="cline-any cline-neutral"> </span>
|
|
341
448
|
<span class="cline-any cline-yes">73x</span>
|
|
342
449
|
<span class="cline-any cline-yes">36x</span>
|
|
343
450
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -372,6 +479,9 @@
|
|
|
372
479
|
<span class="cline-any cline-neutral"> </span>
|
|
373
480
|
<span class="cline-any cline-neutral"> </span>
|
|
374
481
|
<span class="cline-any cline-neutral"> </span>
|
|
482
|
+
<span class="cline-any cline-neutral"> </span>
|
|
483
|
+
<span class="cline-any cline-neutral"> </span>
|
|
484
|
+
<span class="cline-any cline-neutral"> </span>
|
|
375
485
|
<span class="cline-any cline-yes">73x</span>
|
|
376
486
|
<span class="cline-any cline-yes">141x</span>
|
|
377
487
|
<span class="cline-any cline-yes">141x</span>
|
|
@@ -401,12 +511,21 @@
|
|
|
401
511
|
<span class="cline-any cline-neutral"> </span>
|
|
402
512
|
<span class="cline-any cline-neutral"> </span>
|
|
403
513
|
<span class="cline-any cline-neutral"> </span>
|
|
514
|
+
<span class="cline-any cline-neutral"> </span>
|
|
515
|
+
<span class="cline-any cline-neutral"> </span>
|
|
516
|
+
<span class="cline-any cline-neutral"> </span>
|
|
517
|
+
<span class="cline-any cline-neutral"> </span>
|
|
404
518
|
<span class="cline-any cline-yes">73x</span>
|
|
405
519
|
<span class="cline-any cline-yes">3x</span>
|
|
406
520
|
<span class="cline-any cline-yes">3x</span>
|
|
407
521
|
<span class="cline-any cline-neutral"> </span>
|
|
408
522
|
<span class="cline-any cline-neutral"> </span>
|
|
409
523
|
<span class="cline-any cline-neutral"> </span>
|
|
524
|
+
<span class="cline-any cline-neutral"> </span>
|
|
525
|
+
<span class="cline-any cline-neutral"> </span>
|
|
526
|
+
<span class="cline-any cline-neutral"> </span>
|
|
527
|
+
<span class="cline-any cline-neutral"> </span>
|
|
528
|
+
<span class="cline-any cline-neutral"> </span>
|
|
410
529
|
<span class="cline-any cline-yes">144x</span>
|
|
411
530
|
<span class="cline-any cline-yes">144x</span>
|
|
412
531
|
<span class="cline-any cline-yes">144x</span>
|
|
@@ -428,6 +547,7 @@
|
|
|
428
547
|
<span class="cline-any cline-yes">4x</span>
|
|
429
548
|
<span class="cline-any cline-yes">4x</span>
|
|
430
549
|
<span class="cline-any cline-neutral"> </span>
|
|
550
|
+
<span class="cline-any cline-neutral"> </span>
|
|
431
551
|
<span class="cline-any cline-yes">4x</span>
|
|
432
552
|
<span class="cline-any cline-neutral"> </span>
|
|
433
553
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -510,19 +630,48 @@ import LimitationMessage from "./LimitationMessage";
|
|
|
510
630
|
|
|
511
631
|
const { RecommendationModalTestIds } = Testing.Id;
|
|
512
632
|
|
|
513
|
-
interface IModalProps {
|
|
633
|
+
export interface IModalProps {
|
|
634
|
+
/** Whether or not the modal should currently be displayed on the screen */
|
|
514
635
|
isVisible: boolean;
|
|
636
|
+
/** The amount of additional carbohydrates that is being recommended for the user in grams. */
|
|
515
637
|
suggestedCarbohydrates: number | null;
|
|
638
|
+
/** A message to display to the user to inform them in natural language about special recommendations or warnings from HDA. */
|
|
516
639
|
attentionMessage: string | null;
|
|
640
|
+
/** A message to display to the user to inform them if their insulin recommendation was limited by the maximum threshold. */
|
|
517
641
|
limitationMessage: string | null;
|
|
642
|
+
/** Callback function taking no arguments and returning no value - Should be called if the user taps the “OK” button on the modal. */
|
|
518
643
|
onClickOkButton(): void;
|
|
644
|
+
/**
|
|
645
|
+
* Callback function taking no arguments and returning no value.
|
|
646
|
+
* Should be called if the user taps the “accept” button when they are recommended to eat additional carbohydrates.
|
|
647
|
+
*/
|
|
519
648
|
onAcceptCarbohydrates(): void;
|
|
649
|
+
/**
|
|
650
|
+
* Callback function taking no arguments and returning no value.
|
|
651
|
+
* Should be called if the user taps the “decline” button when they are recommended to eat additional carbohydrates.
|
|
652
|
+
*/
|
|
520
653
|
onDeclineCarbohydrates(): void;
|
|
521
654
|
}
|
|
522
|
-
interface IModalState {
|
|
655
|
+
export interface IModalState {
|
|
656
|
+
/** If true then the first page will be displayed, otherwise the second page will be displayed. */
|
|
523
657
|
firstPageVisible: boolean;
|
|
524
658
|
}
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* Popup modal for displaying information messages or warnings to the user if necessary.
|
|
662
|
+
* The modal has two “pages” with different content that it is able to display.
|
|
663
|
+
* The first page is for informing the user if their insulin recommendation was limited by the maximum insulin safety limit.
|
|
664
|
+
* This page will only be displayed if the recommendation was actually limited.
|
|
665
|
+
* The second page is for displaying a general attention message that may contain instructions for the user,
|
|
666
|
+
* and for letting the user know if they are being recommended eating additional carbohydrates.
|
|
667
|
+
*/
|
|
525
668
|
export default class RecommendationModal extends React.Component<IModalProps, IModalState> {
|
|
669
|
+
/**
|
|
670
|
+
* Steps:
|
|
671
|
+
* 1. Call the super() method with the props.
|
|
672
|
+
* 2. Set the firstPageVisible state variable true if the limitationMessage prop is truthy.
|
|
673
|
+
* @param props The class props
|
|
674
|
+
*/
|
|
526
675
|
constructor(props: IModalProps) {
|
|
527
676
|
super(props);
|
|
528
677
|
this.state = {
|
|
@@ -530,12 +679,25 @@ export default class RecommendationModal extends React.Component<IModalProps,
|
|
|
530
679
|
};
|
|
531
680
|
}
|
|
532
681
|
|
|
682
|
+
/**
|
|
683
|
+
* Handle what happens when the “next” button is pressed.
|
|
684
|
+
*
|
|
685
|
+
* Steps:
|
|
686
|
+
* 1. Unpack attentionMessage and suggestedCarbohydrates from the props object.
|
|
687
|
+
* 2. Define isPageVisible to be true if either attentionMessage or suggestedCarbohydrates is truthy.
|
|
688
|
+
* 3. If isPageVisible is true then set the firstPageVisible state variable to false. Otherwise call the onClickOkButton prop callback function.
|
|
689
|
+
*/
|
|
533
690
|
public onPressNextButton = (): void => {
|
|
534
691
|
const { attentionMessage, suggestedCarbohydrates } = this.props;
|
|
535
692
|
const isPageVisible = !!attentionMessage || !!suggestedCarbohydrates;
|
|
536
693
|
return isPageVisible ? this.setState({ firstPageVisible: false }) : this.props.onClickOkButton();
|
|
537
694
|
};
|
|
538
695
|
|
|
696
|
+
/**
|
|
697
|
+
* @returns Return an JSX element for composing two buttons: one for accepting a suggestion and one for rejecting it.
|
|
698
|
+
* If the accept button is pressed the onAcceptCarbohydrates prop callback function shall be called.
|
|
699
|
+
* If the accept button is pressed the onDeclineCarbohydrates prop callback function shall be called.
|
|
700
|
+
*/
|
|
539
701
|
public recommendationButtons = (): JSX.Element => {
|
|
540
702
|
return (
|
|
541
703
|
<View style={stylesModal.recommendationButtonsContainer}>
|
|
@@ -559,6 +721,11 @@ export default class RecommendationModal extends React.Component<IModalProps,
|
|
|
559
721
|
);
|
|
560
722
|
};
|
|
561
723
|
|
|
724
|
+
/**
|
|
725
|
+
* Compose a JSX element for displaying a recommendation of additional carbohydrates (the value of the suggestedCarbohydrates prop rounded to the nearest integer)
|
|
726
|
+
* to the user in a way that explains what to do with the suggestion.
|
|
727
|
+
* @param suggestedCarbohydrates the recommended additional carbohydrates
|
|
728
|
+
*/
|
|
562
729
|
public recommendCarbohydrates = (suggestedCarbohydrates: number): JSX.Element => {
|
|
563
730
|
const displayCarbs = Math.round(suggestedCarbohydrates);
|
|
564
731
|
|
|
@@ -593,6 +760,9 @@ export default class RecommendationModal extends React.Component<IModalProps,
|
|
|
593
760
|
);
|
|
594
761
|
};
|
|
595
762
|
|
|
763
|
+
/**
|
|
764
|
+
* @returns JSX element for displaying the “second” page of the recommendation modal. The second page displays the string from the attentionMessage prop.
|
|
765
|
+
*/
|
|
596
766
|
public secondPage = (): JSX.Element => {
|
|
597
767
|
const { attentionMessage, suggestedCarbohydrates } = this.props;
|
|
598
768
|
const willRecommendCarbs = suggestedCarbohydrates !== null && suggestedCarbohydrates > 0;
|
|
@@ -622,11 +792,20 @@ export default class RecommendationModal extends React.Component<IModalProps,
|
|
|
622
792
|
);
|
|
623
793
|
};
|
|
624
794
|
|
|
795
|
+
/**
|
|
796
|
+
* @returns JSX element for displaying the “first” page of the recommendation modal.
|
|
797
|
+
* The first page consists of a limitation message rendered using a LimitationMessage component.
|
|
798
|
+
*/
|
|
625
799
|
public firstPage = (): JSX.Element => {
|
|
626
800
|
const { limitationMessage } = this.props;
|
|
627
801
|
return <LimitationMessage limitationMessage={limitationMessage} onPressNextButton={this.onPressNextButton} />;
|
|
628
802
|
};
|
|
629
803
|
|
|
804
|
+
/**
|
|
805
|
+
* @returns JSX element for rendering a modal that is visible if the isVisible prop is true.
|
|
806
|
+
* If the firstPageVisible state variable is true then use firstPage() to render the first page.
|
|
807
|
+
* Otherwise use secondPage() to render the second page.
|
|
808
|
+
*/
|
|
630
809
|
public render(): JSX.Element {
|
|
631
810
|
const { isVisible } = this.props;
|
|
632
811
|
const { firstPageVisible } = this.state;
|
|
@@ -649,6 +828,7 @@ const recommendEatingFontSize = height / 45;
|
|
|
649
828
|
const textFontSize = width / 20;
|
|
650
829
|
const titleFontSize = width / 13;
|
|
651
830
|
|
|
831
|
+
/** @internal */
|
|
652
832
|
export const stylesModal = StyleSheet.create({
|
|
653
833
|
modalStyle: { margin: 0 },
|
|
654
834
|
container: {
|
|
@@ -727,7 +907,7 @@ export const stylesModal = StyleSheet.create({
|
|
|
727
907
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
728
908
|
Code coverage generated by
|
|
729
909
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
730
|
-
at
|
|
910
|
+
at Thu Jul 29 2021 07:55:43 GMT+0000 (Coordinated Universal Time)
|
|
731
911
|
</div>
|
|
732
912
|
</div>
|
|
733
913
|
<script src="../../prettify.js"></script>
|