@hedia/recommendation-screen 2.2.0-alpha.35 → 2.2.0-alpha.37
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.
|
@@ -17,7 +17,7 @@ export interface IProps {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
/** A standard panel to display some data that the user entered. */
|
|
20
|
-
declare const ForecastInfoBar: (props: IProps) => JSX.Element;
|
|
20
|
+
declare const ForecastInfoBar: (props: IProps) => JSX.Element | null;
|
|
21
21
|
/** @internal */
|
|
22
22
|
export declare const infoStyles: {
|
|
23
23
|
container: {
|
|
@@ -10,13 +10,30 @@ import TextRegular from "./text/TextRegular";
|
|
|
10
10
|
/** A standard panel to display some data that the user entered. */
|
|
11
11
|
const ForecastInfoBar = (props) => {
|
|
12
12
|
const { testID, label, unit, cgm, forecast } = props;
|
|
13
|
+
if (!cgm) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
if (!forecast) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
13
19
|
/**
|
|
14
|
-
* Determine the unit string to be displayed in the infobar.
|
|
20
|
+
* Determine the unit string to be displayed in the forecast infobar.
|
|
15
21
|
*
|
|
16
|
-
* @returns The string to display as the unit in the infobar
|
|
22
|
+
* @returns The string to display as the unit in the forecast infobar
|
|
17
23
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
24
|
+
const displayUnit = () => Utils.formatUnit(unit);
|
|
25
|
+
/**
|
|
26
|
+
* Determine the forecast value string to be displayed in the infobar.
|
|
27
|
+
*
|
|
28
|
+
* @returns The string to display as the forecast value in the forecast infobar
|
|
29
|
+
*/
|
|
30
|
+
const displayForecastValue = () => Utils.displayedBGLValue(forecast.forecastGlucoseMmoll, unit);
|
|
31
|
+
/**
|
|
32
|
+
* Determine the cgm value string to be displayed in the infobar.
|
|
33
|
+
*
|
|
34
|
+
* @returns The string to display as the cgm value in the forecast infobar
|
|
35
|
+
*/
|
|
36
|
+
const displayCGMValue = () => Utils.displayedBGLValue(cgm.latestCGMReadingMmoll, unit);
|
|
20
37
|
const { border, container, forecastDot, forecastSubtitle, forecastText, forecastTime, gradient, labelContainer, row, unitContainer, units, value, valueContainer, valueUnitContainer, } = infoStyles;
|
|
21
38
|
/**
|
|
22
39
|
* @returns JSX element to display a card with the entered value.
|
|
@@ -31,12 +48,12 @@ const ForecastInfoBar = (props) => {
|
|
|
31
48
|
<View style={valueUnitContainer}>
|
|
32
49
|
<View style={valueContainer}>
|
|
33
50
|
<TextBold style={value} testID={testID?.valueID}>
|
|
34
|
-
{
|
|
51
|
+
{displayForecastValue()}
|
|
35
52
|
</TextBold>
|
|
36
53
|
</View>
|
|
37
54
|
<View style={unitContainer}>
|
|
38
55
|
<TextRegular style={units} testID={testID?.unitID}>
|
|
39
|
-
{displayUnit(
|
|
56
|
+
{displayUnit()}
|
|
40
57
|
</TextRegular>
|
|
41
58
|
</View>
|
|
42
59
|
</View>
|
|
@@ -52,7 +69,7 @@ const ForecastInfoBar = (props) => {
|
|
|
52
69
|
|
|
53
70
|
<View style={row}>
|
|
54
71
|
<TextRegular style={infoStyles.currentCGM}>
|
|
55
|
-
{i18n._(t `Current glucose: ${
|
|
72
|
+
{i18n._(t `Current glucose: ${displayCGMValue()} ${displayUnit()}`)}
|
|
56
73
|
</TextRegular>
|
|
57
74
|
</View>
|
|
58
75
|
</View>
|