@hedia/recommendation-screen 2.2.0-alpha.29 → 2.2.0-alpha.30

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.
@@ -10,20 +10,6 @@ export interface IResult {
10
10
  /** The actual amount (of insulin in units or carbohydrates in grams) */
11
11
  entered: number | null;
12
12
  }
13
- /** Represents forecast data */
14
- export interface IForecast {
15
- /** The forecasted glucose value to display. */
16
- forecastGlucoseMmoll: number;
17
- /** Forecasted time value to display. */
18
- forecastTimestamp: Date | string;
19
- }
20
- /** Represents CGM data */
21
- export interface ICGMReading {
22
- /** Latest CGM reading timestamp. */
23
- cgmTimestamp: Date | string;
24
- /** Latest CGM reading value to display. */
25
- latestCGMReadingMmoll: number;
26
- }
27
13
  export interface IRecommendationProps {
28
14
  /** The blood glucose measurement unit that the user prefers. */
29
15
  bloodGlucoseUnit: BloodGlucoseUnit;
@@ -44,9 +30,9 @@ export interface IRecommendationProps {
44
30
  /** The properties of the entered activity that are not used for making the calculation itself, but will be used on the recommendation screen. */
45
31
  activityDisplayProps: IActivityDisplayProps | null;
46
32
  /** Forecast data received from the app */
47
- forecast?: IForecast;
33
+ forecast?: Logbook.Types.ILogbookEntry[`forecast_glucose`];
48
34
  /** CGM data received from the app */
49
- cgm?: ICGMReading;
35
+ cgm?: Logbook.Types.ILogbookEntry[`cgm_reading`];
50
36
  /**
51
37
  * Callback function taking a single boolean argument and returning nothing.
52
38
  * To be called when the user decides on a presented carbohydrate recommendation.
@@ -1,14 +1,13 @@
1
1
  /// <reference types="react" />
2
- import { BloodGlucoseUnit } from "@hedia/types";
3
- import { ICGMReading, IForecast } from "../RecommendationScreen";
2
+ import { BloodGlucoseUnit, Logbook } from "@hedia/types";
4
3
  import { Testing } from "../types/enum";
5
4
  export interface IProps {
6
5
  /** The display label that describes the value to the user. */
7
6
  label: string;
8
7
  /** The forecast value to display. */
9
- forecast: IForecast;
8
+ forecast: Logbook.Types.ILogbookEntry[`forecast_glucose`];
10
9
  /** The cgm value to display. */
11
- cgm: ICGMReading;
10
+ cgm: Logbook.Types.ILogbookEntry[`cgm_reading`];
12
11
  /** Unit label to print after the value. */
13
12
  unit: BloodGlucoseUnit;
14
13
  /** optional object that contains as properties a valueID and a unitID */
@@ -22,7 +22,7 @@ const ForecastInfoBar = (props) => {
22
22
  * @returns JSX element to display a card with the entered value.
23
23
  */
24
24
  return (<View style={container}>
25
- <LinearGradient style={gradient} colors={[`#8B38F5`, `#D593E5`]} useAngle={true} angle={170}>
25
+ <LinearGradient style={gradient} colors={colors.gradientMain} useAngle={true} angle={170}>
26
26
  <View style={border}>
27
27
  <View style={row}>
28
28
  <View style={labelContainer}>
@@ -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.forecastGlucoseMmoll}
34
+ {forecast?.forecastGlucoseMmoll}
35
35
  </TextBold>
36
36
  </View>
37
37
  <View style={unitContainer}>
@@ -44,15 +44,15 @@ const ForecastInfoBar = (props) => {
44
44
 
45
45
  <View style={row}>
46
46
  <View style={forecastSubtitle}>
47
- <LinearGradient colors={[`#8B38F5`, `#D593E5`]} useAngle={true} angle={135} style={forecastDot}/>
47
+ <LinearGradient colors={colors.gradientMain} useAngle={true} angle={135} style={forecastDot}/>
48
48
  <TextRegular style={forecastText}>{i18n._(t `Forecast time:`)}</TextRegular>
49
- <TextRegular style={forecastTime}>{String(forecast.forecastTimestamp)}</TextRegular>
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.latestCGMReadingMmoll} ${displayUnit(unit)}`)}
55
+ {i18n._(t `Current glucose: ${cgm?.latestCGMReadingMmoll} ${displayUnit(unit)}`)}
56
56
  </TextRegular>
57
57
  </View>
58
58
  </View>
@@ -17,7 +17,7 @@ export default class RecentInsulin extends React.Component {
17
17
  */
18
18
  render = () => {
19
19
  const { container, title, buttonContainer, yesNoContainer, yesNoText } = styles;
20
- return (<LinearGradient style={container} colors={[`rgba(87, 138, 255, 0.3)`, `rgba(162, 0, 255, 0.3)`]} useAngle={true} angle={170}>
20
+ return (<LinearGradient style={container} colors={colors.gradientWithOpacity} useAngle={true} angle={170}>
21
21
  <TextBold style={title}>
22
22
  {i18n._(t `Have you taken rapid-acting insulin within the last 4 hours?`)}
23
23
  </TextBold>
@@ -1,6 +1,5 @@
1
- import { UserSettings } from "@hedia/types";
1
+ import { Logbook, UserSettings } from "@hedia/types";
2
2
  import React from "react";
3
- import { IForecast } from "../RecommendationScreen";
4
3
  export interface IProps {
5
4
  /** The amount of insulin in units to display to the user as a recommendation. */
6
5
  insulinRecommendation: number;
@@ -15,7 +14,7 @@ export interface IProps {
15
14
  /** Used to determine how the insulin amount should be rounded. */
16
15
  injectionMethod: UserSettings.Enums.InjectionMethod;
17
16
  /** Used to show different text depending on different insulin ranges. */
18
- forecast?: IForecast;
17
+ forecast?: Logbook.Types.ILogbookEntry[`forecast_glucose`];
19
18
  /**
20
19
  * Callback function taking a number as argument and giving no return value.
21
20
  * To be called with the new value every time the content of the insulin input field gets changed.
@@ -110,7 +110,7 @@ export default class RecommendedInsulin extends React.Component {
110
110
  : i18n._(t `Recommended amount of rapid-acting insulin for immidiate injection`);
111
111
  return (<>
112
112
  <TouchableOpacity testID={RecommendedInsulinTestIds.EditRecommendedInsulin} onPress={this.handleOnPress}>
113
- <LinearGradient style={container} colors={[colors.purple, colors.blue]} useAngle={true} angle={315}>
113
+ <LinearGradient style={container} colors={colors.gradientPurple} useAngle={true} angle={315}>
114
114
  <TextBold style={title}>{titleText}</TextBold>
115
115
  <View style={recommendedContainer}>
116
116
  <View style={valueContainer}>
@@ -10,6 +10,9 @@ export declare const colors: {
10
10
  purple: string;
11
11
  semiDarkBlue: string;
12
12
  teal: string;
13
+ gradientMain: string[];
14
+ gradientWithOpacity: string[];
15
+ gradientPurple: string[];
13
16
  };
14
17
  /** The threshold above which hyperglycemia is considered to be severe in mmol/L */
15
18
  export declare const SEVERE_HYPERGLYCEMIA_START_MMOL = 15;
@@ -10,6 +10,9 @@ export const colors = {
10
10
  purple: `#a200ff`,
11
11
  semiDarkBlue: `#1B1F48`,
12
12
  teal: `#01FFFC`,
13
+ gradientMain: [`#8B38F5`, `#D593E5`],
14
+ gradientWithOpacity: [`rgba(87, 138, 255, 0.3)`, `rgba(162, 0, 255, 0.3)`],
15
+ gradientPurple: [`#a200ff`, `#578aff`],
13
16
  };
14
17
  /** The threshold above which hyperglycemia is considered to be severe in mmol/L */
15
18
  export const SEVERE_HYPERGLYCEMIA_START_MMOL = 15;
@@ -5,7 +5,7 @@
5
5
  * @module
6
6
  */
7
7
  import { Activity, BloodGlucoseUnit, BloodKetonesUnit, BolusCalculator, Languages, Logbook, UserSettings } from "@hedia/types";
8
- import { IForecast, IRecommendationProps } from "../RecommendationScreen";
8
+ import { IRecommendationProps } from "../RecommendationScreen";
9
9
  /**
10
10
  * Main function for validating all input properties for the insulin recommendation screen component.
11
11
  * Throws an exception if any of the individual checks fail.
@@ -255,4 +255,4 @@ export declare function checkCarbohydrates(carbohydrates: number): void;
255
255
  * 1. Check if forecasted glucose is above very low limit. If it isn’t then throw a ForecastedGlucoseIsVeryLowError().
256
256
  * @param forecast The forecast data, that includes `forecastGlucoseMmoll` and `forecastTimestamp`
257
257
  */
258
- export declare function checkVeryLowForecastedGlucose(forecast: IForecast | undefined): void;
258
+ export declare function checkVeryLowForecastedGlucose(forecast: Logbook.Types.ILogbookEntry[`forecast_glucose`] | undefined): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hedia/recommendation-screen",
3
- "version": "2.2.0-alpha.29",
3
+ "version": "2.2.0-alpha.30",
4
4
  "description": "Hedia Recommendation Screen for Bolus and Carbohydrates",
5
5
  "main": "dist/index.js",
6
6
  "files": [