@hedia/recommendation-screen 1.0.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/.prettierignore +2 -0
- package/Changelog.md +5 -0
- package/README.md +3 -0
- package/android/app/BUCK +55 -0
- package/android/app/build.gradle +226 -0
- package/android/app/build_defs.bzl +19 -0
- package/android/app/debug.keystore +0 -0
- package/android/app/proguard-rules.pro +10 -0
- package/android/app/src/debug/AndroidManifest.xml +8 -0
- package/android/app/src/debug/java/com/hediarecommendationscreen/ReactNativeFlipper.java +72 -0
- package/android/app/src/main/AndroidManifest.xml +27 -0
- package/android/app/src/main/java/com/hediarecommendationscreen/MainActivity.java +15 -0
- package/android/app/src/main/java/com/hediarecommendationscreen/MainApplication.java +80 -0
- package/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/values/strings.xml +3 -0
- package/android/app/src/main/res/values/styles.xml +9 -0
- package/android/build.gradle +38 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/android/gradle.properties +28 -0
- package/android/gradlew +188 -0
- package/android/gradlew.bat +100 -0
- package/android/settings.gradle +3 -0
- package/index-git.sh +5 -0
- package/index.d.ts +5 -0
- package/index.js +16 -0
- package/index.ts +19 -0
- package/ios/HediaRecommendationScreen/AppDelegate.h +8 -0
- package/ios/HediaRecommendationScreen/AppDelegate.m +58 -0
- package/ios/HediaRecommendationScreen/Base.lproj/LaunchScreen.xib +42 -0
- package/ios/HediaRecommendationScreen/Images.xcassets/AppIcon.appiconset/Contents.json +38 -0
- package/ios/HediaRecommendationScreen/Images.xcassets/Contents.json +6 -0
- package/ios/HediaRecommendationScreen/Info.plist +57 -0
- package/ios/HediaRecommendationScreen/main.m +9 -0
- package/ios/HediaRecommendationScreen-tvOS/Info.plist +53 -0
- package/ios/HediaRecommendationScreen-tvOSTests/Info.plist +24 -0
- package/ios/HediaRecommendationScreen.xcodeproj/project.pbxproj +807 -0
- package/ios/HediaRecommendationScreen.xcodeproj/xcshareddata/xcschemes/HediaRecommendationScreen-tvOS.xcscheme +88 -0
- package/ios/HediaRecommendationScreen.xcodeproj/xcshareddata/xcschemes/HediaRecommendationScreen.xcscheme +88 -0
- package/ios/HediaRecommendationScreenTests/HediaRecommendationScreenTests.m +65 -0
- package/ios/HediaRecommendationScreenTests/Info.plist +24 -0
- package/ios/Podfile +104 -0
- package/package.json +75 -0
- package/src/RecommendationScreen.d.ts +42 -0
- package/src/RecommendationScreen.js +142 -0
- package/src/RecommendationScreen.tsx +210 -0
- package/src/assets/happy.png +0 -0
- package/src/assets/happy_active.png +0 -0
- package/src/assets/neutral.png +0 -0
- package/src/assets/neutral_active.png +0 -0
- package/src/assets/sad.png +0 -0
- package/src/assets/sad_active.png +0 -0
- package/src/assets/semi_happy.png +0 -0
- package/src/assets/semi_happy_active.png +0 -0
- package/src/assets/semi_sad.png +0 -0
- package/src/assets/semi_sad_active.png +0 -0
- package/src/components/Emotion.d.ts +14 -0
- package/src/components/Emotion.js +55 -0
- package/src/components/Emotion.tsx +71 -0
- package/src/components/Header.d.ts +52 -0
- package/src/components/Header.js +83 -0
- package/src/components/Header.tsx +94 -0
- package/src/components/Icon.js +41 -0
- package/src/components/InfoBars.d.ts +67 -0
- package/src/components/InfoBars.js +89 -0
- package/src/components/InfoBars.tsx +93 -0
- package/src/components/InvisibleNumberInput.d.ts +24 -0
- package/src/components/InvisibleNumberInput.js +64 -0
- package/src/components/InvisibleNumberInput.tsx +88 -0
- package/src/components/MoodIcon.d.ts +14 -0
- package/src/components/MoodIcon.js +53 -0
- package/src/components/MoodIcon.tsx +58 -0
- package/src/components/RecentInsulin.d.ts +9 -0
- package/src/components/RecentInsulin.js +91 -0
- package/src/components/RecentInsulin.tsx +97 -0
- package/src/components/RecommendedCarbs.d.ts +30 -0
- package/src/components/RecommendedCarbs.js +193 -0
- package/src/components/RecommendedCarbs.tsx +242 -0
- package/src/components/RecommendedInsulin.d.ts +22 -0
- package/src/components/RecommendedInsulin.js +110 -0
- package/src/components/RecommendedInsulin.tsx +147 -0
- package/src/components/Remeasure.d.ts +13 -0
- package/src/components/Remeasure.js +89 -0
- package/src/components/Remeasure.tsx +105 -0
- package/src/components/TransferToLogbook.d.ts +14 -0
- package/src/components/TransferToLogbook.js +81 -0
- package/src/components/TransferToLogbook.tsx +97 -0
- package/src/locale/da/messages.js +1 -0
- package/src/locale/da/messages.po +119 -0
- package/src/locale/en/messages.js +1 -0
- package/src/locale/en/messages.po +119 -0
- package/src/locale/i18nUtils.d.ts +5 -0
- package/src/locale/i18nUtils.js +22 -0
- package/src/locale/i18nUtils.ts +21 -0
- package/src/types/enum.d.ts +26 -0
- package/src/types/enum.js +34 -0
- package/src/types/enum.ts +30 -0
- package/src/types/types.d.ts +21 -0
- package/src/types/types.js +2 -0
- package/src/types/types.ts +23 -0
- package/src/utils/Constants.d.ts +3 -0
- package/src/utils/Constants.js +6 -0
- package/src/utils/Constants.ts +3 -0
- package/src/utils/RecommendationError.d.ts +9 -0
- package/src/utils/RecommendationError.js +17 -0
- package/src/utils/RecommendationError.ts +30 -0
- package/src/utils/Utils.d.ts +5 -0
- package/src/utils/Utils.js +24 -0
- package/src/utils/Utils.ts +26 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
msgid ""
|
|
2
|
+
msgstr ""
|
|
3
|
+
"POT-Creation-Date: 2020-06-26 17:15+0200\n"
|
|
4
|
+
"Mime-Version: 1.0\n"
|
|
5
|
+
"Content-Type: text/plain; charset=utf-8\n"
|
|
6
|
+
"Content-Transfer-Encoding: 8bit\n"
|
|
7
|
+
"X-Generator: @lingui/cli\n"
|
|
8
|
+
"Language: en\n"
|
|
9
|
+
"Project-Id-Version: \n"
|
|
10
|
+
"Report-Msgid-Bugs-To: \n"
|
|
11
|
+
"PO-Revision-Date: \n"
|
|
12
|
+
"Last-Translator: \n"
|
|
13
|
+
"Language-Team: \n"
|
|
14
|
+
"Plural-Forms: \n"
|
|
15
|
+
|
|
16
|
+
#: src/RecommendationScreen.tsx:87
|
|
17
|
+
msgid "Active Insulin"
|
|
18
|
+
msgstr "Active Insulin"
|
|
19
|
+
|
|
20
|
+
#: src/components/RecommendedCarbs.tsx:45
|
|
21
|
+
msgid "Additional"
|
|
22
|
+
msgstr "Additional"
|
|
23
|
+
|
|
24
|
+
#: src/RecommendationScreen.tsx:88
|
|
25
|
+
msgid "Blood Glucose Level"
|
|
26
|
+
msgstr "Blood Glucose Level"
|
|
27
|
+
|
|
28
|
+
#: src/components/RecommendedCarbs.tsx:100
|
|
29
|
+
msgid "Entered"
|
|
30
|
+
msgstr "Entered"
|
|
31
|
+
|
|
32
|
+
#: src/components/RecommendedCarbs.tsx:99
|
|
33
|
+
msgid "Food"
|
|
34
|
+
msgstr "Food"
|
|
35
|
+
|
|
36
|
+
#: src/components/RecentInsulin.tsx:16
|
|
37
|
+
msgid "Have you taken insulin within the last 4 hours?"
|
|
38
|
+
msgstr "Have you taken insulin within the last 4 hours?"
|
|
39
|
+
|
|
40
|
+
#: src/RecommendationError.ts:19
|
|
41
|
+
msgid "Hedia does not support insulin recommendations related to strenuous activity."
|
|
42
|
+
msgstr "Hedia does not support insulin recommendations related to strenuous activity."
|
|
43
|
+
|
|
44
|
+
#: src/RecommendationError.ts:21
|
|
45
|
+
msgid "Hedia does not support insulin recommendations with more than 300g carbohydrates present."
|
|
46
|
+
msgstr "Hedia does not support insulin recommendations with more than 300g carbohydrates present."
|
|
47
|
+
|
|
48
|
+
#: src/components/Emotion.tsx:29
|
|
49
|
+
msgid "How are you feeling?"
|
|
50
|
+
msgstr "How are you feeling?"
|
|
51
|
+
|
|
52
|
+
#: src/components/Header.tsx:29
|
|
53
|
+
msgid "INSULIN\\nRECOMMENDATION"
|
|
54
|
+
msgstr ""
|
|
55
|
+
"INSULIN\n"
|
|
56
|
+
"RECOMMENDATION"
|
|
57
|
+
|
|
58
|
+
#: src/RecommendationError.ts:22
|
|
59
|
+
msgid "Insulin limit reached, for your safety Hedia will not recommend more than this."
|
|
60
|
+
msgstr "Insulin limit reached, for your safety Hedia will not recommend more than this."
|
|
61
|
+
|
|
62
|
+
#: src/components/RecentInsulin.tsx:25
|
|
63
|
+
msgid "No"
|
|
64
|
+
msgstr "No"
|
|
65
|
+
|
|
66
|
+
#: src/components/Remeasure.tsx:37
|
|
67
|
+
msgid "OFF"
|
|
68
|
+
msgstr "OFF"
|
|
69
|
+
|
|
70
|
+
#: src/RecommendationError.ts:20
|
|
71
|
+
msgid "Please verify your activity interval settings are set up correctly."
|
|
72
|
+
msgstr "Please verify your activity interval settings are set up correctly."
|
|
73
|
+
|
|
74
|
+
#: src/components/RecommendedCarbs.tsx:42
|
|
75
|
+
msgid "Recommended"
|
|
76
|
+
msgstr "Recommended"
|
|
77
|
+
|
|
78
|
+
#: src/components/RecentInsulin.tsx:12
|
|
79
|
+
#: src/components/RecommendedInsulin.tsx:43
|
|
80
|
+
msgid "Recommended amount of insulin"
|
|
81
|
+
msgstr "Recommended amount of insulin"
|
|
82
|
+
|
|
83
|
+
#: src/components/Remeasure.tsx:33
|
|
84
|
+
msgid "Remind me to remeasure in"
|
|
85
|
+
msgstr "Remind me to remeasure in"
|
|
86
|
+
|
|
87
|
+
#: src/components/RecommendedCarbs.tsx:67
|
|
88
|
+
msgid "Total"
|
|
89
|
+
msgstr "Total"
|
|
90
|
+
|
|
91
|
+
#: src/components/TransferToLogbook.tsx:25
|
|
92
|
+
msgid "Transfer to logbook"
|
|
93
|
+
msgstr "Transfer to logbook"
|
|
94
|
+
|
|
95
|
+
#: src/components/TransferToLogbook.tsx:28
|
|
96
|
+
msgid "Transfered to logbook"
|
|
97
|
+
msgstr "Transfered to logbook"
|
|
98
|
+
|
|
99
|
+
#: src/components/RecommendedInsulin.tsx:49
|
|
100
|
+
msgid "Units"
|
|
101
|
+
msgstr "Units"
|
|
102
|
+
|
|
103
|
+
#: src/components/RecentInsulin.tsx:22
|
|
104
|
+
msgid "Yes"
|
|
105
|
+
msgstr "Yes"
|
|
106
|
+
|
|
107
|
+
#: src/components/RecommendedCarbs.tsx:59
|
|
108
|
+
#: src/components/RecommendedCarbs.tsx:69
|
|
109
|
+
#: src/components/RecommendedCarbs.tsx:102
|
|
110
|
+
msgid "g carbs"
|
|
111
|
+
msgstr "g carbs"
|
|
112
|
+
|
|
113
|
+
#: src/components/Remeasure.tsx:40
|
|
114
|
+
msgid "hours"
|
|
115
|
+
msgstr "hours"
|
|
116
|
+
|
|
117
|
+
#: src/RecommendationScreen.tsx:87
|
|
118
|
+
msgid "units"
|
|
119
|
+
msgstr "units"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.changeLanguage = exports.i18n = exports.languageCatalogs = void 0;
|
|
4
|
+
const core_1 = require("@lingui/core");
|
|
5
|
+
exports.languageCatalogs = {
|
|
6
|
+
da: require(`./da/messages.js`),
|
|
7
|
+
en: require(`./en/messages.js`),
|
|
8
|
+
};
|
|
9
|
+
exports.i18n = core_1.setupI18n({
|
|
10
|
+
language: `en`,
|
|
11
|
+
catalogs: exports.languageCatalogs,
|
|
12
|
+
});
|
|
13
|
+
function changeLanguage(language) {
|
|
14
|
+
if (exports.languageCatalogs[language]) {
|
|
15
|
+
exports.i18n.activate(language);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
exports.i18n.activate(`en`);
|
|
19
|
+
}
|
|
20
|
+
return exports.i18n;
|
|
21
|
+
}
|
|
22
|
+
exports.changeLanguage = changeLanguage;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Catalogs, I18n, setupI18n } from "@lingui/core";
|
|
2
|
+
import { Languages } from "../types/enum.js";
|
|
3
|
+
|
|
4
|
+
export const languageCatalogs: Catalogs = {
|
|
5
|
+
da: require(`./da/messages.js`),
|
|
6
|
+
en: require(`./en/messages.js`),
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const i18n = setupI18n({
|
|
10
|
+
language: `en`,
|
|
11
|
+
catalogs: languageCatalogs,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export function changeLanguage(language: Languages): I18n {
|
|
15
|
+
if (languageCatalogs[language]) {
|
|
16
|
+
i18n.activate(language);
|
|
17
|
+
} else {
|
|
18
|
+
i18n.activate(`en`);
|
|
19
|
+
}
|
|
20
|
+
return i18n;
|
|
21
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare enum MoodEnum {
|
|
2
|
+
Sad = 1,
|
|
3
|
+
SemiSad = 2,
|
|
4
|
+
Neutral = 3,
|
|
5
|
+
SemiHappy = 4,
|
|
6
|
+
Happy = 5
|
|
7
|
+
}
|
|
8
|
+
export declare enum BGUnit {
|
|
9
|
+
MMOL_L = "mmol/l",
|
|
10
|
+
MG_DL = "mg/dl"
|
|
11
|
+
}
|
|
12
|
+
export declare enum InjectionMethod {
|
|
13
|
+
PenHalf = "Pen-half",
|
|
14
|
+
PenWhole = "Pen-whole",
|
|
15
|
+
Pump = "Pump"
|
|
16
|
+
}
|
|
17
|
+
export declare enum Languages {
|
|
18
|
+
da = "da",
|
|
19
|
+
en = "en"
|
|
20
|
+
}
|
|
21
|
+
export declare enum RecommendationErrorEnum {
|
|
22
|
+
ActivityOutOfRange = 0,
|
|
23
|
+
ActivityNull = 1,
|
|
24
|
+
CarbohydrateLimit = 2,
|
|
25
|
+
InsulinLimit = 3
|
|
26
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RecommendationErrorEnum = exports.Languages = exports.InjectionMethod = exports.BGUnit = exports.MoodEnum = void 0;
|
|
4
|
+
var MoodEnum;
|
|
5
|
+
(function (MoodEnum) {
|
|
6
|
+
MoodEnum[MoodEnum["Sad"] = 1] = "Sad";
|
|
7
|
+
MoodEnum[MoodEnum["SemiSad"] = 2] = "SemiSad";
|
|
8
|
+
MoodEnum[MoodEnum["Neutral"] = 3] = "Neutral";
|
|
9
|
+
MoodEnum[MoodEnum["SemiHappy"] = 4] = "SemiHappy";
|
|
10
|
+
MoodEnum[MoodEnum["Happy"] = 5] = "Happy";
|
|
11
|
+
})(MoodEnum = exports.MoodEnum || (exports.MoodEnum = {}));
|
|
12
|
+
var BGUnit;
|
|
13
|
+
(function (BGUnit) {
|
|
14
|
+
BGUnit["MMOL_L"] = "mmol/l";
|
|
15
|
+
BGUnit["MG_DL"] = "mg/dl";
|
|
16
|
+
})(BGUnit = exports.BGUnit || (exports.BGUnit = {}));
|
|
17
|
+
var InjectionMethod;
|
|
18
|
+
(function (InjectionMethod) {
|
|
19
|
+
InjectionMethod["PenHalf"] = "Pen-half";
|
|
20
|
+
InjectionMethod["PenWhole"] = "Pen-whole";
|
|
21
|
+
InjectionMethod["Pump"] = "Pump";
|
|
22
|
+
})(InjectionMethod = exports.InjectionMethod || (exports.InjectionMethod = {}));
|
|
23
|
+
var Languages;
|
|
24
|
+
(function (Languages) {
|
|
25
|
+
Languages["da"] = "da";
|
|
26
|
+
Languages["en"] = "en";
|
|
27
|
+
})(Languages = exports.Languages || (exports.Languages = {}));
|
|
28
|
+
var RecommendationErrorEnum;
|
|
29
|
+
(function (RecommendationErrorEnum) {
|
|
30
|
+
RecommendationErrorEnum[RecommendationErrorEnum["ActivityOutOfRange"] = 0] = "ActivityOutOfRange";
|
|
31
|
+
RecommendationErrorEnum[RecommendationErrorEnum["ActivityNull"] = 1] = "ActivityNull";
|
|
32
|
+
RecommendationErrorEnum[RecommendationErrorEnum["CarbohydrateLimit"] = 2] = "CarbohydrateLimit";
|
|
33
|
+
RecommendationErrorEnum[RecommendationErrorEnum["InsulinLimit"] = 3] = "InsulinLimit";
|
|
34
|
+
})(RecommendationErrorEnum = exports.RecommendationErrorEnum || (exports.RecommendationErrorEnum = {}));
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export enum MoodEnum {
|
|
2
|
+
Sad = 1,
|
|
3
|
+
SemiSad = 2,
|
|
4
|
+
Neutral = 3,
|
|
5
|
+
SemiHappy = 4,
|
|
6
|
+
Happy = 5,
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export enum BGUnit {
|
|
10
|
+
MMOL_L = "mmol/l",
|
|
11
|
+
MG_DL = "mg/dl",
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export enum InjectionMethod {
|
|
15
|
+
PenHalf = "Pen-half",
|
|
16
|
+
PenWhole = "Pen-whole",
|
|
17
|
+
Pump = "Pump",
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export enum Languages {
|
|
21
|
+
da = "da",
|
|
22
|
+
en = "en",
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export enum RecommendationErrorEnum {
|
|
26
|
+
ActivityOutOfRange,
|
|
27
|
+
ActivityNull,
|
|
28
|
+
CarbohydrateLimit,
|
|
29
|
+
InsulinLimit,
|
|
30
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { MoodEnum } from "./enum";
|
|
2
|
+
export interface logbookEntry {
|
|
3
|
+
uuid: string;
|
|
4
|
+
entry_timestamp: string;
|
|
5
|
+
server_timestamp?: Date;
|
|
6
|
+
client_timestamp: string;
|
|
7
|
+
overwritten_by_id?: string | null;
|
|
8
|
+
settings_uuid: string;
|
|
9
|
+
client_version: number;
|
|
10
|
+
server_version?: number;
|
|
11
|
+
device_and_os?: string;
|
|
12
|
+
insulin_suggested_units: number | null;
|
|
13
|
+
insulin_entered_units: number;
|
|
14
|
+
carbohydrates_suggested_grams: number | null;
|
|
15
|
+
carbohydrates_entered_grams: number;
|
|
16
|
+
blood_glucose_millimolar: number | null;
|
|
17
|
+
mood: MoodEnum | null;
|
|
18
|
+
event_uuid: string | null;
|
|
19
|
+
is_deleted: Date | null;
|
|
20
|
+
utc_timezone_offset?: string | null;
|
|
21
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { MoodEnum } from "./enum";
|
|
2
|
+
|
|
3
|
+
// tslint:disable-next-line: interface-name class-name
|
|
4
|
+
export interface logbookEntry {
|
|
5
|
+
uuid: string;
|
|
6
|
+
entry_timestamp: string; // The date where the entry appears when the user look at their logbook in the app
|
|
7
|
+
server_timestamp?: Date;
|
|
8
|
+
client_timestamp: string; // The time when the entry was created by the user on their phone
|
|
9
|
+
overwritten_by_id?: string | null;
|
|
10
|
+
settings_uuid: string;
|
|
11
|
+
client_version: number;
|
|
12
|
+
server_version?: number;
|
|
13
|
+
device_and_os?: string;
|
|
14
|
+
insulin_suggested_units: number | null;
|
|
15
|
+
insulin_entered_units: number;
|
|
16
|
+
carbohydrates_suggested_grams: number | null;
|
|
17
|
+
carbohydrates_entered_grams: number;
|
|
18
|
+
blood_glucose_millimolar: number | null;
|
|
19
|
+
mood: MoodEnum | null;
|
|
20
|
+
event_uuid: string | null;
|
|
21
|
+
is_deleted: Date | null;
|
|
22
|
+
utc_timezone_offset?: string | null;
|
|
23
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BORDER_COLOUR_TEAL = exports.BORDER_COLOUR_WHITE = exports.BACKGROUND_COLOUR_PURPLE = void 0;
|
|
4
|
+
exports.BACKGROUND_COLOUR_PURPLE = `rgba(27, 31, 72, 1)`;
|
|
5
|
+
exports.BORDER_COLOUR_WHITE = `rgba(74, 91, 134, 1)`;
|
|
6
|
+
exports.BORDER_COLOUR_TEAL = `rgba(1, 255, 252, 0.8)`;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RecommendationErrorEnum } from "../types/enum";
|
|
2
|
+
export declare class RecommendationError extends Error {
|
|
3
|
+
readonly type: RecommendationErrorEnum;
|
|
4
|
+
constructor(message: string, type: RecommendationErrorEnum);
|
|
5
|
+
}
|
|
6
|
+
export declare const ActivityRangeError: RecommendationError;
|
|
7
|
+
export declare const ActivityNullError: RecommendationError;
|
|
8
|
+
export declare const CarbohydrateLimitError: RecommendationError;
|
|
9
|
+
export declare const InsulinLimitError: RecommendationError;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InsulinLimitError = exports.CarbohydrateLimitError = exports.ActivityNullError = exports.ActivityRangeError = exports.RecommendationError = void 0;
|
|
4
|
+
const macro_1 = require("@lingui/macro");
|
|
5
|
+
const i18nUtils_1 = require("../locale/i18nUtils");
|
|
6
|
+
const enum_1 = require("../types/enum");
|
|
7
|
+
class RecommendationError extends Error {
|
|
8
|
+
constructor(message, type) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.type = type;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.RecommendationError = RecommendationError;
|
|
14
|
+
exports.ActivityRangeError = new RecommendationError(i18nUtils_1.i18n._(macro_1.t `Hedia does not support insulin recommendations related to strenuous activity.`), enum_1.RecommendationErrorEnum.ActivityOutOfRange);
|
|
15
|
+
exports.ActivityNullError = new RecommendationError(i18nUtils_1.i18n._(macro_1.t `Please verify your activity interval settings are set up correctly.`), enum_1.RecommendationErrorEnum.ActivityNull);
|
|
16
|
+
exports.CarbohydrateLimitError = new RecommendationError(i18nUtils_1.i18n._(macro_1.t `Hedia does not support insulin recommendations with more than 300g carbohydrates present.`), enum_1.RecommendationErrorEnum.CarbohydrateLimit);
|
|
17
|
+
exports.InsulinLimitError = new RecommendationError(i18nUtils_1.i18n._(macro_1.t `Insulin limit reached, for your safety Hedia will not recommend more than this.`), enum_1.RecommendationErrorEnum.InsulinLimit);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { t } from "@lingui/macro";
|
|
2
|
+
import { i18n } from "../locale/i18nUtils";
|
|
3
|
+
import { RecommendationErrorEnum } from "../types/enum";
|
|
4
|
+
|
|
5
|
+
export class RecommendationError extends Error {
|
|
6
|
+
public readonly type: RecommendationErrorEnum;
|
|
7
|
+
|
|
8
|
+
constructor(message: string, type: RecommendationErrorEnum) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.type = type;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const ActivityRangeError = new RecommendationError(
|
|
15
|
+
i18n._(t`Hedia does not support insulin recommendations related to strenuous activity.`),
|
|
16
|
+
RecommendationErrorEnum.ActivityOutOfRange,
|
|
17
|
+
);
|
|
18
|
+
export const ActivityNullError = new RecommendationError(
|
|
19
|
+
i18n._(t`Please verify your activity interval settings are set up correctly.`),
|
|
20
|
+
RecommendationErrorEnum.ActivityNull,
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export const CarbohydrateLimitError = new RecommendationError(
|
|
24
|
+
i18n._(t`Hedia does not support insulin recommendations with more than 300g carbohydrates present.`),
|
|
25
|
+
RecommendationErrorEnum.CarbohydrateLimit,
|
|
26
|
+
);
|
|
27
|
+
export const InsulinLimitError = new RecommendationError(
|
|
28
|
+
i18n._(t`Insulin limit reached, for your safety Hedia will not recommend more than this.`),
|
|
29
|
+
RecommendationErrorEnum.InsulinLimit,
|
|
30
|
+
);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Utils = void 0;
|
|
4
|
+
const enum_1 = require("../types/enum");
|
|
5
|
+
class Utils {
|
|
6
|
+
static getRounding(method) {
|
|
7
|
+
switch (method) {
|
|
8
|
+
case enum_1.InjectionMethod.PenWhole:
|
|
9
|
+
return 1;
|
|
10
|
+
case enum_1.InjectionMethod.PenHalf:
|
|
11
|
+
return 2;
|
|
12
|
+
case enum_1.InjectionMethod.Pump:
|
|
13
|
+
return 10;
|
|
14
|
+
default:
|
|
15
|
+
throw Error(`Unsupported InjectionMethod: ${method}`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
static roundValue(value, injectMethod) {
|
|
19
|
+
const rounding = Utils.getRounding(injectMethod);
|
|
20
|
+
const rounded = Math.round(value * rounding) / rounding;
|
|
21
|
+
return rounded;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.Utils = Utils;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { InjectionMethod } from "../types/enum";
|
|
2
|
+
|
|
3
|
+
export class Utils {
|
|
4
|
+
public static getRounding(method: InjectionMethod) {
|
|
5
|
+
switch (method) {
|
|
6
|
+
case InjectionMethod.PenWhole:
|
|
7
|
+
return 1;
|
|
8
|
+
|
|
9
|
+
case InjectionMethod.PenHalf:
|
|
10
|
+
return 2;
|
|
11
|
+
|
|
12
|
+
case InjectionMethod.Pump:
|
|
13
|
+
return 10;
|
|
14
|
+
|
|
15
|
+
default:
|
|
16
|
+
throw Error(`Unsupported InjectionMethod: ${method}`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public static roundValue(value: number, injectMethod: InjectionMethod) {
|
|
21
|
+
const rounding = Utils.getRounding(injectMethod);
|
|
22
|
+
|
|
23
|
+
const rounded = Math.round(value * rounding) / rounding;
|
|
24
|
+
return rounded;
|
|
25
|
+
}
|
|
26
|
+
}
|