@hedia/recommendation-screen 1.0.3 → 1.0.4
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/Changelog.md +0 -4
- package/package.json +1 -1
- package/index.d.ts +0 -5
- package/index.js +0 -16
- package/src/RecommendationScreen.d.ts +0 -42
- package/src/RecommendationScreen.js +0 -141
- package/src/components/Emotion.d.ts +0 -14
- package/src/components/Emotion.js +0 -54
- package/src/components/Header.d.ts +0 -52
- package/src/components/Header.js +0 -82
- package/src/components/InfoBars.d.ts +0 -67
- package/src/components/InfoBars.js +0 -89
- package/src/components/InvisibleNumberInput.d.ts +0 -24
- package/src/components/InvisibleNumberInput.js +0 -64
- package/src/components/MoodIcon.d.ts +0 -14
- package/src/components/MoodIcon.js +0 -53
- package/src/components/RecentInsulin.d.ts +0 -9
- package/src/components/RecentInsulin.js +0 -90
- package/src/components/RecommendedCarbs.d.ts +0 -30
- package/src/components/RecommendedCarbs.js +0 -192
- package/src/components/RecommendedInsulin.d.ts +0 -22
- package/src/components/RecommendedInsulin.js +0 -109
- package/src/components/Remeasure.d.ts +0 -13
- package/src/components/Remeasure.js +0 -88
- package/src/components/TransferToLogbook.d.ts +0 -14
- package/src/components/TransferToLogbook.js +0 -80
- package/src/locale/i18nUtils.d.ts +0 -5
- package/src/locale/i18nUtils.js +0 -22
- package/src/types/enum.d.ts +0 -26
- package/src/types/enum.js +0 -34
- package/src/types/types.d.ts +0 -21
- package/src/types/types.js +0 -2
- package/src/utils/Constants.d.ts +0 -3
- package/src/utils/Constants.js +0 -6
- package/src/utils/RecommendationError.d.ts +0 -9
- package/src/utils/RecommendationError.js +0 -16
- package/src/utils/Utils.d.ts +0 -5
- package/src/utils/Utils.js +0 -24
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const react_native_1 = require("react-native");
|
|
8
|
-
const i18nUtils_1 = require("../locale/i18nUtils");
|
|
9
|
-
const Icon_1 = __importDefault(require("./Icon"));
|
|
10
|
-
class TransferToLogbook extends react_1.default.Component {
|
|
11
|
-
constructor() {
|
|
12
|
-
super(...arguments);
|
|
13
|
-
this.state = {
|
|
14
|
-
pressed: false,
|
|
15
|
-
};
|
|
16
|
-
this.handlePress = () => {
|
|
17
|
-
this.setState({
|
|
18
|
-
pressed: !this.state.pressed,
|
|
19
|
-
});
|
|
20
|
-
this.props.transfer();
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
render() {
|
|
24
|
-
if (!this.props.visible) {
|
|
25
|
-
return <react_native_1.View style={addToLogbookStyles.marginContainer}/>;
|
|
26
|
-
}
|
|
27
|
-
return (<react_native_1.TouchableOpacity onPress={this.handlePress} style={addToLogbookStyles.container} accessibilityLabel="transferToLogbook">
|
|
28
|
-
{!this.state.pressed ? (<react_native_1.View style={addToLogbookStyles.textContainer}>
|
|
29
|
-
<react_native_1.Text style={addToLogbookStyles.transferText}>{i18nUtils_1.i18n._("Transfer to logbook")}</react_native_1.Text>
|
|
30
|
-
</react_native_1.View>) : (<react_native_1.View style={addToLogbookStyles.textContainerActive}>
|
|
31
|
-
<Icon_1.default style={addToLogbookStyles.icon} iconIdentifier={`Feather/check`}/>
|
|
32
|
-
<react_native_1.Text style={addToLogbookStyles.transferTextActive}>{i18nUtils_1.i18n._("Transfered to logbook")}</react_native_1.Text>
|
|
33
|
-
</react_native_1.View>)}
|
|
34
|
-
</react_native_1.TouchableOpacity>);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
exports.default = TransferToLogbook;
|
|
38
|
-
const addToLogbookStyles = react_native_1.StyleSheet.create({
|
|
39
|
-
marginContainer: {
|
|
40
|
-
marginVertical: `3%`,
|
|
41
|
-
},
|
|
42
|
-
container: {
|
|
43
|
-
flex: 1,
|
|
44
|
-
margin: `5%`,
|
|
45
|
-
},
|
|
46
|
-
textContainer: {
|
|
47
|
-
flexDirection: `row`,
|
|
48
|
-
justifyContent: `center`,
|
|
49
|
-
borderWidth: 1,
|
|
50
|
-
borderRadius: 100,
|
|
51
|
-
marginHorizontal: `4%`,
|
|
52
|
-
paddingVertical: `4%`,
|
|
53
|
-
borderColor: `#01FFFC`,
|
|
54
|
-
},
|
|
55
|
-
transferText: {
|
|
56
|
-
color: `#01FFFC`,
|
|
57
|
-
fontSize: react_native_1.Dimensions.get(`screen`).width / 22,
|
|
58
|
-
fontWeight: `bold`,
|
|
59
|
-
},
|
|
60
|
-
textContainerActive: {
|
|
61
|
-
flexDirection: `row`,
|
|
62
|
-
backgroundColor: `#01FFFC`,
|
|
63
|
-
justifyContent: `center`,
|
|
64
|
-
borderWidth: 1,
|
|
65
|
-
borderRadius: 100,
|
|
66
|
-
marginHorizontal: `4%`,
|
|
67
|
-
paddingVertical: `4%`,
|
|
68
|
-
},
|
|
69
|
-
icon: {
|
|
70
|
-
paddingTop: `1.3%`,
|
|
71
|
-
color: `#1B1F48`,
|
|
72
|
-
fontSize: react_native_1.Dimensions.get(`screen`).width / 22,
|
|
73
|
-
marginRight: `1%`,
|
|
74
|
-
},
|
|
75
|
-
transferTextActive: {
|
|
76
|
-
color: `#1B1F48`,
|
|
77
|
-
fontSize: react_native_1.Dimensions.get(`screen`).width / 22,
|
|
78
|
-
fontWeight: `bold`,
|
|
79
|
-
},
|
|
80
|
-
});
|
package/src/locale/i18nUtils.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
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;
|
package/src/types/enum.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
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
|
-
}
|
package/src/types/enum.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
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 = {}));
|
package/src/types/types.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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
|
-
}
|
package/src/types/types.js
DELETED
package/src/utils/Constants.d.ts
DELETED
package/src/utils/Constants.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
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)`;
|
|
@@ -1,9 +0,0 @@
|
|
|
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;
|
|
@@ -1,16 +0,0 @@
|
|
|
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 i18nUtils_1 = require("../locale/i18nUtils");
|
|
5
|
-
const enum_1 = require("../types/enum");
|
|
6
|
-
class RecommendationError extends Error {
|
|
7
|
-
constructor(message, type) {
|
|
8
|
-
super(message);
|
|
9
|
-
this.type = type;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.RecommendationError = RecommendationError;
|
|
13
|
-
exports.ActivityRangeError = new RecommendationError(i18nUtils_1.i18n._("Hedia does not support insulin recommendations related to strenuous activity."), enum_1.RecommendationErrorEnum.ActivityOutOfRange);
|
|
14
|
-
exports.ActivityNullError = new RecommendationError(i18nUtils_1.i18n._("Please verify your activity interval settings are set up correctly."), enum_1.RecommendationErrorEnum.ActivityNull);
|
|
15
|
-
exports.CarbohydrateLimitError = new RecommendationError(i18nUtils_1.i18n._("Hedia does not support insulin recommendations with more than 300g carbohydrates present."), enum_1.RecommendationErrorEnum.CarbohydrateLimit);
|
|
16
|
-
exports.InsulinLimitError = new RecommendationError(i18nUtils_1.i18n._("Insulin limit reached, for your safety Hedia will not recommend more than this."), enum_1.RecommendationErrorEnum.InsulinLimit);
|
package/src/utils/Utils.d.ts
DELETED
package/src/utils/Utils.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
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;
|