@hedia/recommendation-screen 1.5.1 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.idea/workspace.xml +131 -25
- package/package.json +2 -1
- package/src/RecommendationScreen.d.ts +10 -3
- package/src/RecommendationScreen.jsx +23 -10
- package/src/RecommendationScreen.tsx +50 -16
- package/src/components/InfoBars.d.ts +4 -1
- package/src/components/InfoBars.jsx +19 -3
- package/src/components/InfoBars.tsx +19 -4
- package/src/locale/da/messages.js +1 -1
- package/src/locale/da/messages.po +30 -18
- package/src/locale/en/messages.js +1 -1
- package/src/locale/en/messages.po +30 -18
- package/src/types/enum.d.ts +7 -9
- package/src/types/enum.js +8 -11
- package/src/types/enum.ts +3 -6
- package/src/utils/Constants.d.ts +5 -2
- package/src/utils/Constants.js +6 -3
- package/src/utils/Constants.ts +6 -2
- package/src/utils/RecommendationError.d.ts +3 -1
- package/src/utils/RecommendationError.jsx +4 -2
- package/src/utils/RecommendationError.tsx +12 -2
- package/src/utils/Utils.d.ts +6 -1
- package/src/utils/Utils.js +17 -2
- package/src/utils/Utils.ts +21 -3
- package/src/utils/Validations.d.ts +5 -2
- package/src/utils/Validations.js +28 -7
- package/src/utils/Validations.ts +32 -7
package/.idea/workspace.xml
CHANGED
|
@@ -181,7 +181,16 @@
|
|
|
181
181
|
<workItem from="1600240204155" duration="5382000" />
|
|
182
182
|
<workItem from="1600680315485" duration="15484000" />
|
|
183
183
|
<workItem from="1600762530394" duration="2312000" />
|
|
184
|
-
<workItem from="1601281403601" duration="
|
|
184
|
+
<workItem from="1601281403601" duration="8208000" />
|
|
185
|
+
<workItem from="1601639667672" duration="898000" />
|
|
186
|
+
<workItem from="1601883005682" duration="10293000" />
|
|
187
|
+
<workItem from="1601903898220" duration="2267000" />
|
|
188
|
+
<workItem from="1601972128642" duration="3574000" />
|
|
189
|
+
<workItem from="1602064836586" duration="3708000" />
|
|
190
|
+
<workItem from="1602165438473" duration="1424000" />
|
|
191
|
+
<workItem from="1602229083262" duration="2936000" />
|
|
192
|
+
<workItem from="1602239231218" duration="802000" />
|
|
193
|
+
<workItem from="1602487231033" duration="6016000" />
|
|
185
194
|
</task>
|
|
186
195
|
<servers />
|
|
187
196
|
</component>
|
|
@@ -189,7 +198,102 @@
|
|
|
189
198
|
<option name="version" value="3" />
|
|
190
199
|
<option name="exactExcludedFiles">
|
|
191
200
|
<list>
|
|
201
|
+
<option value="$PROJECT_DIR$/src/__tests__/components/Remeasure.test.d.ts" />
|
|
202
|
+
<option value="$PROJECT_DIR$/src/__tests__/components/TransferToLogbook.test.d.ts" />
|
|
203
|
+
<option value="$PROJECT_DIR$/src/__tests__/components/RecommendedCarbs.test.jsx" />
|
|
204
|
+
<option value="$PROJECT_DIR$/src/__tests__/components/Emotion.test.d.ts" />
|
|
205
|
+
<option value="$PROJECT_DIR$/src/__tests__/components/MoodIcon.test.d.ts" />
|
|
206
|
+
<option value="$PROJECT_DIR$/src/__tests__/components/InvisibleNumberInput.test.d.ts" />
|
|
207
|
+
<option value="$PROJECT_DIR$/src/__tests__/components/InfoBars.test.jsx" />
|
|
208
|
+
<option value="$PROJECT_DIR$/src/__tests__/components/Remeasure.test.jsx" />
|
|
209
|
+
<option value="$PROJECT_DIR$/src/__tests__/Translate.test.jsx" />
|
|
210
|
+
<option value="$PROJECT_DIR$/src/__tests__/Utils.test.d.ts" />
|
|
211
|
+
<option value="$PROJECT_DIR$/src/__tests__/RecommendationUtils.test.d.ts" />
|
|
212
|
+
<option value="$PROJECT_DIR$/src/__tests__/RecommendationScreen.test.d.ts" />
|
|
213
|
+
<option value="$PROJECT_DIR$/src/__tests__/components/RecommendationModal.test.d.ts" />
|
|
214
|
+
<option value="$PROJECT_DIR$/src/__tests__/components/RecommendedCarbs.test.d.ts" />
|
|
215
|
+
<option value="$PROJECT_DIR$/src/__tests__/components/InfoBars.test.d.ts" />
|
|
216
|
+
<option value="$PROJECT_DIR$/src/__tests__/components/MoodIcon.test.jsx" />
|
|
217
|
+
<option value="$PROJECT_DIR$/src/__tests__/Utils.test.js" />
|
|
218
|
+
<option value="$PROJECT_DIR$/src/__tests__/RecommendationScreen.test.jsx" />
|
|
219
|
+
<option value="$PROJECT_DIR$/src/__tests__/Validations.test.d.ts" />
|
|
220
|
+
<option value="$PROJECT_DIR$/src/__tests__/Validations.test.js" />
|
|
221
|
+
<option value="$PROJECT_DIR$/src/__tests__/utils.jsx" />
|
|
222
|
+
<option value="$PROJECT_DIR$/src/__tests__/Translate.test.d.ts" />
|
|
223
|
+
<option value="$PROJECT_DIR$/src/__tests__/utils.d.ts" />
|
|
224
|
+
<option value="$PROJECT_DIR$/src/__tests__/RecommendationUtils.test.js" />
|
|
225
|
+
<option value="$PROJECT_DIR$/src/components/Remeasure.jsx" />
|
|
226
|
+
<option value="$PROJECT_DIR$/src/components/LineSeparator.d.ts" />
|
|
227
|
+
<option value="$PROJECT_DIR$/src/components/RecentInsulin.jsx" />
|
|
228
|
+
<option value="$PROJECT_DIR$/src/components/TwoOptionModal.jsx" />
|
|
229
|
+
<option value="$PROJECT_DIR$/src/components/RecommendedCarbs.jsx" />
|
|
230
|
+
<option value="$PROJECT_DIR$/src/components/LimitationMessage.d.ts" />
|
|
231
|
+
<option value="$PROJECT_DIR$/src/components/TransferToLogbook.jsx" />
|
|
232
|
+
<option value="$PROJECT_DIR$/src/components/RecommendedInsulin.d.ts" />
|
|
233
|
+
<option value="$PROJECT_DIR$/src/components/RecommendationModal.d.ts" />
|
|
234
|
+
<option value="$PROJECT_DIR$/src/components/InfoBars.d.ts" />
|
|
235
|
+
<option value="$PROJECT_DIR$/src/components/Header.d.ts" />
|
|
236
|
+
<option value="$PROJECT_DIR$/src/components/Remeasure.d.ts" />
|
|
237
|
+
<option value="$PROJECT_DIR$/src/components/LineSeparator.jsx" />
|
|
238
|
+
<option value="$PROJECT_DIR$/src/components/LimitationMessage.jsx" />
|
|
239
|
+
<option value="$PROJECT_DIR$/src/components/TransferToLogbook.d.ts" />
|
|
240
|
+
<option value="$PROJECT_DIR$/src/components/RecommendedInsulin.jsx" />
|
|
241
|
+
<option value="$PROJECT_DIR$/src/components/InvisibleNumberInput.jsx" />
|
|
242
|
+
<option value="$PROJECT_DIR$/src/components/Header.jsx" />
|
|
243
|
+
<option value="$PROJECT_DIR$/src/components/RecentInsulin.d.ts" />
|
|
244
|
+
<option value="$PROJECT_DIR$/src/components/RecommendationModal.jsx" />
|
|
245
|
+
<option value="$PROJECT_DIR$/src/components/TwoOptionModal.d.ts" />
|
|
246
|
+
<option value="$PROJECT_DIR$/src/components/RecommendedCarbs.d.ts" />
|
|
247
|
+
<option value="$PROJECT_DIR$/src/components/InvisibleNumberInput.d.ts" />
|
|
248
|
+
<option value="$PROJECT_DIR$/src/components/InfoBars.jsx" />
|
|
249
|
+
<option value="$PROJECT_DIR$/src/utils/Constants.js" />
|
|
250
|
+
<option value="$PROJECT_DIR$/src/utils/Validations.d.ts" />
|
|
251
|
+
<option value="$PROJECT_DIR$/src/utils/Utils.js" />
|
|
252
|
+
<option value="$PROJECT_DIR$/src/utils/Validations.js" />
|
|
253
|
+
<option value="$PROJECT_DIR$/src/types/types.js" />
|
|
254
|
+
<option value="$PROJECT_DIR$/src/types/types.d.ts" />
|
|
255
|
+
<option value="$PROJECT_DIR$/src/types/enum.js" />
|
|
256
|
+
<option value="$PROJECT_DIR$/src/types/enum.d.ts" />
|
|
257
|
+
<option value="$PROJECT_DIR$/src/utils/RecommendationError.jsx" />
|
|
258
|
+
<option value="$PROJECT_DIR$/src/utils/AttentionMessages.d.ts" />
|
|
259
|
+
<option value="$PROJECT_DIR$/src/utils/RecommendationUtils.js" />
|
|
260
|
+
<option value="$PROJECT_DIR$/src/utils/AttentionMessages.jsx" />
|
|
261
|
+
<option value="$PROJECT_DIR$/src/utils/Utils.d.ts" />
|
|
262
|
+
<option value="$PROJECT_DIR$/src/utils/Constants.d.ts" />
|
|
263
|
+
<option value="$PROJECT_DIR$/src/utils/RecommendationError.d.ts" />
|
|
264
|
+
<option value="$PROJECT_DIR$/src/utils/RecommendationUtils.d.ts" />
|
|
265
|
+
<option value="$PROJECT_DIR$/src/components/mood/Emotion.jsx" />
|
|
266
|
+
<option value="$PROJECT_DIR$/src/components/mood/MoodIcon.jsx" />
|
|
267
|
+
<option value="$PROJECT_DIR$/src/components/activity/ActivityIntensity.jsx" />
|
|
268
|
+
<option value="$PROJECT_DIR$/src/components/activity/ActivityIcon.jsx" />
|
|
269
|
+
<option value="$PROJECT_DIR$/src/locale/i18nUtils.d.ts" />
|
|
270
|
+
<option value="$PROJECT_DIR$/src/locale/i18nUtils.js" />
|
|
271
|
+
<option value="$PROJECT_DIR$/src/components/mood/Emotion.d.ts" />
|
|
272
|
+
<option value="$PROJECT_DIR$/src/components/mood/MoodIcon.d.ts" />
|
|
273
|
+
<option value="$PROJECT_DIR$/index.d.ts" />
|
|
192
274
|
<option value="$PROJECT_DIR$/index.js" />
|
|
275
|
+
<option value="$PROJECT_DIR$/App.jsx" />
|
|
276
|
+
<option value="$PROJECT_DIR$/App.d.ts" />
|
|
277
|
+
<option value="$PROJECT_DIR$/src/components/activity/Activity.jsx" />
|
|
278
|
+
<option value="$PROJECT_DIR$/src/components/activity/ActivityIntensity.d.ts" />
|
|
279
|
+
<option value="$PROJECT_DIR$/src/components/activity/Activity.d.ts" />
|
|
280
|
+
<option value="$PROJECT_DIR$/src/components/activity/ActivityIcon.d.ts" />
|
|
281
|
+
<option value="$PROJECT_DIR$/src/__tests__/components/Activity.test.jsx" />
|
|
282
|
+
<option value="$PROJECT_DIR$/src/__tests__/components/InvisibleNumberInput.test.jsx" />
|
|
283
|
+
<option value="$PROJECT_DIR$/src/__tests__/components/LimitationMessage.test.d.ts" />
|
|
284
|
+
<option value="$PROJECT_DIR$/src/__tests__/components/TwoOptionModal.test.jsx" />
|
|
285
|
+
<option value="$PROJECT_DIR$/src/RecommendationScreen.jsx" />
|
|
286
|
+
<option value="$PROJECT_DIR$/src/RecommendationScreen.d.ts" />
|
|
287
|
+
<option value="$PROJECT_DIR$/src/__tests__/components/TwoOptionModal.test.d.ts" />
|
|
288
|
+
<option value="$PROJECT_DIR$/src/__tests__/components/LimitationMessage.test.jsx" />
|
|
289
|
+
<option value="$PROJECT_DIR$/src/__tests__/components/Activity.test.d.ts" />
|
|
290
|
+
<option value="$PROJECT_DIR$/src/__tests__/components/Header.test.jsx" />
|
|
291
|
+
<option value="$PROJECT_DIR$/src/__tests__/components/Header.test.d.ts" />
|
|
292
|
+
<option value="$PROJECT_DIR$/src/__tests__/components/RecommendedInsulin.test.d.ts" />
|
|
293
|
+
<option value="$PROJECT_DIR$/src/__tests__/components/Emotion.test.jsx" />
|
|
294
|
+
<option value="$PROJECT_DIR$/src/__tests__/components/RecommendationModal.test.jsx" />
|
|
295
|
+
<option value="$PROJECT_DIR$/src/__tests__/components/TransferToLogbook.test.jsx" />
|
|
296
|
+
<option value="$PROJECT_DIR$/src/__tests__/components/RecommendedInsulin.test.jsx" />
|
|
193
297
|
</list>
|
|
194
298
|
</option>
|
|
195
299
|
</component>
|
|
@@ -242,45 +346,46 @@
|
|
|
242
346
|
<state x="1792" y="-66" width="3440" height="1159" key="DiffContextDialog/1792.-195.3440.1417/0.23.1792.1097@1792.-195.3440.1417" timestamp="1600171230341" />
|
|
243
347
|
<state x="0" y="123" width="1792" height="897" key="DiffContextDialog/1792.-410.1920.1057/0.23.1792.1097@0.23.1792.1097" timestamp="1600096736067" />
|
|
244
348
|
<state x="1792" y="-314" width="1920" height="865" key="DiffContextDialog/1792.-410.1920.1057/0.23.1792.1097@1792.-410.1920.1057" timestamp="1598603549140" />
|
|
245
|
-
<state width="
|
|
349
|
+
<state width="1357" height="316" key="GridCell.Tab.0.bottom" timestamp="1602506188647">
|
|
246
350
|
<screen x="0" y="23" width="1792" height="1097" />
|
|
247
351
|
</state>
|
|
248
352
|
<state width="1750" height="261" key="GridCell.Tab.0.bottom/-1920.-66.1920.1057/0.23.1792.1097@0.23.1792.1097" timestamp="1596194051670" />
|
|
249
|
-
<state width="
|
|
353
|
+
<state width="1357" height="316" key="GridCell.Tab.0.bottom/0.23.1792.1097@0.23.1792.1097" timestamp="1602506188647" />
|
|
250
354
|
<state width="1750" height="383" key="GridCell.Tab.0.bottom/1792.-195.3440.1417/0.23.1792.1097@0.23.1792.1097" timestamp="1597945008184" />
|
|
251
|
-
<state width="
|
|
355
|
+
<state width="1738" height="428" key="GridCell.Tab.0.bottom/1792.-195.3440.1417/0.23.1792.1097@1792.-195.3440.1417" timestamp="1602257501217" />
|
|
252
356
|
<state width="1321" height="264" key="GridCell.Tab.0.bottom/1792.-410.1920.1057/0.23.1792.1097@0.23.1792.1097" timestamp="1600268308807" />
|
|
253
357
|
<state width="1878" height="183" key="GridCell.Tab.0.bottom/1792.-410.1920.1057/0.23.1792.1097@1792.-410.1920.1057" timestamp="1599837918176" />
|
|
254
|
-
<state width="
|
|
358
|
+
<state width="1357" height="316" key="GridCell.Tab.0.center" timestamp="1602506188646">
|
|
255
359
|
<screen x="0" y="23" width="1792" height="1097" />
|
|
256
360
|
</state>
|
|
257
361
|
<state width="1750" height="261" key="GridCell.Tab.0.center/-1920.-66.1920.1057/0.23.1792.1097@0.23.1792.1097" timestamp="1596194051669" />
|
|
258
|
-
<state width="
|
|
362
|
+
<state width="1357" height="316" key="GridCell.Tab.0.center/0.23.1792.1097@0.23.1792.1097" timestamp="1602506188646" />
|
|
259
363
|
<state width="1750" height="383" key="GridCell.Tab.0.center/1792.-195.3440.1417/0.23.1792.1097@0.23.1792.1097" timestamp="1597945008183" />
|
|
260
|
-
<state width="
|
|
364
|
+
<state width="1738" height="428" key="GridCell.Tab.0.center/1792.-195.3440.1417/0.23.1792.1097@1792.-195.3440.1417" timestamp="1602257501216" />
|
|
261
365
|
<state width="1321" height="264" key="GridCell.Tab.0.center/1792.-410.1920.1057/0.23.1792.1097@0.23.1792.1097" timestamp="1600268308807" />
|
|
262
366
|
<state width="1878" height="183" key="GridCell.Tab.0.center/1792.-410.1920.1057/0.23.1792.1097@1792.-410.1920.1057" timestamp="1599837918175" />
|
|
263
|
-
<state width="
|
|
367
|
+
<state width="1357" height="316" key="GridCell.Tab.0.left" timestamp="1602506188645">
|
|
264
368
|
<screen x="0" y="23" width="1792" height="1097" />
|
|
265
369
|
</state>
|
|
266
370
|
<state width="1750" height="261" key="GridCell.Tab.0.left/-1920.-66.1920.1057/0.23.1792.1097@0.23.1792.1097" timestamp="1596194051668" />
|
|
267
|
-
<state width="
|
|
371
|
+
<state width="1357" height="316" key="GridCell.Tab.0.left/0.23.1792.1097@0.23.1792.1097" timestamp="1602506188645" />
|
|
268
372
|
<state width="1750" height="383" key="GridCell.Tab.0.left/1792.-195.3440.1417/0.23.1792.1097@0.23.1792.1097" timestamp="1597945008182" />
|
|
269
|
-
<state width="
|
|
373
|
+
<state width="1738" height="428" key="GridCell.Tab.0.left/1792.-195.3440.1417/0.23.1792.1097@1792.-195.3440.1417" timestamp="1602257501216" />
|
|
270
374
|
<state width="1321" height="264" key="GridCell.Tab.0.left/1792.-410.1920.1057/0.23.1792.1097@0.23.1792.1097" timestamp="1600268308806" />
|
|
271
375
|
<state width="1878" height="183" key="GridCell.Tab.0.left/1792.-410.1920.1057/0.23.1792.1097@1792.-410.1920.1057" timestamp="1599837918175" />
|
|
272
|
-
<state width="
|
|
376
|
+
<state width="1357" height="316" key="GridCell.Tab.0.right" timestamp="1602506188646">
|
|
273
377
|
<screen x="0" y="23" width="1792" height="1097" />
|
|
274
378
|
</state>
|
|
275
379
|
<state width="1750" height="261" key="GridCell.Tab.0.right/-1920.-66.1920.1057/0.23.1792.1097@0.23.1792.1097" timestamp="1596194051669" />
|
|
276
|
-
<state width="
|
|
380
|
+
<state width="1357" height="316" key="GridCell.Tab.0.right/0.23.1792.1097@0.23.1792.1097" timestamp="1602506188646" />
|
|
277
381
|
<state width="1750" height="383" key="GridCell.Tab.0.right/1792.-195.3440.1417/0.23.1792.1097@0.23.1792.1097" timestamp="1597945008183" />
|
|
278
|
-
<state width="
|
|
382
|
+
<state width="1738" height="428" key="GridCell.Tab.0.right/1792.-195.3440.1417/0.23.1792.1097@1792.-195.3440.1417" timestamp="1602257501217" />
|
|
279
383
|
<state width="1321" height="264" key="GridCell.Tab.0.right/1792.-410.1920.1057/0.23.1792.1097@0.23.1792.1097" timestamp="1600268308807" />
|
|
280
384
|
<state width="1878" height="183" key="GridCell.Tab.0.right/1792.-410.1920.1057/0.23.1792.1097@1792.-410.1920.1057" timestamp="1599837918176" />
|
|
281
|
-
<state x="
|
|
282
|
-
<screen x="
|
|
385
|
+
<state x="511" y="303" key="IDE.errors.dialog" timestamp="1602487312159">
|
|
386
|
+
<screen x="0" y="23" width="1792" height="1097" />
|
|
283
387
|
</state>
|
|
388
|
+
<state x="511" y="303" key="IDE.errors.dialog/0.23.1792.1097@0.23.1792.1097" timestamp="1602487312159" />
|
|
284
389
|
<state x="511" y="303" key="IDE.errors.dialog/1792.-195.3440.1417/0.23.1792.1097@0.23.1792.1097" timestamp="1597308623997" />
|
|
285
390
|
<state x="2773" y="167" key="IDE.errors.dialog/1792.-195.3440.1417/0.23.1792.1097@1792.-195.3440.1417" timestamp="1598973647546" />
|
|
286
391
|
<state x="2340" y="-140" key="IDE.errors.dialog/1792.-410.1920.1057/0.23.1792.1097@1792.-410.1920.1057" timestamp="1599637300780" />
|
|
@@ -300,22 +405,23 @@
|
|
|
300
405
|
<state x="2767" y="31" key="RollbackChangesDialog/1792.-195.3440.1417/0.23.1792.1097@1792.-195.3440.1417" timestamp="1598965839229" />
|
|
301
406
|
<state x="508" y="198" key="RollbackChangesDialog/1792.-410.1920.1057/0.23.1792.1097@0.23.1792.1097" timestamp="1600074907578" />
|
|
302
407
|
<state x="2336" y="-241" key="RollbackChangesDialog/1792.-410.1920.1057/0.23.1792.1097@1792.-410.1920.1057" timestamp="1599833353364" />
|
|
303
|
-
<state x="
|
|
304
|
-
<screen x="
|
|
408
|
+
<state x="397" y="210" key="SettingsEditor" timestamp="1602499684439">
|
|
409
|
+
<screen x="0" y="23" width="1792" height="1097" />
|
|
305
410
|
</state>
|
|
306
411
|
<state x="397" y="210" key="SettingsEditor/-1920.-66.1920.1057/0.23.1792.1097@0.23.1792.1097" timestamp="1596110346829" />
|
|
412
|
+
<state x="397" y="210" key="SettingsEditor/0.23.1792.1097@0.23.1792.1097" timestamp="1602499684439" />
|
|
307
413
|
<state x="2554" y="47" key="SettingsEditor/1792.-195.3440.1417/0.23.1792.1097@1792.-195.3440.1417" timestamp="1600695463879" />
|
|
308
414
|
<state x="428" y="230" key="com.intellij.openapi.vcs.changes.SpecificFilesViewDialog" timestamp="1596103115204">
|
|
309
415
|
<screen x="0" y="23" width="1792" height="1097" />
|
|
310
416
|
</state>
|
|
311
417
|
<state x="428" y="230" key="com.intellij.openapi.vcs.changes.SpecificFilesViewDialog/-1920.-66.1920.1057/0.23.1792.1097@0.23.1792.1097" timestamp="1596103115204" />
|
|
312
|
-
<state x="
|
|
313
|
-
<screen x="
|
|
418
|
+
<state x="559" y="310" width="1233" height="522" key="find.popup" timestamp="1602507247404">
|
|
419
|
+
<screen x="0" y="23" width="1792" height="1097" />
|
|
314
420
|
</state>
|
|
315
421
|
<state x="559" y="310" width="1233" height="522" key="find.popup/-1920.-66.1920.1057/0.23.1792.1097@0.23.1792.1097" timestamp="1596116959250" />
|
|
316
|
-
<state x="559" y="310" width="1233" height="522" key="find.popup/0.23.1792.1097@0.23.1792.1097" timestamp="
|
|
422
|
+
<state x="559" y="310" width="1233" height="522" key="find.popup/0.23.1792.1097@0.23.1792.1097" timestamp="1602507247404" />
|
|
317
423
|
<state x="558" y="310" width="1234" height="580" key="find.popup/1792.-195.3440.1417/0.23.1792.1097@0.23.1792.1097" timestamp="1597748403272" />
|
|
318
|
-
<state x="2491" y="140" width="2369" height="738" key="find.popup/1792.-195.3440.1417/0.23.1792.1097@1792.-195.3440.1417" timestamp="
|
|
424
|
+
<state x="2491" y="140" width="2369" height="738" key="find.popup/1792.-195.3440.1417/0.23.1792.1097@1792.-195.3440.1417" timestamp="1602165450739" />
|
|
319
425
|
<state x="558" y="310" width="1234" height="580" key="find.popup/1792.-410.1920.1057/0.23.1792.1097@0.23.1792.1097" timestamp="1600240789477" />
|
|
320
426
|
<state x="2390" y="-133" width="1322" height="582" key="find.popup/1792.-410.1920.1057/0.23.1792.1097@1792.-410.1920.1057" timestamp="1599833255779" />
|
|
321
427
|
<state width="600" height="440" key="javadoc.popup" timestamp="1600096493461">
|
|
@@ -326,13 +432,13 @@
|
|
|
326
432
|
<screen x="1792" y="-410" width="1920" height="1057" />
|
|
327
433
|
</state>
|
|
328
434
|
<state x="2477" y="-143" key="refactoring.ChangeSignatureDialog/1792.-410.1920.1057/0.23.1792.1097@1792.-410.1920.1057" timestamp="1599040674381" />
|
|
329
|
-
<state x="
|
|
330
|
-
<screen x="
|
|
435
|
+
<state x="360" y="268" width="670" height="676" key="search.everywhere.popup" timestamp="1602507231608">
|
|
436
|
+
<screen x="0" y="23" width="1792" height="1097" />
|
|
331
437
|
</state>
|
|
332
438
|
<state x="360" y="268" width="670" height="676" key="search.everywhere.popup/-1920.-66.1920.1057/0.23.1792.1097@0.23.1792.1097" timestamp="1596101738778" />
|
|
333
|
-
<state x="360" y="268" width="670" height="676" key="search.everywhere.popup/0.23.1792.1097@0.23.1792.1097" timestamp="
|
|
439
|
+
<state x="360" y="268" width="670" height="676" key="search.everywhere.popup/0.23.1792.1097@0.23.1792.1097" timestamp="1602507231608" />
|
|
334
440
|
<state x="360" y="268" width="671" height="677" key="search.everywhere.popup/1792.-195.3440.1417/0.23.1792.1097@0.23.1792.1097" timestamp="1597748285464" />
|
|
335
|
-
<state x="2484" y="121" width="1287" height="875" key="search.everywhere.popup/1792.-195.3440.1417/0.23.1792.1097@1792.-195.3440.1417" timestamp="
|
|
441
|
+
<state x="2484" y="121" width="1287" height="875" key="search.everywhere.popup/1792.-195.3440.1417/0.23.1792.1097@1792.-195.3440.1417" timestamp="1601982106446" />
|
|
336
442
|
<state x="360" y="268" width="671" height="677" key="search.everywhere.popup/1792.-410.1920.1057/0.23.1792.1097@0.23.1792.1097" timestamp="1600242616490" />
|
|
337
443
|
<state x="2178" y="-174" width="718" height="652" key="search.everywhere.popup/1792.-410.1920.1057/0.23.1792.1097@1792.-410.1920.1057" timestamp="1599833679258" />
|
|
338
444
|
</component>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hedia/recommendation-screen",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Hedia Recommendation Screen for Bolus and Carbohydrates",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"@babel/preset-react": "7.10.1",
|
|
43
43
|
"@babel/preset-typescript": "7.10.1",
|
|
44
44
|
"@hedia/recommendation-calculator": "1.3.0",
|
|
45
|
+
"@hedia/types": "1.0.2",
|
|
45
46
|
"@lingui/babel-preset-react": "2.9.1",
|
|
46
47
|
"@lingui/cli": "2.9.1",
|
|
47
48
|
"@lingui/macro": "2.9.1",
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { AppStateStatus } from "react-native";
|
|
3
|
+
import { InjectionMethod, Language, MoodEnum } from "./types/enum";
|
|
3
4
|
import * as Calculator from "@hedia/recommendation-calculator";
|
|
5
|
+
import { BloodGlucoseUnit, BloodKetonesUnit } from "@hedia/types";
|
|
4
6
|
import { RecommendationError } from "./utils/RecommendationError";
|
|
5
7
|
import { IActivityDisplayProps, logbookEntry } from "./types/types";
|
|
6
8
|
import { AttentionMessage } from "./utils/AttentionMessages";
|
|
@@ -9,18 +11,20 @@ interface IResult {
|
|
|
9
11
|
entered?: number;
|
|
10
12
|
}
|
|
11
13
|
export interface IRecommendationProps {
|
|
12
|
-
|
|
14
|
+
bloodGlucoseUnit: BloodGlucoseUnit;
|
|
13
15
|
language: Language;
|
|
14
16
|
userReminder: number;
|
|
15
17
|
calculatorParams: Calculator.IRecommendationParams;
|
|
16
18
|
injectionMethod: InjectionMethod;
|
|
19
|
+
currentBKL: number;
|
|
20
|
+
bloodKetoneUnit: BloodKetonesUnit;
|
|
17
21
|
latestLogbookFrom6Hours: logbookEntry;
|
|
18
22
|
activityDisplayProps: IActivityDisplayProps;
|
|
19
23
|
carbRecommendationAnswer(carbRecommendationAnswer: boolean): void;
|
|
20
24
|
closeCalculationCallback(): void;
|
|
21
25
|
exitCallback(): void;
|
|
22
26
|
onRecentInsulinYes(): void;
|
|
23
|
-
transferToLogbook(carbs: IResult, insulin: IResult, reminder: number, recommendationDate: Date): void;
|
|
27
|
+
transferToLogbook(carbs: IResult, insulin: IResult, reminder: number, recommendationDate: Date, mood: MoodEnum): void;
|
|
24
28
|
onError(error: RecommendationError): void;
|
|
25
29
|
showBolusBar(toggle: boolean): void;
|
|
26
30
|
restartCalculation(): void;
|
|
@@ -48,7 +52,10 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
48
52
|
private readonly recommendationDate;
|
|
49
53
|
private scrollView;
|
|
50
54
|
constructor(props: IRecommendationProps);
|
|
55
|
+
componentDidMount(): void;
|
|
51
56
|
componentWillUnmount(): void;
|
|
57
|
+
handleAppStateChange: (nextAppState: AppStateStatus) => void;
|
|
58
|
+
showTimeoutModal: () => void;
|
|
52
59
|
recalculateInsulin: (calculatorParams: Calculator.IRecommendationParams) => void;
|
|
53
60
|
onExit: () => void;
|
|
54
61
|
hideAttentionModal: () => void;
|
|
@@ -53,6 +53,15 @@ class RecommendationScreen extends react_1.default.Component {
|
|
|
53
53
|
constructor(props) {
|
|
54
54
|
super(props);
|
|
55
55
|
this.hasError = false;
|
|
56
|
+
this.handleAppStateChange = (nextAppState) => {
|
|
57
|
+
const isOlderThan15Minutes = global.Date.now() - this.recommendationDate.getTime() > enum_1.Milliseconds.Minute * 15;
|
|
58
|
+
if (nextAppState === `active` && isOlderThan15Minutes) {
|
|
59
|
+
this.showTimeoutModal();
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
this.showTimeoutModal = () => {
|
|
63
|
+
this.setState({ showTimeoutModal: true }, () => this.props.showBolusBar(!this.state.showTimeoutModal));
|
|
64
|
+
};
|
|
56
65
|
this.recalculateInsulin = (calculatorParams) => {
|
|
57
66
|
const { bolus, wasLimited, activityReduction } = Calculator.calculateRecommendation(calculatorParams);
|
|
58
67
|
this.setState({
|
|
@@ -124,11 +133,11 @@ class RecommendationScreen extends react_1.default.Component {
|
|
|
124
133
|
this.setState({ enteredInsulin });
|
|
125
134
|
};
|
|
126
135
|
this.handleTransfer = () => {
|
|
127
|
-
const { enteredCarbs, enteredInsulin, insulinRecommendation, remeasureTime, showExitModal } = this.state;
|
|
136
|
+
const { enteredCarbs, enteredInsulin, insulinRecommendation, remeasureTime, showExitModal, selectedMood, } = this.state;
|
|
128
137
|
const carbs = { suggested: this.suggestedCarbs, entered: enteredCarbs };
|
|
129
138
|
const insulin = { suggested: insulinRecommendation, entered: enteredInsulin };
|
|
130
139
|
showExitModal ? this.hideExitModal() : this.hideTimeoutModal();
|
|
131
|
-
this.props.transferToLogbook(carbs, insulin, remeasureTime, this.recommendationDate);
|
|
140
|
+
this.props.transferToLogbook(carbs, insulin, remeasureTime, this.recommendationDate, selectedMood);
|
|
132
141
|
};
|
|
133
142
|
this.getBGLevelAttentionMessage = () => {
|
|
134
143
|
const { calculatorParams, latestLogbookFrom6Hours } = this.props;
|
|
@@ -148,8 +157,8 @@ class RecommendationScreen extends react_1.default.Component {
|
|
|
148
157
|
};
|
|
149
158
|
try {
|
|
150
159
|
Validations_1.validateParams(props);
|
|
151
|
-
i18nUtils_1.changeLanguage(props.language);
|
|
152
160
|
this.recommendationDate = new Date(global.Date.now());
|
|
161
|
+
i18nUtils_1.changeLanguage(props.language);
|
|
153
162
|
const { recentBoluses } = props.calculatorParams;
|
|
154
163
|
const { bolus, carbRecommendation, activityReduction, wasLimited, activeInsulin, } = Calculator.calculateRecommendation(props.calculatorParams);
|
|
155
164
|
this.suggestedCarbs = carbRecommendation;
|
|
@@ -167,31 +176,35 @@ class RecommendationScreen extends react_1.default.Component {
|
|
|
167
176
|
showLimitationMessage: false,
|
|
168
177
|
showTimeoutModal: false,
|
|
169
178
|
};
|
|
170
|
-
this.timer = setTimeout(
|
|
171
|
-
this.setState({ showTimeoutModal: true }, () => this.props.showBolusBar(!this.state.showTimeoutModal));
|
|
172
|
-
}, enum_1.Milliseconds.Minute * 15);
|
|
179
|
+
this.timer = setTimeout(this.showTimeoutModal, enum_1.Milliseconds.Minute * 15);
|
|
173
180
|
}
|
|
174
181
|
catch (error) {
|
|
175
182
|
this.hasError = true;
|
|
176
183
|
props.onError(error);
|
|
177
184
|
}
|
|
178
185
|
}
|
|
186
|
+
componentDidMount() {
|
|
187
|
+
react_native_1.AppState.addEventListener(`change`, this.handleAppStateChange);
|
|
188
|
+
}
|
|
179
189
|
componentWillUnmount() {
|
|
180
190
|
clearTimeout(this.timer);
|
|
191
|
+
react_native_1.AppState.removeEventListener(`change`, this.handleAppStateChange);
|
|
181
192
|
}
|
|
182
193
|
render() {
|
|
183
194
|
if (this.hasError) {
|
|
184
195
|
return <react_native_1.View style={containerStyles.container}/>;
|
|
185
196
|
}
|
|
186
197
|
const { activeInsulin, recommendationModal, carbRecommendation, enteredCarbs, enteredInsulin, insulinRecommendation, activityReduction, isRecommendationDisplayed, } = this.state;
|
|
187
|
-
const { calculatorParams,
|
|
198
|
+
const { calculatorParams, bloodGlucoseUnit, currentBKL, bloodKetoneUnit } = this.props;
|
|
188
199
|
const { currentBGL, carbohydrates } = calculatorParams;
|
|
189
|
-
const displayedBGL =
|
|
200
|
+
const displayedBGL = Utils_1.Utils.displayedBGLValue(currentBGL, bloodGlucoseUnit);
|
|
201
|
+
const displayedBKL = Utils_1.Utils.displayedBKLValue(currentBKL, bloodKetoneUnit);
|
|
190
202
|
return (<react_2.I18nProvider language={this.props.language} i18n={i18nUtils_1.i18n}>
|
|
191
203
|
<react_native_1.ScrollView style={containerStyles.container} ref={(view) => (this.scrollView = view)}>
|
|
192
204
|
<Header_1.default exitCallback={this.onExit}/>
|
|
193
|
-
<InfoBars_1.default label={i18nUtils_1.i18n._(macro_1.t `Active Insulin`)} value={activeInsulin ? `${activeInsulin.toFixed(1)}` : null}
|
|
194
|
-
<InfoBars_1.default label={i18nUtils_1.i18n._(macro_1.t `Blood Glucose Level`)} value={currentBGL ? `${displayedBGL}` : null}
|
|
205
|
+
<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}/>
|
|
206
|
+
<InfoBars_1.default label={i18nUtils_1.i18n._(macro_1.t `Blood Glucose Level`)} value={currentBGL ? `${displayedBGL}` : null} unit={this.props.bloodGlucoseUnit} showNullAsDash={true}/>
|
|
207
|
+
<InfoBars_1.default label={i18nUtils_1.i18n._(macro_1.t `Blood Ketone Level`)} value={currentBKL ? `${displayedBKL}` : null} unit={this.props.bloodKetoneUnit} showNullAsDash={true}/>
|
|
195
208
|
<react_native_1.View style={containerStyles.calcContainer}>
|
|
196
209
|
<react_native_1.View style={containerStyles.calcMargin}>
|
|
197
210
|
<react_native_1.View style={[
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { ScrollView, StyleSheet, View, YellowBox } from "react-native";
|
|
2
|
+
import { AppState, AppStateStatus, ScrollView, StyleSheet, View, YellowBox } from "react-native";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { InjectionMethod, Language, Milliseconds, MoodEnum } from "./types/enum";
|
|
5
5
|
import { BACKGROUND_COLOUR_PURPLE, BORDER_COLOUR_GREY, BORDER_COLOUR_TEAL } from "./utils/Constants";
|
|
6
6
|
|
|
7
7
|
import Header, { headerStyles } from "./components/Header";
|
|
@@ -12,12 +12,14 @@ import RecommendedInsulin from "./components/RecommendedInsulin";
|
|
|
12
12
|
import Remeasure from "./components/Remeasure";
|
|
13
13
|
|
|
14
14
|
import * as Calculator from "@hedia/recommendation-calculator";
|
|
15
|
+
import { BloodGlucoseUnit, BloodKetonesUnit } from "@hedia/types";
|
|
15
16
|
import { I18nProvider } from "@lingui/react";
|
|
16
17
|
import Emotion from "./components/mood/Emotion";
|
|
17
18
|
import TransferToLogbook from "./components/TransferToLogbook";
|
|
18
19
|
import { RecommendationError } from "./utils/RecommendationError";
|
|
19
20
|
|
|
20
21
|
import { t } from "@lingui/macro";
|
|
22
|
+
|
|
21
23
|
import Activity from "./components/activity/Activity";
|
|
22
24
|
import LimitationMessage from "./components/LimitationMessage";
|
|
23
25
|
import RecommendationModal from "./components/RecommendationModal";
|
|
@@ -40,11 +42,13 @@ interface IResult {
|
|
|
40
42
|
|
|
41
43
|
export interface IRecommendationProps {
|
|
42
44
|
// Values
|
|
43
|
-
|
|
45
|
+
bloodGlucoseUnit: BloodGlucoseUnit;
|
|
44
46
|
language: Language;
|
|
45
47
|
userReminder: number;
|
|
46
48
|
calculatorParams: Calculator.IRecommendationParams;
|
|
47
49
|
injectionMethod: InjectionMethod;
|
|
50
|
+
currentBKL: number;
|
|
51
|
+
bloodKetoneUnit: BloodKetonesUnit;
|
|
48
52
|
latestLogbookFrom6Hours: logbookEntry;
|
|
49
53
|
activityDisplayProps: IActivityDisplayProps;
|
|
50
54
|
|
|
@@ -53,7 +57,13 @@ export interface IRecommendationProps {
|
|
|
53
57
|
closeCalculationCallback(): void;
|
|
54
58
|
exitCallback(): void;
|
|
55
59
|
onRecentInsulinYes(): void;
|
|
56
|
-
transferToLogbook(
|
|
60
|
+
transferToLogbook(
|
|
61
|
+
carbs: IResult,
|
|
62
|
+
insulin: IResult,
|
|
63
|
+
reminder: number,
|
|
64
|
+
recommendationDate: Date,
|
|
65
|
+
mood: MoodEnum,
|
|
66
|
+
): void;
|
|
57
67
|
onError(error: RecommendationError): void;
|
|
58
68
|
showBolusBar(toggle: boolean): void;
|
|
59
69
|
restartCalculation(): void;
|
|
@@ -87,9 +97,9 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
87
97
|
super(props);
|
|
88
98
|
try {
|
|
89
99
|
validateParams(props);
|
|
100
|
+
this.recommendationDate = new Date(global.Date.now());
|
|
90
101
|
|
|
91
102
|
changeLanguage(props.language);
|
|
92
|
-
this.recommendationDate = new Date(global.Date.now());
|
|
93
103
|
const { recentBoluses } = props.calculatorParams;
|
|
94
104
|
const {
|
|
95
105
|
bolus,
|
|
@@ -117,21 +127,31 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
117
127
|
showTimeoutModal: false,
|
|
118
128
|
};
|
|
119
129
|
|
|
120
|
-
this.timer = setTimeout(
|
|
121
|
-
this.setState({ showTimeoutModal: true }, (): void =>
|
|
122
|
-
this.props.showBolusBar(!this.state.showTimeoutModal),
|
|
123
|
-
);
|
|
124
|
-
}, Milliseconds.Minute * 15);
|
|
130
|
+
this.timer = setTimeout(this.showTimeoutModal, Milliseconds.Minute * 15);
|
|
125
131
|
} catch (error) {
|
|
126
132
|
this.hasError = true;
|
|
127
133
|
props.onError(error);
|
|
128
134
|
}
|
|
129
135
|
}
|
|
136
|
+
public componentDidMount(): void {
|
|
137
|
+
AppState.addEventListener(`change`, this.handleAppStateChange);
|
|
138
|
+
}
|
|
130
139
|
|
|
131
140
|
public componentWillUnmount(): void {
|
|
132
141
|
clearTimeout(this.timer);
|
|
142
|
+
AppState.removeEventListener(`change`, this.handleAppStateChange);
|
|
133
143
|
}
|
|
134
144
|
|
|
145
|
+
public handleAppStateChange = (nextAppState: AppStateStatus): void => {
|
|
146
|
+
const isOlderThan15Minutes = global.Date.now() - this.recommendationDate.getTime() > Milliseconds.Minute * 15;
|
|
147
|
+
if (nextAppState === `active` && isOlderThan15Minutes) {
|
|
148
|
+
this.showTimeoutModal();
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
public showTimeoutModal = (): void => {
|
|
152
|
+
this.setState({ showTimeoutModal: true }, (): void => this.props.showBolusBar(!this.state.showTimeoutModal));
|
|
153
|
+
};
|
|
154
|
+
|
|
135
155
|
public recalculateInsulin = (calculatorParams: Calculator.IRecommendationParams): void => {
|
|
136
156
|
const { bolus, wasLimited, activityReduction } = Calculator.calculateRecommendation(calculatorParams);
|
|
137
157
|
this.setState({
|
|
@@ -217,12 +237,19 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
217
237
|
};
|
|
218
238
|
|
|
219
239
|
public handleTransfer = (): void => {
|
|
220
|
-
const {
|
|
240
|
+
const {
|
|
241
|
+
enteredCarbs,
|
|
242
|
+
enteredInsulin,
|
|
243
|
+
insulinRecommendation,
|
|
244
|
+
remeasureTime,
|
|
245
|
+
showExitModal,
|
|
246
|
+
selectedMood,
|
|
247
|
+
} = this.state;
|
|
221
248
|
const carbs: IResult = { suggested: this.suggestedCarbs, entered: enteredCarbs };
|
|
222
249
|
const insulin: IResult = { suggested: insulinRecommendation, entered: enteredInsulin };
|
|
223
250
|
|
|
224
251
|
showExitModal ? this.hideExitModal() : this.hideTimeoutModal();
|
|
225
|
-
this.props.transferToLogbook(carbs, insulin, remeasureTime, this.recommendationDate);
|
|
252
|
+
this.props.transferToLogbook(carbs, insulin, remeasureTime, this.recommendationDate, selectedMood);
|
|
226
253
|
};
|
|
227
254
|
|
|
228
255
|
public getBGLevelAttentionMessage = (): AttentionMessage => {
|
|
@@ -259,9 +286,10 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
259
286
|
activityReduction,
|
|
260
287
|
isRecommendationDisplayed,
|
|
261
288
|
} = this.state;
|
|
262
|
-
const { calculatorParams,
|
|
289
|
+
const { calculatorParams, bloodGlucoseUnit, currentBKL, bloodKetoneUnit } = this.props;
|
|
263
290
|
const { currentBGL, carbohydrates } = calculatorParams;
|
|
264
|
-
const displayedBGL =
|
|
291
|
+
const displayedBGL = Utils.displayedBGLValue(currentBGL, bloodGlucoseUnit);
|
|
292
|
+
const displayedBKL = Utils.displayedBKLValue(currentBKL, bloodKetoneUnit);
|
|
265
293
|
|
|
266
294
|
return (
|
|
267
295
|
<I18nProvider language={this.props.language} i18n={i18n}>
|
|
@@ -270,13 +298,19 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
270
298
|
<InfoBars
|
|
271
299
|
label={i18n._(t`Active Insulin`)}
|
|
272
300
|
value={activeInsulin ? `${activeInsulin.toFixed(1)}` : null}
|
|
273
|
-
|
|
301
|
+
unit={i18n._(t`units`)}
|
|
274
302
|
showNullAsDash={false}
|
|
275
303
|
/>
|
|
276
304
|
<InfoBars
|
|
277
305
|
label={i18n._(t`Blood Glucose Level`)}
|
|
278
306
|
value={currentBGL ? `${displayedBGL}` : null}
|
|
279
|
-
|
|
307
|
+
unit={this.props.bloodGlucoseUnit}
|
|
308
|
+
showNullAsDash={true}
|
|
309
|
+
/>
|
|
310
|
+
<InfoBars
|
|
311
|
+
label={i18n._(t`Blood Ketone Level`)}
|
|
312
|
+
value={currentBKL ? `${displayedBKL}` : null}
|
|
313
|
+
unit={this.props.bloodKetoneUnit}
|
|
280
314
|
showNullAsDash={true}
|
|
281
315
|
/>
|
|
282
316
|
<View style={containerStyles.calcContainer}>
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import { BloodGlucoseUnit, BloodKetonesUnit } from "@hedia/types";
|
|
1
2
|
import React from "react";
|
|
2
3
|
export interface IProps {
|
|
3
4
|
label: string;
|
|
4
5
|
value?: string;
|
|
5
|
-
|
|
6
|
+
unit: string | BloodGlucoseUnit | BloodKetonesUnit;
|
|
6
7
|
showNullAsDash: boolean;
|
|
7
8
|
}
|
|
8
9
|
export default class InfoBars extends React.Component<IProps> {
|
|
10
|
+
displayValue: () => string;
|
|
11
|
+
displayUnit: () => string;
|
|
9
12
|
render(): JSX.Element;
|
|
10
13
|
}
|
|
11
14
|
export declare const infoStyles: {
|
|
@@ -4,13 +4,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.infoStyles = void 0;
|
|
7
|
+
const types_1 = require("@hedia/types");
|
|
8
|
+
const macro_1 = require("@lingui/macro");
|
|
7
9
|
const react_1 = __importDefault(require("react"));
|
|
8
10
|
const react_native_1 = require("react-native");
|
|
11
|
+
const i18nUtils_1 = require("../locale/i18nUtils");
|
|
9
12
|
const Constants_1 = require("../utils/Constants");
|
|
13
|
+
const Utils_1 = require("../utils/Utils");
|
|
10
14
|
const Header_1 = require("./Header");
|
|
11
15
|
class InfoBars extends react_1.default.Component {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.displayValue = () => {
|
|
19
|
+
const { showNullAsDash, unit, value } = this.props;
|
|
20
|
+
const noDecimal = unit === types_1.BloodGlucoseUnit.MG_DL || unit === types_1.BloodKetonesUnit.MG_DL;
|
|
21
|
+
const nullPlaceholder = noDecimal ? `-` : `-.-`;
|
|
22
|
+
return value ?? (showNullAsDash ? nullPlaceholder : `0`);
|
|
23
|
+
};
|
|
24
|
+
this.displayUnit = () => {
|
|
25
|
+
const { unit } = this.props;
|
|
26
|
+
return unit === i18nUtils_1.i18n._(macro_1.t `units`) ? unit : Utils_1.Utils.formatUnit(unit);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
12
29
|
render() {
|
|
13
|
-
const displayedValue = this.props.value ?? (this.props.showNullAsDash ? `-.-` : `0`);
|
|
14
30
|
return (<react_native_1.View style={exports.infoStyles.container}>
|
|
15
31
|
<react_native_1.View style={exports.infoStyles.margin}>
|
|
16
32
|
<react_native_1.View style={exports.infoStyles.border}>
|
|
@@ -20,10 +36,10 @@ class InfoBars extends react_1.default.Component {
|
|
|
20
36
|
</react_native_1.View>
|
|
21
37
|
<react_native_1.View style={exports.infoStyles.valueUnitContainer}>
|
|
22
38
|
<react_native_1.View style={exports.infoStyles.valueContainer}>
|
|
23
|
-
<react_native_1.Text style={exports.infoStyles.value}>{
|
|
39
|
+
<react_native_1.Text style={exports.infoStyles.value}>{this.displayValue()}</react_native_1.Text>
|
|
24
40
|
</react_native_1.View>
|
|
25
41
|
<react_native_1.View style={exports.infoStyles.unitContainer}>
|
|
26
|
-
<react_native_1.Text style={exports.infoStyles.units}>{this.
|
|
42
|
+
<react_native_1.Text style={exports.infoStyles.units}>{this.displayUnit()}</react_native_1.Text>
|
|
27
43
|
</react_native_1.View>
|
|
28
44
|
</react_native_1.View>
|
|
29
45
|
</react_native_1.View>
|