@hedia/recommendation-screen 2.1.3-beta.6 → 2.1.3-beta.7
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 +2 -2
- package/coverage/lcov-report/index.html +1 -1
- package/coverage/lcov-report/src/RecommendationScreen.tsx.html +1 -1
- package/coverage/lcov-report/src/__tests__/index.html +1 -1
- package/coverage/lcov-report/src/__tests__/utils.tsx.html +1 -1
- package/coverage/lcov-report/src/components/Header.tsx.html +1 -1
- package/coverage/lcov-report/src/components/InfoBars.tsx.html +1 -1
- package/coverage/lcov-report/src/components/InvisibleNumberInput.tsx.html +1 -1
- package/coverage/lcov-report/src/components/LimitationMessage.tsx.html +1 -1
- package/coverage/lcov-report/src/components/LineSeparator.tsx.html +1 -1
- package/coverage/lcov-report/src/components/RecentInsulin.tsx.html +1 -1
- package/coverage/lcov-report/src/components/RecommendationModal.tsx.html +1 -1
- package/coverage/lcov-report/src/components/RecommendedCarbs.tsx.html +1 -1
- package/coverage/lcov-report/src/components/RecommendedInsulin.tsx.html +1 -1
- package/coverage/lcov-report/src/components/Remeasure.tsx.html +1 -1
- package/coverage/lcov-report/src/components/TransferToLogbook.tsx.html +1 -1
- package/coverage/lcov-report/src/components/TwoOptionModal.tsx.html +1 -1
- package/coverage/lcov-report/src/components/activity/Activity.tsx.html +1 -1
- package/coverage/lcov-report/src/components/activity/ActivityIcon.tsx.html +1 -1
- package/coverage/lcov-report/src/components/activity/ActivityIntensity.tsx.html +1 -1
- package/coverage/lcov-report/src/components/activity/index.html +1 -1
- package/coverage/lcov-report/src/components/index.html +1 -1
- package/coverage/lcov-report/src/components/mood/Emotion.tsx.html +1 -1
- package/coverage/lcov-report/src/components/mood/MoodIcon.tsx.html +1 -1
- 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 +1 -1
- package/coverage/lcov-report/src/locale/index.html +1 -1
- package/coverage/lcov-report/src/utils/AttentionMessages.tsx.html +1 -1
- package/coverage/lcov-report/src/utils/Constants.ts.html +1 -1
- package/coverage/lcov-report/src/utils/RecommendationError.tsx.html +1 -1
- package/coverage/lcov-report/src/utils/RecommendationUtils.ts.html +1 -1
- package/coverage/lcov-report/src/utils/Translations.ts.html +1 -1
- package/coverage/lcov-report/src/utils/Utils.ts.html +1 -1
- package/coverage/lcov-report/src/utils/Validations.ts.html +1 -1
- package/coverage/lcov-report/src/utils/index.html +1 -1
- package/index.js +5 -31
- package/package.json +2 -1
- package/src/RecommendationScreen.js +76 -101
- package/src/__tests__/RecommendationScreen.test.js +404 -409
- package/src/__tests__/RecommendationUtils.test.js +117 -119
- package/src/__tests__/Translate.test.js +14 -16
- package/src/__tests__/Utils.test.js +16 -18
- package/src/__tests__/Validations.test.js +30 -51
- package/src/__tests__/components/Activity.test.js +51 -56
- package/src/__tests__/components/Emotion.test.js +28 -33
- package/src/__tests__/components/Header.test.js +24 -29
- package/src/__tests__/components/InfoBars.test.js +59 -64
- package/src/__tests__/components/InvisibleNumberInput.test.js +22 -27
- package/src/__tests__/components/LimitationMessage.test.js +28 -33
- package/src/__tests__/components/MoodIcon.test.js +9 -14
- package/src/__tests__/components/RecommendationModal.test.js +56 -61
- package/src/__tests__/components/RecommendedCarbs.test.js +58 -63
- package/src/__tests__/components/RecommendedInsulin.test.js +60 -65
- package/src/__tests__/components/Remeasure.test.js +32 -37
- package/src/__tests__/components/TransferToLogbook.test.js +15 -20
- package/src/__tests__/components/TwoOptionModal.test.js +22 -27
- package/src/__tests__/utils.js +22 -38
- package/src/components/Header.js +34 -41
- package/src/components/Icon.js +2 -8
- package/src/components/InfoBars.js +36 -43
- package/src/components/InvisibleNumberInput.js +5 -11
- package/src/components/LimitationMessage.js +18 -40
- package/src/components/LineSeparator.js +7 -13
- package/src/components/RecentInsulin.js +33 -39
- package/src/components/RecommendationModal.js +59 -85
- package/src/components/RecommendedCarbs.js +93 -99
- package/src/components/RecommendedInsulin.js +46 -52
- package/src/components/Remeasure.js +36 -42
- package/src/components/TransferToLogbook.js +20 -26
- package/src/components/TwoOptionModal.js +39 -65
- package/src/components/activity/Activity.js +42 -48
- package/src/components/activity/ActivityIcon.js +15 -21
- package/src/components/activity/ActivityIntensity.js +19 -25
- package/src/components/mood/Emotion.js +17 -23
- package/src/components/mood/MoodIcon.js +11 -17
- package/src/locale/i18nUtils.js +17 -24
- package/src/types/enum.js +28 -31
- package/src/types/types.js +1 -2
- package/src/utils/AttentionMessages.js +24 -32
- package/src/utils/Constants.js +23 -26
- package/src/utils/RecommendationError.js +28 -54
- package/src/utils/RecommendationUtils.js +60 -72
- package/src/utils/Translations.js +6 -9
- package/src/utils/Utils.js +8 -12
- package/src/utils/Validations.js +77 -107
- package/tsconfig.json +3 -3
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const macro_1 = require("@lingui/macro");
|
|
8
|
-
const react_1 = __importDefault(require("react"));
|
|
9
|
-
const react_native_1 = require("react-native");
|
|
10
|
-
const i18nUtils_1 = require("../../locale/i18nUtils");
|
|
11
|
-
const { Other } = types_1.Activity.Enums.ActivityEnum;
|
|
1
|
+
import { Activity } from "@hedia/types";
|
|
2
|
+
import { t } from "@lingui/macro";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Dimensions, Image, StyleSheet, Text, View } from "react-native";
|
|
5
|
+
import { i18n } from "../../locale/i18nUtils";
|
|
6
|
+
const { Other } = Activity.Enums.ActivityEnum;
|
|
12
7
|
const ACTIVITY_ICONS = {
|
|
13
8
|
Run: require(`../../assets/activity/Runner.png`),
|
|
14
9
|
Walk: require(`../../assets/activity/Walk.png`),
|
|
@@ -16,7 +11,7 @@ const ACTIVITY_ICONS = {
|
|
|
16
11
|
Swim: require(`../../assets/activity/Swimmer.png`),
|
|
17
12
|
Other: require(`../../assets/activity/Other.png`),
|
|
18
13
|
};
|
|
19
|
-
class ActivityIcon extends
|
|
14
|
+
export default class ActivityIcon extends React.Component {
|
|
20
15
|
constructor() {
|
|
21
16
|
super(...arguments);
|
|
22
17
|
this.getActivityIcon = () => {
|
|
@@ -25,15 +20,14 @@ class ActivityIcon extends react_1.default.Component {
|
|
|
25
20
|
}
|
|
26
21
|
render() {
|
|
27
22
|
const { activityType, activityTitle } = this.props;
|
|
28
|
-
const label = `${
|
|
29
|
-
return (<
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
</
|
|
23
|
+
const label = `${Activity.Enums.ActivityEnum[activityType ?? Other]}_activity`;
|
|
24
|
+
return (<View style={activityIconStyles.container}>
|
|
25
|
+
<Image style={activityIconStyles.activityIcon} source={this.getActivityIcon()} accessibilityLabel={label}/>
|
|
26
|
+
<Text style={activityIconStyles.activityTitle}>{activityTitle || i18n._(t `Untitled Activity`)}</Text>
|
|
27
|
+
</View>);
|
|
33
28
|
}
|
|
34
29
|
}
|
|
35
|
-
|
|
36
|
-
const activityIconStyles = react_native_1.StyleSheet.create({
|
|
30
|
+
const activityIconStyles = StyleSheet.create({
|
|
37
31
|
container: {
|
|
38
32
|
flex: 1,
|
|
39
33
|
flexDirection: `row`,
|
|
@@ -42,10 +36,10 @@ const activityIconStyles = react_native_1.StyleSheet.create({
|
|
|
42
36
|
},
|
|
43
37
|
activityIcon: {
|
|
44
38
|
resizeMode: `contain`,
|
|
45
|
-
height:
|
|
39
|
+
height: Dimensions.get(`screen`).width / 16,
|
|
46
40
|
},
|
|
47
41
|
activityTitle: {
|
|
48
42
|
color: `white`,
|
|
49
|
-
fontSize:
|
|
43
|
+
fontSize: Dimensions.get(`screen`).width / 25,
|
|
50
44
|
},
|
|
51
45
|
});
|
|
@@ -1,32 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const react_native_1 = require("react-native");
|
|
9
|
-
const Translations_1 = require("../../utils/Translations");
|
|
10
|
-
const InfoBars_1 = require("../InfoBars");
|
|
11
|
-
class ActivityIntensity extends react_1.default.Component {
|
|
1
|
+
import { Activity } from "@hedia/types";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Dimensions, StyleSheet, Text, View } from "react-native";
|
|
4
|
+
import { ActivityIntensityTranslations } from "../../utils/Translations";
|
|
5
|
+
import { infoStyles } from "../InfoBars";
|
|
6
|
+
export default class ActivityIntensity extends React.Component {
|
|
12
7
|
constructor() {
|
|
13
8
|
super(...arguments);
|
|
14
9
|
this.render = () => {
|
|
15
10
|
const intensity = this.props.activityIntensity;
|
|
16
11
|
const style = activityIntensityStyles[intensity];
|
|
17
|
-
return (<
|
|
18
|
-
<
|
|
19
|
-
<
|
|
20
|
-
<
|
|
21
|
-
</
|
|
22
|
-
</
|
|
23
|
-
<
|
|
24
|
-
</
|
|
12
|
+
return (<View style={[infoStyles.margin, activityIntensityStyles.row]}>
|
|
13
|
+
<View style={activityIntensityStyles.intensityContainer}>
|
|
14
|
+
<View style={[activityIntensityStyles.intensityTextContainer, style]}>
|
|
15
|
+
<Text style={activityIntensityStyles.bold}>{ActivityIntensityTranslations[intensity]()}</Text>
|
|
16
|
+
</View>
|
|
17
|
+
</View>
|
|
18
|
+
<View style={activityIntensityStyles.intensityContainerOffset}/>
|
|
19
|
+
</View>);
|
|
25
20
|
};
|
|
26
21
|
}
|
|
27
22
|
}
|
|
28
|
-
|
|
29
|
-
const activityIntensityStyles = react_native_1.StyleSheet.create({
|
|
23
|
+
const activityIntensityStyles = StyleSheet.create({
|
|
30
24
|
row: {
|
|
31
25
|
flexDirection: `row`,
|
|
32
26
|
},
|
|
@@ -36,13 +30,13 @@ const activityIntensityStyles = react_native_1.StyleSheet.create({
|
|
|
36
30
|
padding: `5%`,
|
|
37
31
|
borderRadius: 5,
|
|
38
32
|
},
|
|
39
|
-
[
|
|
33
|
+
[Activity.Enums.ActivityIntensity.light]: {
|
|
40
34
|
backgroundColor: `#A5D871`,
|
|
41
35
|
},
|
|
42
|
-
[
|
|
36
|
+
[Activity.Enums.ActivityIntensity.moderate]: {
|
|
43
37
|
backgroundColor: `#F9BD5A`,
|
|
44
38
|
},
|
|
45
|
-
[
|
|
39
|
+
[Activity.Enums.ActivityIntensity.hard]: {
|
|
46
40
|
backgroundColor: `#EC5466`,
|
|
47
41
|
},
|
|
48
42
|
intensityContainer: {
|
|
@@ -53,6 +47,6 @@ const activityIntensityStyles = react_native_1.StyleSheet.create({
|
|
|
53
47
|
},
|
|
54
48
|
bold: {
|
|
55
49
|
fontWeight: `bold`,
|
|
56
|
-
fontSize:
|
|
50
|
+
fontSize: Dimensions.get(`screen`).width / 30,
|
|
57
51
|
},
|
|
58
52
|
});
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const react_native_1 = require("react-native");
|
|
10
|
-
const i18nUtils_1 = require("../../locale/i18nUtils");
|
|
11
|
-
const MoodIcon_1 = __importDefault(require("./MoodIcon"));
|
|
12
|
-
const MoodEnum = types_1.Logbook.Enums.MoodEnum;
|
|
13
|
-
class Emotion extends react_1.default.Component {
|
|
1
|
+
import { Logbook } from "@hedia/types";
|
|
2
|
+
import { t } from "@lingui/macro";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Dimensions, StyleSheet, Text, View } from "react-native";
|
|
5
|
+
import { i18n } from "../../locale/i18nUtils";
|
|
6
|
+
import MoodIcon from "./MoodIcon";
|
|
7
|
+
const MoodEnum = Logbook.Enums.MoodEnum;
|
|
8
|
+
export default class Emotion extends React.Component {
|
|
14
9
|
constructor() {
|
|
15
10
|
super(...arguments);
|
|
16
11
|
this.handleIconPress = (selected, toggle) => {
|
|
@@ -20,21 +15,20 @@ class Emotion extends react_1.default.Component {
|
|
|
20
15
|
const values = Object.values(MoodEnum).filter((val) => isNaN(Number(val)));
|
|
21
16
|
return values.map((key) => {
|
|
22
17
|
const moodValue = MoodEnum[key];
|
|
23
|
-
return (<
|
|
18
|
+
return (<MoodIcon onPress={(toggle) => this.handleIconPress(moodValue, toggle)} active={moodValue === this.props.currentMood} mood={moodValue} key={moodValue}/>);
|
|
24
19
|
});
|
|
25
20
|
};
|
|
26
21
|
}
|
|
27
22
|
render() {
|
|
28
|
-
return (<
|
|
29
|
-
<
|
|
30
|
-
<
|
|
31
|
-
</
|
|
32
|
-
<
|
|
33
|
-
</
|
|
23
|
+
return (<View style={emotionStyles.container}>
|
|
24
|
+
<View style={emotionStyles.feelingContainer}>
|
|
25
|
+
<Text style={emotionStyles.feelingText}>{i18n._(t `How are you feeling?`)}</Text>
|
|
26
|
+
</View>
|
|
27
|
+
<View style={emotionStyles.moodIconContainer}>{this.mappedMoods()}</View>
|
|
28
|
+
</View>);
|
|
34
29
|
}
|
|
35
30
|
}
|
|
36
|
-
|
|
37
|
-
const emotionStyles = react_native_1.StyleSheet.create({
|
|
31
|
+
const emotionStyles = StyleSheet.create({
|
|
38
32
|
container: {
|
|
39
33
|
flex: 1,
|
|
40
34
|
},
|
|
@@ -45,7 +39,7 @@ const emotionStyles = react_native_1.StyleSheet.create({
|
|
|
45
39
|
textAlign: `center`,
|
|
46
40
|
color: `white`,
|
|
47
41
|
fontWeight: `bold`,
|
|
48
|
-
fontSize:
|
|
42
|
+
fontSize: Dimensions.get(`screen`).width / 26,
|
|
49
43
|
},
|
|
50
44
|
moodIconContainer: { flex: 1, flexDirection: `row`, justifyContent: `center` },
|
|
51
45
|
});
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const types_1 = require("@hedia/types");
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const react_native_1 = require("react-native");
|
|
9
|
-
const MoodEnum = types_1.Logbook.Enums.MoodEnum;
|
|
1
|
+
import { Logbook } from "@hedia/types";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Dimensions, Image, StyleSheet, TouchableOpacity } from "react-native";
|
|
4
|
+
const MoodEnum = Logbook.Enums.MoodEnum;
|
|
10
5
|
const MOODS_INACTIVE = {
|
|
11
6
|
1: require(`../../assets/mood/sad.png`),
|
|
12
7
|
2: require(`../../assets/mood/semi_sad.png`),
|
|
@@ -21,7 +16,7 @@ const MOODS_ACTIVE = {
|
|
|
21
16
|
4: require(`../../assets/mood/semi_happy_active.png`),
|
|
22
17
|
5: require(`../../assets/mood/happy_active.png`),
|
|
23
18
|
};
|
|
24
|
-
class MoodIcon extends
|
|
19
|
+
export default class MoodIcon extends React.Component {
|
|
25
20
|
constructor() {
|
|
26
21
|
super(...arguments);
|
|
27
22
|
this.getMoodIcon = () => {
|
|
@@ -37,18 +32,17 @@ class MoodIcon extends react_1.default.Component {
|
|
|
37
32
|
render() {
|
|
38
33
|
const { mood, active } = this.props;
|
|
39
34
|
const label = `${MoodEnum[mood]}_${active}`;
|
|
40
|
-
return (<
|
|
41
|
-
<
|
|
42
|
-
</
|
|
35
|
+
return (<TouchableOpacity style={moodIconStyles.container} onPress={this.handleOnPress} accessibilityLabel={label}>
|
|
36
|
+
<Image style={moodIconStyles.icon} source={this.getMoodIcon()}/>
|
|
37
|
+
</TouchableOpacity>);
|
|
43
38
|
}
|
|
44
39
|
}
|
|
45
|
-
|
|
46
|
-
const moodIconStyles = react_native_1.StyleSheet.create({
|
|
40
|
+
const moodIconStyles = StyleSheet.create({
|
|
47
41
|
container: {
|
|
48
42
|
marginHorizontal: `1%`,
|
|
49
43
|
},
|
|
50
44
|
icon: {
|
|
51
|
-
width:
|
|
52
|
-
height:
|
|
45
|
+
width: Dimensions.get(`screen`).width / 8,
|
|
46
|
+
height: Dimensions.get(`screen`).width / 8,
|
|
53
47
|
},
|
|
54
48
|
});
|
package/src/locale/i18nUtils.js
CHANGED
|
@@ -1,31 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.changeLanguage = exports.i18n = void 0;
|
|
7
|
-
const types_1 = require("@hedia/types");
|
|
8
|
-
const core_1 = require("@lingui/core");
|
|
9
|
-
const moment_1 = __importDefault(require("moment"));
|
|
1
|
+
import { Languages } from "@hedia/types";
|
|
2
|
+
import { setupI18n } from "@lingui/core";
|
|
3
|
+
import moment from "moment";
|
|
10
4
|
// tslint:disable-next-line:no-import-side-effect
|
|
11
|
-
|
|
5
|
+
import "moment/min/locales";
|
|
12
6
|
const languageMap = {
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
18
|
-
[
|
|
7
|
+
[Languages.da]: require(`./da/messages.js`),
|
|
8
|
+
[Languages.en]: require(`./en/messages.js`),
|
|
9
|
+
[Languages.de]: require(`./de/messages.js`),
|
|
10
|
+
[Languages.es]: require(`./es/messages.js`),
|
|
11
|
+
[Languages.fr]: require(`./fr/messages.js`),
|
|
12
|
+
[Languages.it]: require(`./it/messages.js`),
|
|
19
13
|
};
|
|
20
|
-
|
|
21
|
-
language:
|
|
14
|
+
export const i18n = setupI18n({
|
|
15
|
+
language: Languages.en,
|
|
22
16
|
catalogs: languageMap,
|
|
23
17
|
});
|
|
24
|
-
function changeLanguage(language) {
|
|
25
|
-
languageMap[language] ?
|
|
18
|
+
export function changeLanguage(language) {
|
|
19
|
+
languageMap[language] ? i18n.activate(language) : i18n.activate(Languages.en);
|
|
26
20
|
// Temporary way of setting the moment locale to en-gb since we currently identify GB English with "en".
|
|
27
|
-
const linguiLocale = language ===
|
|
28
|
-
|
|
29
|
-
return
|
|
21
|
+
const linguiLocale = language === Languages.en ? `en-gb` : language;
|
|
22
|
+
moment.locale(linguiLocale);
|
|
23
|
+
return i18n;
|
|
30
24
|
}
|
|
31
|
-
exports.changeLanguage = changeLanguage;
|
package/src/types/enum.js
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RecommendationReminders = exports.BgLevel = exports.RecommendationErrorEnum = exports.InfoBarTestIds = exports.TwoOptionModalTestIds = exports.TransferToLogbookTestIds = exports.RemeasureTestIds = exports.RecommendationModalTestIds = exports.RecommendedInsulinTestIds = exports.RecommendedCarbsTestIds = exports.RecentInsulinTestIds = exports.LimitationMessageTestIds = exports.HeaderTestIds = exports.ActivityTestIds = void 0;
|
|
4
|
-
var ActivityTestIds;
|
|
1
|
+
export var ActivityTestIds;
|
|
5
2
|
(function (ActivityTestIds) {
|
|
6
3
|
ActivityTestIds["ActivityReduction"] = "activity-reduction-percentage";
|
|
7
|
-
})(ActivityTestIds
|
|
8
|
-
var HeaderTestIds;
|
|
4
|
+
})(ActivityTestIds || (ActivityTestIds = {}));
|
|
5
|
+
export var HeaderTestIds;
|
|
9
6
|
(function (HeaderTestIds) {
|
|
10
7
|
HeaderTestIds["ExitCalculation"] = "exit-calculation-button";
|
|
11
|
-
})(HeaderTestIds
|
|
12
|
-
var LimitationMessageTestIds;
|
|
8
|
+
})(HeaderTestIds || (HeaderTestIds = {}));
|
|
9
|
+
export var LimitationMessageTestIds;
|
|
13
10
|
(function (LimitationMessageTestIds) {
|
|
14
11
|
LimitationMessageTestIds["OkButton"] = "limitation-message-ok-button";
|
|
15
|
-
})(LimitationMessageTestIds
|
|
16
|
-
var RecentInsulinTestIds;
|
|
12
|
+
})(LimitationMessageTestIds || (LimitationMessageTestIds = {}));
|
|
13
|
+
export var RecentInsulinTestIds;
|
|
17
14
|
(function (RecentInsulinTestIds) {
|
|
18
15
|
RecentInsulinTestIds["No"] = "recent-insulin-no";
|
|
19
16
|
RecentInsulinTestIds["Yes"] = "recent-insulin-yes";
|
|
20
|
-
})(RecentInsulinTestIds
|
|
21
|
-
var RecommendedCarbsTestIds;
|
|
17
|
+
})(RecentInsulinTestIds || (RecentInsulinTestIds = {}));
|
|
18
|
+
export var RecommendedCarbsTestIds;
|
|
22
19
|
(function (RecommendedCarbsTestIds) {
|
|
23
20
|
RecommendedCarbsTestIds["RecommendedCarbs"] = "recommended-carbs";
|
|
24
21
|
RecommendedCarbsTestIds["EditRecommendedCarbs"] = "edit-recommended-carbs";
|
|
@@ -26,35 +23,35 @@ var RecommendedCarbsTestIds;
|
|
|
26
23
|
RecommendedCarbsTestIds["EnteredCarbs"] = "entered-carbs";
|
|
27
24
|
RecommendedCarbsTestIds["RemoveRecommendation"] = "remove-carb-recommendation";
|
|
28
25
|
RecommendedCarbsTestIds["TotalCarbs"] = "total-carbs";
|
|
29
|
-
})(RecommendedCarbsTestIds
|
|
30
|
-
var RecommendedInsulinTestIds;
|
|
26
|
+
})(RecommendedCarbsTestIds || (RecommendedCarbsTestIds = {}));
|
|
27
|
+
export var RecommendedInsulinTestIds;
|
|
31
28
|
(function (RecommendedInsulinTestIds) {
|
|
32
29
|
RecommendedInsulinTestIds["EditRecommendedInsulin"] = "edit-recommended-insulin";
|
|
33
30
|
RecommendedInsulinTestIds["InvisibleInsulinInput"] = "invisible-recommended-insulin-input";
|
|
34
31
|
RecommendedInsulinTestIds["ShownInsulinText"] = "shown-insulin-text";
|
|
35
|
-
})(RecommendedInsulinTestIds
|
|
36
|
-
var RecommendationModalTestIds;
|
|
32
|
+
})(RecommendedInsulinTestIds || (RecommendedInsulinTestIds = {}));
|
|
33
|
+
export var RecommendationModalTestIds;
|
|
37
34
|
(function (RecommendationModalTestIds) {
|
|
38
35
|
RecommendationModalTestIds["DeclineCarbs"] = "recommendation-modal-decline-carbs";
|
|
39
36
|
RecommendationModalTestIds["AcceptCarbs"] = "recommendation-modal-accept-carbs";
|
|
40
37
|
RecommendationModalTestIds["OkButton"] = "recommendation-modal-ok-button";
|
|
41
38
|
RecommendationModalTestIds["SuggestedCarbs"] = "recommendation-modal-suggested-carbs";
|
|
42
|
-
})(RecommendationModalTestIds
|
|
43
|
-
var RemeasureTestIds;
|
|
39
|
+
})(RecommendationModalTestIds || (RecommendationModalTestIds = {}));
|
|
40
|
+
export var RemeasureTestIds;
|
|
44
41
|
(function (RemeasureTestIds) {
|
|
45
42
|
RemeasureTestIds["RemeasureSlider"] = "remeasure-slider";
|
|
46
|
-
})(RemeasureTestIds
|
|
47
|
-
var TransferToLogbookTestIds;
|
|
43
|
+
})(RemeasureTestIds || (RemeasureTestIds = {}));
|
|
44
|
+
export var TransferToLogbookTestIds;
|
|
48
45
|
(function (TransferToLogbookTestIds) {
|
|
49
46
|
TransferToLogbookTestIds["TransferButton"] = "transfer-to-logbook-button";
|
|
50
|
-
})(TransferToLogbookTestIds
|
|
51
|
-
var TwoOptionModalTestIds;
|
|
47
|
+
})(TransferToLogbookTestIds || (TransferToLogbookTestIds = {}));
|
|
48
|
+
export var TwoOptionModalTestIds;
|
|
52
49
|
(function (TwoOptionModalTestIds) {
|
|
53
50
|
TwoOptionModalTestIds["ExitButton"] = "exit-two-option-modal";
|
|
54
51
|
TwoOptionModalTestIds["FirstOption"] = "first-option-button";
|
|
55
52
|
TwoOptionModalTestIds["SecondOption"] = "second-option-button";
|
|
56
|
-
})(TwoOptionModalTestIds
|
|
57
|
-
var InfoBarTestIds;
|
|
53
|
+
})(TwoOptionModalTestIds || (TwoOptionModalTestIds = {}));
|
|
54
|
+
export var InfoBarTestIds;
|
|
58
55
|
(function (InfoBarTestIds) {
|
|
59
56
|
let Value;
|
|
60
57
|
(function (Value) {
|
|
@@ -74,8 +71,8 @@ var InfoBarTestIds;
|
|
|
74
71
|
Unit["BloodGlucose"] = "BloodGlucoseUnit";
|
|
75
72
|
Unit["ActiveInsulin"] = "ActiveInsulinUnit";
|
|
76
73
|
})(Unit = InfoBarTestIds.Unit || (InfoBarTestIds.Unit = {}));
|
|
77
|
-
})(InfoBarTestIds
|
|
78
|
-
var RecommendationErrorEnum;
|
|
74
|
+
})(InfoBarTestIds || (InfoBarTestIds = {}));
|
|
75
|
+
export var RecommendationErrorEnum;
|
|
79
76
|
(function (RecommendationErrorEnum) {
|
|
80
77
|
RecommendationErrorEnum[RecommendationErrorEnum["ActivityDuration"] = 0] = "ActivityDuration";
|
|
81
78
|
RecommendationErrorEnum[RecommendationErrorEnum["ActivityTargetBGL"] = 1] = "ActivityTargetBGL";
|
|
@@ -99,8 +96,8 @@ var RecommendationErrorEnum;
|
|
|
99
96
|
RecommendationErrorEnum[RecommendationErrorEnum["BloodKetoneUnit"] = 19] = "BloodKetoneUnit";
|
|
100
97
|
RecommendationErrorEnum[RecommendationErrorEnum["BloodGlucoseUnit"] = 20] = "BloodGlucoseUnit";
|
|
101
98
|
RecommendationErrorEnum[RecommendationErrorEnum["BloodKetoneProps"] = 21] = "BloodKetoneProps";
|
|
102
|
-
})(RecommendationErrorEnum
|
|
103
|
-
var BgLevel;
|
|
99
|
+
})(RecommendationErrorEnum || (RecommendationErrorEnum = {}));
|
|
100
|
+
export var BgLevel;
|
|
104
101
|
(function (BgLevel) {
|
|
105
102
|
BgLevel[BgLevel["SevereHypoglycemia"] = 0] = "SevereHypoglycemia";
|
|
106
103
|
BgLevel[BgLevel["Hypoglycemia"] = 1] = "Hypoglycemia";
|
|
@@ -112,11 +109,11 @@ var BgLevel;
|
|
|
112
109
|
BgLevel[BgLevel["SevereHyperglycemia"] = 7] = "SevereHyperglycemia";
|
|
113
110
|
BgLevel[BgLevel["UnsupportedBGLevel"] = 8] = "UnsupportedBGLevel";
|
|
114
111
|
BgLevel[BgLevel["BGLevelNotProvided"] = 9] = "BGLevelNotProvided";
|
|
115
|
-
})(BgLevel
|
|
116
|
-
var RecommendationReminders;
|
|
112
|
+
})(BgLevel || (BgLevel = {}));
|
|
113
|
+
export var RecommendationReminders;
|
|
117
114
|
(function (RecommendationReminders) {
|
|
118
115
|
RecommendationReminders[RecommendationReminders["ReminderOff"] = 0] = "ReminderOff";
|
|
119
116
|
RecommendationReminders[RecommendationReminders["Reminder15Minutes"] = 0.25] = "Reminder15Minutes";
|
|
120
117
|
RecommendationReminders[RecommendationReminders["Reminder60Minutes"] = 1] = "Reminder60Minutes";
|
|
121
118
|
RecommendationReminders[RecommendationReminders["HediaReminderDefault"] = 1.5] = "HediaReminderDefault";
|
|
122
|
-
})(RecommendationReminders
|
|
119
|
+
})(RecommendationReminders || (RecommendationReminders = {}));
|
package/src/types/types.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
exports.Messages = exports.addPostponeActivityMessageUnder5MMOL = exports.AttentionMessage = void 0;
|
|
7
|
-
const types_1 = require("@hedia/types");
|
|
8
|
-
const macro_1 = require("@lingui/macro");
|
|
9
|
-
const moment_1 = __importDefault(require("moment"));
|
|
10
|
-
const i18nUtils_1 = require("../locale/i18nUtils");
|
|
11
|
-
exports.AttentionMessage = {
|
|
1
|
+
import { BolusCalculator } from "@hedia/types";
|
|
2
|
+
import { t } from "@lingui/macro";
|
|
3
|
+
import moment from "moment";
|
|
4
|
+
import { i18n } from "../locale/i18nUtils";
|
|
5
|
+
export const AttentionMessage = {
|
|
12
6
|
SevereHypoglycemia: () => `${Messages.VeryLowBGL()}${`\n`}${Messages.Reminder15Minutes()}`,
|
|
13
7
|
Hypoglycemia: () => `${Messages.LowBGL()}${`\n`}${Messages.Reminder15Minutes()}`,
|
|
14
8
|
MildHypoglycemia: () => Messages.Reminder15Minutes(),
|
|
@@ -23,40 +17,38 @@ exports.AttentionMessage = {
|
|
|
23
17
|
NormoglycemiaUnder5MMOL: null,
|
|
24
18
|
UnsupportedBGLevel: null,
|
|
25
19
|
};
|
|
26
|
-
function addPostponeActivityMessageUnder5MMOL(message) {
|
|
20
|
+
export function addPostponeActivityMessageUnder5MMOL(message) {
|
|
27
21
|
return `${message}${`\n`}${Messages.PostponePhysicalActivityUnder5MMOL()}`;
|
|
28
22
|
}
|
|
29
|
-
|
|
30
|
-
const SAFETY_INSULIN_LIMIT = types_1.BolusCalculator.Constants.SAFETY_INSULIN_LIMIT;
|
|
23
|
+
const SAFETY_INSULIN_LIMIT = BolusCalculator.Constants.SAFETY_INSULIN_LIMIT;
|
|
31
24
|
function getLimitedValue(reduction) {
|
|
32
25
|
return SAFETY_INSULIN_LIMIT - SAFETY_INSULIN_LIMIT * reduction;
|
|
33
26
|
}
|
|
34
|
-
class Messages {
|
|
27
|
+
export class Messages {
|
|
35
28
|
}
|
|
36
|
-
|
|
37
|
-
Messages.
|
|
38
|
-
Messages.
|
|
39
|
-
Messages.
|
|
40
|
-
Messages.
|
|
41
|
-
Messages.
|
|
42
|
-
Messages.
|
|
43
|
-
Messages.
|
|
44
|
-
Messages.RecommendationWasLimited = () => i18nUtils_1.i18n._(macro_1.t `Your recommendation would have been higher than ${SAFETY_INSULIN_LIMIT} units of insulin, but it has been limited for safety reasons.
|
|
29
|
+
Messages.VeryLowBGL = () => i18n._(t `Your blood glucose level is very low. Take glucagon or eat carbohydrates if possible. Seek medical attention.`);
|
|
30
|
+
Messages.LowBGL = () => i18n._(t `Your blood glucose level is very low.`);
|
|
31
|
+
Messages.Reminder15Minutes = () => i18n._(t `You will be reminded to measure your blood glucose level in 15 min.`);
|
|
32
|
+
Messages.PostponePhysicalActivity = () => i18n._(t `If it is possible, postpone your planned exercise.`);
|
|
33
|
+
Messages.PostponePhysicalActivityUnder5MMOL = () => i18n._(t `Consider not to initiate physical activity before your blood glucose level is within the recommended ranges prior to physical activity.`);
|
|
34
|
+
Messages.HighBGL = () => i18n._(t `You have a high blood glucose level.`);
|
|
35
|
+
Messages.InsulinKetones = () => i18n._(t `You should take rapid-acting insulin and measure ketones.`);
|
|
36
|
+
Messages.RecommendationWasLimited = () => i18n._(t `Your recommendation would have been higher than ${SAFETY_INSULIN_LIMIT} units of insulin, but it has been limited for safety reasons.
|
|
45
37
|
Hedia never recommends more than ${SAFETY_INSULIN_LIMIT} units of insulin per calculation.`);
|
|
46
|
-
Messages.RecommendationWasLimitedActivity = (activityReduction) =>
|
|
38
|
+
Messages.RecommendationWasLimitedActivity = (activityReduction) => i18n._(t `Your recommendation would have been higher than ${getLimitedValue(activityReduction)}
|
|
47
39
|
units of insulin, but it has been limited for safety reasons.${`\n\n`}
|
|
48
40
|
Hedia never recommends more than ${SAFETY_INSULIN_LIMIT}
|
|
49
41
|
units of insulin per calculation, but because of the physical activity
|
|
50
42
|
you entered it has been further reduced by ${(activityReduction * 100).toFixed(0)}% to
|
|
51
43
|
${getLimitedValue(activityReduction)}.`);
|
|
52
44
|
Messages.InsulinInputWasLimited = (activityReduction) => activityReduction
|
|
53
|
-
?
|
|
45
|
+
? i18n._(t `Hedia doesn't support more than ${SAFETY_INSULIN_LIMIT} units of insulin per calculation, but because of the physical activity you entered it has been further reduced by
|
|
54
46
|
${(activityReduction * 100).toFixed(0)}% to ${getLimitedValue(activityReduction)} units for this calculation.`)
|
|
55
|
-
:
|
|
56
|
-
Messages.TimeoutPrompTitle = () =>
|
|
57
|
-
Messages.TimeoutRecommendationNotVisible = () =>
|
|
47
|
+
: i18n._(t `Hedia does not support more than ${SAFETY_INSULIN_LIMIT} units of insulin per calculation.`);
|
|
48
|
+
Messages.TimeoutPrompTitle = () => i18n._(t `More than 15 minutes has passed since this calculation was started.`);
|
|
49
|
+
Messages.TimeoutRecommendationNotVisible = () => i18n._(t `Please go through the calculation steps with new measurements to ensure a safe recommendation.`);
|
|
58
50
|
Messages.TimeoutRecommendationVisible = (date) => {
|
|
59
|
-
const day =
|
|
60
|
-
const time =
|
|
61
|
-
return
|
|
51
|
+
const day = moment(date).format(`LL`);
|
|
52
|
+
const time = moment(date).format(`HH:mm`);
|
|
53
|
+
return i18n._(t `Recommendation from ${day} at ${time} was not transfered to your logbook.${`\n`}Did you use the recommendation?`);
|
|
62
54
|
};
|
package/src/utils/Constants.js
CHANGED
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
exports.ACTIVITY_TARGET_BGL_MMOL_LIMITS = { min: 5, max: 13.9 };
|
|
25
|
-
exports.REMINDER_HOURS_LIMITS = { min: 0, max: 6 };
|
|
26
|
-
exports.ACTIVITY_SETTINGS_INTERVAL_LIMITS = { min: 0, max: 1 };
|
|
1
|
+
export const BACKGROUND_COLOUR_PURPLE = `rgba(27, 31, 72, 1)`;
|
|
2
|
+
export const BORDER_COLOUR_GREY = `rgba(74, 91, 134, 1)`;
|
|
3
|
+
export const BORDER_COLOUR_TEAL = `rgba(1, 255, 252, 0.8)`;
|
|
4
|
+
export const SEVERE_HYPERGLYCEMIA_START_MMOL = 15;
|
|
5
|
+
export const FOUR_HOURS_SECONDS = 14400;
|
|
6
|
+
export const ONE_HOUR_MINUTES = 60;
|
|
7
|
+
export const ACTIVITY_BUFFER_MINUTES = 10;
|
|
8
|
+
export const CARBOHYDRATES_LIMTS = { min: 0, max: 300 };
|
|
9
|
+
export const INSULIN_DOSE_LIMITS = { min: 0, max: 50 };
|
|
10
|
+
export const BOLUS_SECONDS_PASSED_LIMITS = { min: 0, max: FOUR_HOURS_SECONDS };
|
|
11
|
+
export const ACTIVITY_DURATION_MINUTES_LIMITS = { min: 1, max: ONE_HOUR_MINUTES };
|
|
12
|
+
export const INSULIN_SENSITIVITY_MMOL_LIMITS = { min: 0.3, max: 10 };
|
|
13
|
+
export const INSULIN_TO_CARBS_RATIO_LIMITS = { min: 1, max: 50 };
|
|
14
|
+
export const CURRENT_BGL_MMOL_LIMITS = { min: 1.1, max: 33.3 };
|
|
15
|
+
export const MMOLL_PER_MGDL_BGL = 0.0555;
|
|
16
|
+
export const MGDL_PER_MMOLL_BGL = 1 / MMOLL_PER_MGDL_BGL;
|
|
17
|
+
export const CURRENT_BKL_MMOL_LIMITS = { min: 0, max: 8 };
|
|
18
|
+
export const MMOLL_PER_MGDL_BKL = 0.096;
|
|
19
|
+
export const MGDL_PER_MMOLL_BKL = 1 / MMOLL_PER_MGDL_BKL;
|
|
20
|
+
export const TARGET_BGL_MMOL_LIMITS = { min: 5, max: 13.9 };
|
|
21
|
+
export const ACTIVITY_TARGET_BGL_MMOL_LIMITS = { min: 5, max: 13.9 };
|
|
22
|
+
export const REMINDER_HOURS_LIMITS = { min: 0, max: 6 };
|
|
23
|
+
export const ACTIVITY_SETTINGS_INTERVAL_LIMITS = { min: 0, max: 1 };
|