@hedia/recommendation-screen 2.2.0-alpha.26 → 2.2.0-alpha.28
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.
|
@@ -13,16 +13,16 @@ export interface IResult {
|
|
|
13
13
|
/** Represents forecast data */
|
|
14
14
|
export interface IForecast {
|
|
15
15
|
/** The forecasted glucose value to display. */
|
|
16
|
-
|
|
16
|
+
forecastGlucoseMmoll: number;
|
|
17
17
|
/** Forecasted time value to display. */
|
|
18
|
-
|
|
18
|
+
forecastTimestamp: Date | string;
|
|
19
19
|
}
|
|
20
20
|
/** Represents CGM data */
|
|
21
21
|
export interface ICGMReading {
|
|
22
22
|
/** Latest CGM reading timestamp. */
|
|
23
|
-
|
|
23
|
+
cgmTimestamp: Date | string;
|
|
24
24
|
/** Latest CGM reading value to display. */
|
|
25
|
-
|
|
25
|
+
latestCGMReadingMmoll: number;
|
|
26
26
|
}
|
|
27
27
|
export interface IRecommendationProps {
|
|
28
28
|
/** The blood glucose measurement unit that the user prefers. */
|
|
@@ -44,9 +44,9 @@ export interface IRecommendationProps {
|
|
|
44
44
|
/** The properties of the entered activity that are not used for making the calculation itself, but will be used on the recommendation screen. */
|
|
45
45
|
activityDisplayProps: IActivityDisplayProps | null;
|
|
46
46
|
/** Forecast data received from the app */
|
|
47
|
-
forecast
|
|
47
|
+
forecast?: IForecast;
|
|
48
48
|
/** CGM data received from the app */
|
|
49
|
-
cgm
|
|
49
|
+
cgm?: ICGMReading;
|
|
50
50
|
/**
|
|
51
51
|
* Callback function taking a single boolean argument and returning nothing.
|
|
52
52
|
* To be called when the user decides on a presented carbohydrate recommendation.
|
|
@@ -31,7 +31,7 @@ const ForecastInfoBar = (props) => {
|
|
|
31
31
|
<View style={valueUnitContainer}>
|
|
32
32
|
<View style={valueContainer}>
|
|
33
33
|
<TextBold style={value} testID={testID?.valueID}>
|
|
34
|
-
{forecast.
|
|
34
|
+
{forecast.forecastGlucoseMmoll}
|
|
35
35
|
</TextBold>
|
|
36
36
|
</View>
|
|
37
37
|
<View style={unitContainer}>
|
|
@@ -46,13 +46,13 @@ const ForecastInfoBar = (props) => {
|
|
|
46
46
|
<View style={forecastSubtitle}>
|
|
47
47
|
<LinearGradient colors={[`#8B38F5`, `#D593E5`]} useAngle={true} angle={135} style={forecastDot}/>
|
|
48
48
|
<TextRegular style={forecastText}>{i18n._(t `Forecast time:`)}</TextRegular>
|
|
49
|
-
<TextRegular style={forecastTime}>{forecast.
|
|
49
|
+
<TextRegular style={forecastTime}>{String(forecast.forecastTimestamp)}</TextRegular>
|
|
50
50
|
</View>
|
|
51
51
|
</View>
|
|
52
52
|
|
|
53
53
|
<View style={row}>
|
|
54
54
|
<TextRegular style={infoStyles.currentCGM}>
|
|
55
|
-
{i18n._(t `Current glucose: ${cgm.
|
|
55
|
+
{i18n._(t `Current glucose: ${cgm.latestCGMReadingMmoll} ${displayUnit(unit)}`)}
|
|
56
56
|
</TextRegular>
|
|
57
57
|
</View>
|
|
58
58
|
</View>
|
|
@@ -15,7 +15,7 @@ export interface IProps {
|
|
|
15
15
|
/** Used to determine how the insulin amount should be rounded. */
|
|
16
16
|
injectionMethod: UserSettings.Enums.InjectionMethod;
|
|
17
17
|
/** Used to show different text depending on different insulin ranges. */
|
|
18
|
-
forecast
|
|
18
|
+
forecast?: IForecast;
|
|
19
19
|
/**
|
|
20
20
|
* Callback function taking a number as argument and giving no return value.
|
|
21
21
|
* To be called with the new value every time the content of the insulin input field gets changed.
|
|
@@ -253,6 +253,6 @@ export declare function checkCarbohydrates(carbohydrates: number): void;
|
|
|
253
253
|
*
|
|
254
254
|
* Steps:
|
|
255
255
|
* 1. Check if forecasted glucose is above very low limit. If it isn’t then throw a ForecastedGlucoseIsVeryLowError().
|
|
256
|
-
* @param
|
|
256
|
+
* @param forecastGlucoseMmoll The amount of blood glucose in mmol/L that is received from forecast.
|
|
257
257
|
*/
|
|
258
|
-
export declare function checkVeryLowForecastedGlucose(forecast: IForecast |
|
|
258
|
+
export declare function checkVeryLowForecastedGlucose(forecast: IForecast | undefined): void;
|
|
@@ -413,11 +413,11 @@ export function checkCarbohydrates(carbohydrates) {
|
|
|
413
413
|
*
|
|
414
414
|
* Steps:
|
|
415
415
|
* 1. Check if forecasted glucose is above very low limit. If it isn’t then throw a ForecastedGlucoseIsVeryLowError().
|
|
416
|
-
* @param
|
|
416
|
+
* @param forecastGlucoseMmoll The amount of blood glucose in mmol/L that is received from forecast.
|
|
417
417
|
*/
|
|
418
418
|
export function checkVeryLowForecastedGlucose(forecast) {
|
|
419
|
-
if (forecast?.
|
|
420
|
-
if (forecast.
|
|
419
|
+
if (forecast?.forecastGlucoseMmoll) {
|
|
420
|
+
if (forecast.forecastGlucoseMmoll < FORECASTED_CGM_VERY_LOW_LIMIT_MMOLL) {
|
|
421
421
|
throw ForecastedGlucoseIsVeryLowError();
|
|
422
422
|
}
|
|
423
423
|
}
|