@hedia/recommendation-screen 1.0.5 → 1.0.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/App.jsx +70 -0
- package/Changelog.md +0 -0
- package/README.md +0 -0
- package/android/app/BUCK +0 -0
- package/android/app/build.gradle +0 -0
- package/android/app/build_defs.bzl +0 -0
- package/android/app/debug.keystore +0 -0
- package/android/app/proguard-rules.pro +0 -0
- package/android/app/src/debug/AndroidManifest.xml +0 -0
- package/android/app/src/debug/java/com/hediarecommendationscreen/ReactNativeFlipper.java +0 -0
- package/android/app/src/main/AndroidManifest.xml +0 -0
- package/android/app/src/main/java/com/hediarecommendationscreen/MainActivity.java +0 -0
- package/android/app/src/main/java/com/hediarecommendationscreen/MainApplication.java +0 -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 +0 -0
- package/android/app/src/main/res/values/styles.xml +0 -0
- package/android/build.gradle +0 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -0
- package/android/gradle.properties +0 -0
- package/android/gradlew +188 -188
- package/android/gradlew.bat +0 -0
- package/android/settings.gradle +0 -0
- package/index.d.ts +5 -0
- package/index.js +16 -0
- package/index.ts +0 -0
- package/ios/HediaRecommendationScreen/AppDelegate.h +0 -0
- package/ios/HediaRecommendationScreen/AppDelegate.m +0 -0
- package/ios/HediaRecommendationScreen/Base.lproj/LaunchScreen.xib +0 -0
- package/ios/HediaRecommendationScreen/Images.xcassets/AppIcon.appiconset/Contents.json +0 -0
- package/ios/HediaRecommendationScreen/Images.xcassets/Contents.json +0 -0
- package/ios/HediaRecommendationScreen/Info.plist +0 -0
- package/ios/HediaRecommendationScreen/main.m +0 -0
- package/ios/HediaRecommendationScreen-tvOS/Info.plist +0 -0
- package/ios/HediaRecommendationScreen-tvOSTests/Info.plist +0 -0
- package/ios/HediaRecommendationScreen.xcodeproj/project.pbxproj +0 -0
- package/ios/HediaRecommendationScreen.xcodeproj/xcshareddata/xcschemes/HediaRecommendationScreen-tvOS.xcscheme +0 -0
- package/ios/HediaRecommendationScreen.xcodeproj/xcshareddata/xcschemes/HediaRecommendationScreen.xcscheme +0 -0
- package/ios/HediaRecommendationScreenTests/HediaRecommendationScreenTests.m +0 -0
- package/ios/HediaRecommendationScreenTests/Info.plist +0 -0
- package/ios/Podfile +0 -0
- package/package.json +5 -5
- package/src/RecommendationScreen.d.ts +43 -0
- package/src/RecommendationScreen.jsx +158 -0
- package/src/RecommendationScreen.tsx +26 -4
- 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.jsx +54 -0
- package/src/components/Emotion.tsx +0 -0
- package/src/components/Header.d.ts +52 -0
- package/src/components/Header.jsx +82 -0
- package/src/components/Header.tsx +0 -0
- package/src/components/Icon.js +0 -0
- package/src/components/InfoBars.d.ts +67 -0
- package/src/components/InfoBars.jsx +90 -0
- package/src/components/InfoBars.tsx +3 -1
- package/src/components/InvisibleNumberInput.d.ts +24 -0
- package/src/components/InvisibleNumberInput.jsx +64 -0
- package/src/components/InvisibleNumberInput.tsx +0 -0
- package/src/components/MoodIcon.d.ts +14 -0
- package/src/components/MoodIcon.jsx +53 -0
- package/src/components/MoodIcon.tsx +0 -0
- package/src/components/RecentInsulin.d.ts +9 -0
- package/src/components/RecentInsulin.jsx +90 -0
- package/src/components/RecentInsulin.tsx +0 -0
- package/src/components/RecommendedCarbs.d.ts +30 -0
- package/src/components/RecommendedCarbs.jsx +193 -0
- package/src/components/RecommendedCarbs.tsx +3 -1
- package/src/components/RecommendedInsulin.d.ts +22 -0
- package/src/components/RecommendedInsulin.jsx +109 -0
- package/src/components/RecommendedInsulin.tsx +0 -0
- package/src/components/Remeasure.d.ts +13 -0
- package/src/components/Remeasure.jsx +88 -0
- package/src/components/Remeasure.tsx +0 -0
- package/src/components/TransferToLogbook.d.ts +14 -0
- package/src/components/TransferToLogbook.jsx +80 -0
- package/src/components/TransferToLogbook.tsx +0 -0
- package/src/locale/da/messages.js +1 -1
- package/src/locale/da/messages.po +20 -12
- package/src/locale/en/messages.js +1 -1
- package/src/locale/en/messages.po +19 -11
- package/src/locale/i18nUtils.d.ts +5 -0
- package/src/locale/i18nUtils.js +22 -0
- package/src/locale/i18nUtils.ts +0 -0
- package/src/types/enum.d.ts +34 -0
- package/src/types/enum.js +43 -0
- package/src/types/enum.ts +9 -0
- package/src/types/types.d.ts +21 -0
- package/src/types/types.js +2 -0
- package/src/types/types.ts +0 -0
- package/src/utils/Constants.d.ts +3 -0
- package/src/utils/Constants.js +6 -0
- package/src/utils/Constants.ts +0 -0
- package/src/utils/RecommendationError.d.ts +11 -0
- package/src/utils/RecommendationError.js +18 -0
- package/src/utils/RecommendationError.ts +12 -0
- package/src/utils/Utils.d.ts +5 -0
- package/src/utils/Utils.js +24 -0
- package/src/utils/Utils.ts +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BGUnit, InjectionMethod, Languages, MoodEnum } from "./types/enum";
|
|
3
|
+
import * as Calculator from "@hedia/recommendation-calculator";
|
|
4
|
+
import { RecommendationError } from "./utils/RecommendationError";
|
|
5
|
+
interface IResult {
|
|
6
|
+
suggested: number;
|
|
7
|
+
entered?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface IRecommendationProps {
|
|
10
|
+
units: BGUnit;
|
|
11
|
+
language: Languages;
|
|
12
|
+
calculatorParams: Calculator.IRecommendationParams;
|
|
13
|
+
injectionMethod: InjectionMethod;
|
|
14
|
+
exitCallback(): void;
|
|
15
|
+
removeRecommendedCarbs(): void;
|
|
16
|
+
onRecentInsulinYes(): void;
|
|
17
|
+
transferToLogbook(carbs: IResult, insulin: IResult, reminder: number): void;
|
|
18
|
+
onError(error: RecommendationError): void;
|
|
19
|
+
}
|
|
20
|
+
interface IState {
|
|
21
|
+
remeasureTime: number;
|
|
22
|
+
showRecentInsulin: boolean;
|
|
23
|
+
insulinRecommendation: number;
|
|
24
|
+
activityReduction?: number;
|
|
25
|
+
carbRecommendation: number;
|
|
26
|
+
activeInsulin: number;
|
|
27
|
+
selectedMood: MoodEnum | 0;
|
|
28
|
+
enteredCarbs?: number;
|
|
29
|
+
enteredInsulin?: number;
|
|
30
|
+
}
|
|
31
|
+
export default class RecommendationScreen extends React.Component<IRecommendationProps, IState> {
|
|
32
|
+
private readonly timer;
|
|
33
|
+
constructor(props: IRecommendationProps);
|
|
34
|
+
updateRemeasureTime: (remeasureTime: number) => void;
|
|
35
|
+
handleNoRecentInsulin: () => void;
|
|
36
|
+
removeCarbRecommendation: () => void;
|
|
37
|
+
handleMoodSelected: (selectedMood: IState["selectedMood"]) => void;
|
|
38
|
+
updateCarbRecommendation: (enteredCarbs: number) => void;
|
|
39
|
+
updateInsulinRecommendation: (enteredInsulin: number) => void;
|
|
40
|
+
handleTransfer: () => void;
|
|
41
|
+
render(): JSX.Element;
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
const react_1 = __importDefault(require("react"));
|
|
26
|
+
const react_native_1 = require("react-native");
|
|
27
|
+
const enum_1 = require("./types/enum");
|
|
28
|
+
const Constants_1 = require("./utils/Constants");
|
|
29
|
+
const Header_1 = __importStar(require("./components/Header"));
|
|
30
|
+
const InfoBars_1 = __importStar(require("./components/InfoBars"));
|
|
31
|
+
const RecentInsulin_1 = __importDefault(require("./components/RecentInsulin"));
|
|
32
|
+
const RecommendedCarbs_1 = __importDefault(require("./components/RecommendedCarbs"));
|
|
33
|
+
const RecommendedInsulin_1 = __importDefault(require("./components/RecommendedInsulin"));
|
|
34
|
+
const Remeasure_1 = __importDefault(require("./components/Remeasure"));
|
|
35
|
+
const Calculator = __importStar(require("@hedia/recommendation-calculator"));
|
|
36
|
+
const react_2 = require("@lingui/react");
|
|
37
|
+
const Emotion_1 = __importDefault(require("./components/Emotion"));
|
|
38
|
+
const TransferToLogbook_1 = __importDefault(require("./components/TransferToLogbook"));
|
|
39
|
+
const RecommendationError_1 = require("./utils/RecommendationError");
|
|
40
|
+
const i18nUtils_1 = require("./locale/i18nUtils");
|
|
41
|
+
const Utils_1 = require("./utils/Utils");
|
|
42
|
+
// Ignoring long timer warnings
|
|
43
|
+
// https://github.com/facebook/react-native/issues/12981#issuecomment-652745831
|
|
44
|
+
react_native_1.YellowBox.ignoreWarnings([`Setting a timer`]);
|
|
45
|
+
class RecommendationScreen extends react_1.default.Component {
|
|
46
|
+
constructor(props) {
|
|
47
|
+
super(props);
|
|
48
|
+
this.updateRemeasureTime = (remeasureTime) => {
|
|
49
|
+
this.setState({
|
|
50
|
+
remeasureTime,
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
this.handleNoRecentInsulin = () => {
|
|
54
|
+
this.setState({
|
|
55
|
+
showRecentInsulin: false,
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
this.removeCarbRecommendation = () => {
|
|
59
|
+
this.setState({
|
|
60
|
+
enteredCarbs: null,
|
|
61
|
+
carbRecommendation: null,
|
|
62
|
+
});
|
|
63
|
+
this.props.removeRecommendedCarbs();
|
|
64
|
+
};
|
|
65
|
+
this.handleMoodSelected = (selectedMood) => {
|
|
66
|
+
this.setState({
|
|
67
|
+
selectedMood,
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
this.updateCarbRecommendation = (enteredCarbs) => {
|
|
71
|
+
this.setState({
|
|
72
|
+
enteredCarbs,
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
this.updateInsulinRecommendation = (enteredInsulin) => {
|
|
76
|
+
this.setState({
|
|
77
|
+
enteredInsulin,
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
this.handleTransfer = () => {
|
|
81
|
+
// TODO: Handle Errors/Warnings
|
|
82
|
+
// 300 carbs.
|
|
83
|
+
// < 5 mmol && activity
|
|
84
|
+
// > 2, <= 3.5 mmol/L
|
|
85
|
+
this.props.transferToLogbook({
|
|
86
|
+
suggested: this.state.carbRecommendation,
|
|
87
|
+
entered: this.state.enteredCarbs,
|
|
88
|
+
}, {
|
|
89
|
+
suggested: this.state.insulinRecommendation,
|
|
90
|
+
entered: this.state.enteredInsulin,
|
|
91
|
+
}, this.state.remeasureTime);
|
|
92
|
+
};
|
|
93
|
+
i18nUtils_1.changeLanguage(props.language);
|
|
94
|
+
// Handle >= 1.1, <= 2 mmol/L (SevereHypoglycemia)
|
|
95
|
+
const { currentBGL, recentBoluses } = props?.calculatorParams;
|
|
96
|
+
if (currentBGL <= 2 && currentBGL >= 1.1) {
|
|
97
|
+
props.onError(RecommendationError_1.SevereHypoglycemiaError);
|
|
98
|
+
}
|
|
99
|
+
const { bolus, carbRecommendation, activityReduction } = Calculator.calculateRecommendation(props.calculatorParams);
|
|
100
|
+
this.state = {
|
|
101
|
+
remeasureTime: 1.5,
|
|
102
|
+
showRecentInsulin: recentBoluses?.length === 0,
|
|
103
|
+
insulinRecommendation: Utils_1.Utils.roundValue(bolus, props.injectionMethod),
|
|
104
|
+
activityReduction,
|
|
105
|
+
carbRecommendation,
|
|
106
|
+
activeInsulin: 0.0,
|
|
107
|
+
selectedMood: 0,
|
|
108
|
+
};
|
|
109
|
+
this.timer = setTimeout(() => {
|
|
110
|
+
props.onError(RecommendationError_1.TimeoutLimitError);
|
|
111
|
+
}, enum_1.Milliseconds.Minute * 15);
|
|
112
|
+
}
|
|
113
|
+
render() {
|
|
114
|
+
return (<react_2.I18nProvider language={this.props.language} i18n={i18nUtils_1.i18n}>
|
|
115
|
+
<react_native_1.ScrollView style={containerStyles.container}>
|
|
116
|
+
<Header_1.default exitCallback={this.props.exitCallback}/>
|
|
117
|
+
<InfoBars_1.default label={i18nUtils_1.i18n._("Active Insulin")} value={`${this.state.activeInsulin}`} units={i18nUtils_1.i18n._("units")} showZeroAsDash={false}/>
|
|
118
|
+
<InfoBars_1.default label={i18nUtils_1.i18n._("Blood Glucose Level")} value={`${this.props.calculatorParams.currentBGL}`} units={this.props.units} showZeroAsDash={true}/>
|
|
119
|
+
<react_native_1.View style={containerStyles.calcContainer}>
|
|
120
|
+
<react_native_1.View style={containerStyles.calcMargin}>
|
|
121
|
+
<react_native_1.View style={[
|
|
122
|
+
containerStyles.calcBorder,
|
|
123
|
+
{
|
|
124
|
+
borderColor: this.state.carbRecommendation
|
|
125
|
+
? Constants_1.BORDER_COLOUR_TEAL
|
|
126
|
+
: Constants_1.BORDER_COLOUR_WHITE,
|
|
127
|
+
},
|
|
128
|
+
]}>
|
|
129
|
+
<RecommendedCarbs_1.default enteredCarbs={`${this.props.calculatorParams.carbohydrates}`} changedRecommendedCarbs={this.updateCarbRecommendation} recommendedCarbs={`${this.state.enteredCarbs ?? this.state.carbRecommendation}`} removeRecommendedCarbs={this.removeCarbRecommendation} onError={this.props.onError}/>
|
|
130
|
+
<Remeasure_1.default onSliderChange={this.updateRemeasureTime} remeasureTime={this.state.remeasureTime}/>
|
|
131
|
+
</react_native_1.View>
|
|
132
|
+
</react_native_1.View>
|
|
133
|
+
</react_native_1.View>
|
|
134
|
+
{this.state.showRecentInsulin ? (<RecentInsulin_1.default onRecentInsulinYes={this.props.onRecentInsulinYes} onRecentInsulinNo={this.handleNoRecentInsulin}/>) : (<RecommendedInsulin_1.default injectionMethod={this.props.injectionMethod} insulinRecommendation={this.state.enteredInsulin ?? this.state.insulinRecommendation} activityReduction={this.state.activityReduction} updateRecommendedInsulin={this.updateInsulinRecommendation} onError={this.props.onError}/>)}
|
|
135
|
+
<Emotion_1.default moodSelected={this.handleMoodSelected}/>
|
|
136
|
+
<TransferToLogbook_1.default visible={!this.state.showRecentInsulin} transfer={this.handleTransfer}/>
|
|
137
|
+
</react_native_1.ScrollView>
|
|
138
|
+
</react_2.I18nProvider>);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
exports.default = RecommendationScreen;
|
|
142
|
+
const containerStyles = react_native_1.StyleSheet.create({
|
|
143
|
+
container: {
|
|
144
|
+
flex: 1,
|
|
145
|
+
backgroundColor: Constants_1.BACKGROUND_COLOUR_PURPLE,
|
|
146
|
+
},
|
|
147
|
+
calcContainer: {
|
|
148
|
+
flex: 1,
|
|
149
|
+
},
|
|
150
|
+
calcMargin: {
|
|
151
|
+
flex: 1,
|
|
152
|
+
margin: Header_1.headerStyles.margin.margin,
|
|
153
|
+
},
|
|
154
|
+
calcBorder: {
|
|
155
|
+
...InfoBars_1.infoStyles.border,
|
|
156
|
+
borderColor: Constants_1.BORDER_COLOUR_TEAL,
|
|
157
|
+
},
|
|
158
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { ScrollView, StyleSheet,
|
|
3
|
-
import { BGUnit, InjectionMethod, Languages, MoodEnum } from "./types/enum";
|
|
2
|
+
import { ScrollView, StyleSheet, View, YellowBox } from "react-native";
|
|
3
|
+
import { BGUnit, InjectionMethod, Languages, Milliseconds, MoodEnum } from "./types/enum";
|
|
4
4
|
import { BACKGROUND_COLOUR_PURPLE, BORDER_COLOUR_TEAL, BORDER_COLOUR_WHITE } from "./utils/Constants";
|
|
5
5
|
|
|
6
6
|
import Header, { headerStyles } from "./components/Header";
|
|
@@ -14,11 +14,15 @@ import * as Calculator from "@hedia/recommendation-calculator";
|
|
|
14
14
|
import { I18nProvider } from "@lingui/react";
|
|
15
15
|
import Emotion from "./components/Emotion";
|
|
16
16
|
import TransferToLogbook from "./components/TransferToLogbook";
|
|
17
|
-
import { RecommendationError } from "./utils/RecommendationError";
|
|
17
|
+
import { RecommendationError, SevereHypoglycemiaError, TimeoutLimitError } from "./utils/RecommendationError";
|
|
18
18
|
|
|
19
19
|
import { changeLanguage, i18n } from "./locale/i18nUtils";
|
|
20
20
|
import { Utils } from "./utils/Utils";
|
|
21
21
|
|
|
22
|
+
// Ignoring long timer warnings
|
|
23
|
+
// https://github.com/facebook/react-native/issues/12981#issuecomment-652745831
|
|
24
|
+
YellowBox.ignoreWarnings([`Setting a timer`]);
|
|
25
|
+
|
|
22
26
|
interface IResult {
|
|
23
27
|
suggested: number;
|
|
24
28
|
entered?: number;
|
|
@@ -54,23 +58,36 @@ interface IState {
|
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
export default class RecommendationScreen extends React.Component<IRecommendationProps, IState> {
|
|
61
|
+
private readonly timer: NodeJS.Timeout;
|
|
62
|
+
|
|
57
63
|
constructor(props: IRecommendationProps) {
|
|
58
64
|
super(props);
|
|
59
65
|
|
|
60
66
|
changeLanguage(props.language);
|
|
61
67
|
|
|
68
|
+
// Handle >= 1.1, <= 2 mmol/L (SevereHypoglycemia)
|
|
69
|
+
const { currentBGL, recentBoluses } = props?.calculatorParams;
|
|
70
|
+
if (currentBGL <= 2 && currentBGL >= 1.1) {
|
|
71
|
+
props.onError(SevereHypoglycemiaError);
|
|
72
|
+
}
|
|
73
|
+
|
|
62
74
|
const { bolus, carbRecommendation, activityReduction } = Calculator.calculateRecommendation(
|
|
63
75
|
props.calculatorParams,
|
|
64
76
|
);
|
|
77
|
+
|
|
65
78
|
this.state = {
|
|
66
79
|
remeasureTime: 1.5,
|
|
67
|
-
showRecentInsulin:
|
|
80
|
+
showRecentInsulin: recentBoluses?.length === 0,
|
|
68
81
|
insulinRecommendation: Utils.roundValue(bolus, props.injectionMethod),
|
|
69
82
|
activityReduction,
|
|
70
83
|
carbRecommendation,
|
|
71
84
|
activeInsulin: 0.0,
|
|
72
85
|
selectedMood: 0,
|
|
73
86
|
};
|
|
87
|
+
|
|
88
|
+
this.timer = setTimeout(() => {
|
|
89
|
+
props.onError(TimeoutLimitError);
|
|
90
|
+
}, Milliseconds.Minute * 15);
|
|
74
91
|
}
|
|
75
92
|
|
|
76
93
|
public updateRemeasureTime = (remeasureTime: number) => {
|
|
@@ -112,6 +129,11 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
|
|
|
112
129
|
};
|
|
113
130
|
|
|
114
131
|
public handleTransfer = () => {
|
|
132
|
+
// TODO: Handle Errors/Warnings
|
|
133
|
+
// 300 carbs.
|
|
134
|
+
// < 5 mmol && activity
|
|
135
|
+
// > 2, <= 3.5 mmol/L
|
|
136
|
+
|
|
115
137
|
this.props.transferToLogbook(
|
|
116
138
|
{
|
|
117
139
|
suggested: this.state.carbRecommendation,
|
package/src/assets/happy.png
CHANGED
|
File without changes
|
|
File without changes
|
package/src/assets/neutral.png
CHANGED
|
File without changes
|
|
File without changes
|
package/src/assets/sad.png
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/assets/semi_sad.png
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MoodEnum } from "../types/enum";
|
|
3
|
+
interface IProps {
|
|
4
|
+
moodSelected(mood: MoodEnum | 0): void;
|
|
5
|
+
}
|
|
6
|
+
interface IState {
|
|
7
|
+
selected: MoodEnum | 0;
|
|
8
|
+
}
|
|
9
|
+
export default class Emotion extends React.Component<IProps, IState> {
|
|
10
|
+
state: IState;
|
|
11
|
+
handleIconPress: (selected: number, toggle: boolean) => void;
|
|
12
|
+
render(): JSX.Element;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
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 enum_1 = require("../types/enum");
|
|
10
|
+
const MoodIcon_1 = __importDefault(require("./MoodIcon"));
|
|
11
|
+
class Emotion extends react_1.default.Component {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.state = {
|
|
15
|
+
selected: 0,
|
|
16
|
+
};
|
|
17
|
+
this.handleIconPress = (selected, toggle) => {
|
|
18
|
+
const select = toggle ? selected : 0;
|
|
19
|
+
this.setState({
|
|
20
|
+
selected: select,
|
|
21
|
+
});
|
|
22
|
+
this.props.moodSelected(select);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
render() {
|
|
26
|
+
const values = Object.values(enum_1.MoodEnum).filter((val) => isNaN(Number(val)));
|
|
27
|
+
const mapped = values.map((key) => {
|
|
28
|
+
const moodValue = enum_1.MoodEnum[key];
|
|
29
|
+
return (<MoodIcon_1.default onPress={(toggle) => this.handleIconPress(moodValue, toggle)} active={moodValue === this.state.selected} mood={moodValue} key={moodValue}/>);
|
|
30
|
+
});
|
|
31
|
+
return (<react_native_1.View style={emotionStyles.container}>
|
|
32
|
+
<react_native_1.View style={emotionStyles.feelingContainer}>
|
|
33
|
+
<react_native_1.Text style={emotionStyles.feelingText}>{i18nUtils_1.i18n._("How are you feeling?")}</react_native_1.Text>
|
|
34
|
+
</react_native_1.View>
|
|
35
|
+
<react_native_1.View style={emotionStyles.moodIconContainer}>{mapped}</react_native_1.View>
|
|
36
|
+
</react_native_1.View>);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.default = Emotion;
|
|
40
|
+
const emotionStyles = react_native_1.StyleSheet.create({
|
|
41
|
+
container: {
|
|
42
|
+
flex: 1,
|
|
43
|
+
},
|
|
44
|
+
feelingContainer: {
|
|
45
|
+
marginVertical: `3%`,
|
|
46
|
+
},
|
|
47
|
+
feelingText: {
|
|
48
|
+
textAlign: `center`,
|
|
49
|
+
color: `white`,
|
|
50
|
+
fontWeight: `bold`,
|
|
51
|
+
fontSize: react_native_1.Dimensions.get(`screen`).width / 26,
|
|
52
|
+
},
|
|
53
|
+
moodIconContainer: { flex: 1, flexDirection: `row`, justifyContent: `center` },
|
|
54
|
+
});
|
|
File without changes
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IRecommendationProps } from "../RecommendationScreen";
|
|
3
|
+
interface IProps {
|
|
4
|
+
exitCallback: IRecommendationProps["exitCallback"];
|
|
5
|
+
}
|
|
6
|
+
interface IState {
|
|
7
|
+
hello: string;
|
|
8
|
+
}
|
|
9
|
+
export default class Header extends React.Component<IProps, IState> {
|
|
10
|
+
state: IState;
|
|
11
|
+
render(): JSX.Element;
|
|
12
|
+
}
|
|
13
|
+
export declare const headerStyles: {
|
|
14
|
+
backgroundColour: {
|
|
15
|
+
backgroundColor: string;
|
|
16
|
+
};
|
|
17
|
+
margin: {
|
|
18
|
+
margin: string;
|
|
19
|
+
flexDirection: "row";
|
|
20
|
+
flex: number;
|
|
21
|
+
};
|
|
22
|
+
headerContainer: {
|
|
23
|
+
flexDirection: "row";
|
|
24
|
+
flex: number;
|
|
25
|
+
};
|
|
26
|
+
exitButtonContainer: {
|
|
27
|
+
flex: number;
|
|
28
|
+
};
|
|
29
|
+
exitButton: {
|
|
30
|
+
flex: number;
|
|
31
|
+
};
|
|
32
|
+
iconStyle: {
|
|
33
|
+
fontSize: number;
|
|
34
|
+
color: string;
|
|
35
|
+
};
|
|
36
|
+
headerTextContainer: {
|
|
37
|
+
flex: number;
|
|
38
|
+
justifyContent: "center";
|
|
39
|
+
alignItems: "center";
|
|
40
|
+
marginTop: string;
|
|
41
|
+
};
|
|
42
|
+
headerText: {
|
|
43
|
+
fontSize: number;
|
|
44
|
+
fontWeight: "bold";
|
|
45
|
+
textAlign: "center";
|
|
46
|
+
color: string;
|
|
47
|
+
};
|
|
48
|
+
headerFiller: {
|
|
49
|
+
flex: number;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
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
|
+
exports.headerStyles = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const react_native_1 = require("react-native");
|
|
9
|
+
const i18nUtils_1 = require("../locale/i18nUtils");
|
|
10
|
+
const Constants_1 = require("../utils/Constants");
|
|
11
|
+
const Icon_1 = __importDefault(require("./Icon"));
|
|
12
|
+
class Header extends react_1.default.Component {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.state = {
|
|
16
|
+
hello: `World`,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
render() {
|
|
20
|
+
return (<react_1.default.Fragment>
|
|
21
|
+
<react_native_1.SafeAreaView style={exports.headerStyles.backgroundColour}/>
|
|
22
|
+
<react_native_1.View style={exports.headerStyles.headerContainer}>
|
|
23
|
+
<react_native_1.View style={exports.headerStyles.margin}>
|
|
24
|
+
<react_native_1.View style={exports.headerStyles.exitButtonContainer}>
|
|
25
|
+
<react_native_1.View style={exports.headerStyles.exitButton}>
|
|
26
|
+
<react_native_1.TouchableOpacity accessibilityLabel="exitButton" style={exports.headerStyles.exitButton} onPress={this.props.exitCallback}>
|
|
27
|
+
<Icon_1.default iconIdentifier={`Ionicons/ios-close-circle-outline`} style={exports.headerStyles.iconStyle}/>
|
|
28
|
+
</react_native_1.TouchableOpacity>
|
|
29
|
+
<react_native_1.View style={exports.headerStyles.headerFiller}/>
|
|
30
|
+
</react_native_1.View>
|
|
31
|
+
</react_native_1.View>
|
|
32
|
+
<react_native_1.View style={exports.headerStyles.headerTextContainer}>
|
|
33
|
+
<react_native_1.Text style={exports.headerStyles.headerText} testID="headerText">
|
|
34
|
+
{i18nUtils_1.i18n._("INSULIN\nRECOMMENDATION")}
|
|
35
|
+
</react_native_1.Text>
|
|
36
|
+
</react_native_1.View>
|
|
37
|
+
<react_native_1.View style={exports.headerStyles.headerFiller}/>
|
|
38
|
+
</react_native_1.View>
|
|
39
|
+
</react_native_1.View>
|
|
40
|
+
</react_1.default.Fragment>);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.default = Header;
|
|
44
|
+
exports.headerStyles = react_native_1.StyleSheet.create({
|
|
45
|
+
backgroundColour: {
|
|
46
|
+
backgroundColor: Constants_1.BACKGROUND_COLOUR_PURPLE,
|
|
47
|
+
},
|
|
48
|
+
margin: {
|
|
49
|
+
margin: `3%`,
|
|
50
|
+
flexDirection: `row`,
|
|
51
|
+
flex: 1,
|
|
52
|
+
},
|
|
53
|
+
headerContainer: {
|
|
54
|
+
flexDirection: `row`,
|
|
55
|
+
flex: 1,
|
|
56
|
+
},
|
|
57
|
+
exitButtonContainer: {
|
|
58
|
+
flex: 1,
|
|
59
|
+
},
|
|
60
|
+
exitButton: {
|
|
61
|
+
flex: 1,
|
|
62
|
+
},
|
|
63
|
+
iconStyle: {
|
|
64
|
+
fontSize: react_native_1.Dimensions.get(`screen`).width / 10,
|
|
65
|
+
color: Constants_1.BORDER_COLOUR_WHITE,
|
|
66
|
+
},
|
|
67
|
+
headerTextContainer: {
|
|
68
|
+
flex: 5,
|
|
69
|
+
justifyContent: `center`,
|
|
70
|
+
alignItems: `center`,
|
|
71
|
+
marginTop: `5%`,
|
|
72
|
+
},
|
|
73
|
+
headerText: {
|
|
74
|
+
fontSize: react_native_1.Dimensions.get(`screen`).width / 14,
|
|
75
|
+
fontWeight: `bold`,
|
|
76
|
+
textAlign: `center`,
|
|
77
|
+
color: `white`,
|
|
78
|
+
},
|
|
79
|
+
headerFiller: {
|
|
80
|
+
flex: 1,
|
|
81
|
+
},
|
|
82
|
+
});
|
|
File without changes
|
package/src/components/Icon.js
CHANGED
|
File without changes
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface IProps {
|
|
3
|
+
label: string;
|
|
4
|
+
value?: string;
|
|
5
|
+
units: string;
|
|
6
|
+
showZeroAsDash: boolean;
|
|
7
|
+
}
|
|
8
|
+
export default class InfoBars extends React.Component<IProps> {
|
|
9
|
+
render(): JSX.Element;
|
|
10
|
+
}
|
|
11
|
+
export declare const infoStyles: {
|
|
12
|
+
container: {
|
|
13
|
+
flex: number;
|
|
14
|
+
};
|
|
15
|
+
margin: {
|
|
16
|
+
flex: number;
|
|
17
|
+
margin: string;
|
|
18
|
+
marginBottom: number;
|
|
19
|
+
};
|
|
20
|
+
border: {
|
|
21
|
+
borderWidth: number;
|
|
22
|
+
borderColor: string;
|
|
23
|
+
borderRadius: number;
|
|
24
|
+
};
|
|
25
|
+
borderContainer: {
|
|
26
|
+
flex: number;
|
|
27
|
+
flexDirection: "row";
|
|
28
|
+
justifyContent: "space-between";
|
|
29
|
+
paddingLeft: string;
|
|
30
|
+
paddingRight: string;
|
|
31
|
+
};
|
|
32
|
+
labelContainer: {
|
|
33
|
+
flex: number;
|
|
34
|
+
justifyContent: "center";
|
|
35
|
+
};
|
|
36
|
+
label: {
|
|
37
|
+
color: string;
|
|
38
|
+
fontSize: number;
|
|
39
|
+
fontWeight: "bold";
|
|
40
|
+
};
|
|
41
|
+
valueUnitContainer: {
|
|
42
|
+
flex: number;
|
|
43
|
+
justifyContent: "flex-end";
|
|
44
|
+
flexDirection: "row";
|
|
45
|
+
};
|
|
46
|
+
valueContainer: {
|
|
47
|
+
flex: number;
|
|
48
|
+
justifyContent: "flex-end";
|
|
49
|
+
};
|
|
50
|
+
value: {
|
|
51
|
+
color: string;
|
|
52
|
+
fontSize: number;
|
|
53
|
+
fontWeight: "bold";
|
|
54
|
+
textAlign: "right";
|
|
55
|
+
};
|
|
56
|
+
unitContainer: {
|
|
57
|
+
flex: number;
|
|
58
|
+
justifyContent: "flex-end";
|
|
59
|
+
paddingBottom: string;
|
|
60
|
+
};
|
|
61
|
+
units: {
|
|
62
|
+
color: string;
|
|
63
|
+
fontSize: number;
|
|
64
|
+
textAlign: "left";
|
|
65
|
+
paddingLeft: string;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
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
|
+
exports.infoStyles = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const react_native_1 = require("react-native");
|
|
9
|
+
const Constants_1 = require("../utils/Constants");
|
|
10
|
+
const Header_1 = require("./Header");
|
|
11
|
+
class InfoBars extends react_1.default.Component {
|
|
12
|
+
render() {
|
|
13
|
+
const displayedValue = this.props.value ?? (this.props.showZeroAsDash ? `-.-` : `0`);
|
|
14
|
+
return (<react_native_1.View style={exports.infoStyles.container}>
|
|
15
|
+
<react_native_1.View style={exports.infoStyles.margin}>
|
|
16
|
+
<react_native_1.View style={exports.infoStyles.border}>
|
|
17
|
+
<react_native_1.View style={exports.infoStyles.borderContainer}>
|
|
18
|
+
<react_native_1.View style={exports.infoStyles.labelContainer}>
|
|
19
|
+
<react_native_1.Text style={exports.infoStyles.label}>{this.props.label}</react_native_1.Text>
|
|
20
|
+
</react_native_1.View>
|
|
21
|
+
<react_native_1.View style={exports.infoStyles.valueUnitContainer}>
|
|
22
|
+
<react_native_1.View style={exports.infoStyles.valueContainer}>
|
|
23
|
+
<react_native_1.Text style={exports.infoStyles.value}>{displayedValue}</react_native_1.Text>
|
|
24
|
+
</react_native_1.View>
|
|
25
|
+
<react_native_1.View style={exports.infoStyles.unitContainer}>
|
|
26
|
+
<react_native_1.Text style={exports.infoStyles.units}>{this.props.units}</react_native_1.Text>
|
|
27
|
+
</react_native_1.View>
|
|
28
|
+
</react_native_1.View>
|
|
29
|
+
</react_native_1.View>
|
|
30
|
+
</react_native_1.View>
|
|
31
|
+
</react_native_1.View>
|
|
32
|
+
</react_native_1.View>);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.default = InfoBars;
|
|
36
|
+
exports.infoStyles = react_native_1.StyleSheet.create({
|
|
37
|
+
container: { flex: 1 },
|
|
38
|
+
margin: {
|
|
39
|
+
flex: 1,
|
|
40
|
+
margin: Header_1.headerStyles.margin.margin,
|
|
41
|
+
marginBottom: 0,
|
|
42
|
+
},
|
|
43
|
+
border: {
|
|
44
|
+
borderWidth: 2,
|
|
45
|
+
borderColor: Constants_1.BORDER_COLOUR_WHITE,
|
|
46
|
+
borderRadius: 5,
|
|
47
|
+
},
|
|
48
|
+
borderContainer: {
|
|
49
|
+
flex: 1,
|
|
50
|
+
flexDirection: `row`,
|
|
51
|
+
justifyContent: `space-between`,
|
|
52
|
+
paddingLeft: `3%`,
|
|
53
|
+
paddingRight: `3%`,
|
|
54
|
+
},
|
|
55
|
+
labelContainer: {
|
|
56
|
+
flex: 7,
|
|
57
|
+
justifyContent: `center`,
|
|
58
|
+
},
|
|
59
|
+
label: {
|
|
60
|
+
color: `white`,
|
|
61
|
+
fontSize: react_native_1.Dimensions.get(`screen`).width / 22,
|
|
62
|
+
fontWeight: `bold`,
|
|
63
|
+
},
|
|
64
|
+
valueUnitContainer: {
|
|
65
|
+
flex: 4,
|
|
66
|
+
justifyContent: `flex-end`,
|
|
67
|
+
flexDirection: `row`,
|
|
68
|
+
},
|
|
69
|
+
valueContainer: {
|
|
70
|
+
flex: 1,
|
|
71
|
+
justifyContent: `flex-end`,
|
|
72
|
+
},
|
|
73
|
+
value: {
|
|
74
|
+
color: `white`,
|
|
75
|
+
fontSize: react_native_1.Dimensions.get(`screen`).width / 16,
|
|
76
|
+
fontWeight: `bold`,
|
|
77
|
+
textAlign: `right`,
|
|
78
|
+
},
|
|
79
|
+
unitContainer: {
|
|
80
|
+
flex: 1,
|
|
81
|
+
justifyContent: `flex-end`,
|
|
82
|
+
paddingBottom: `3%`,
|
|
83
|
+
},
|
|
84
|
+
units: {
|
|
85
|
+
color: `white`,
|
|
86
|
+
fontSize: react_native_1.Dimensions.get(`screen`).width / 30,
|
|
87
|
+
textAlign: `left`,
|
|
88
|
+
paddingLeft: `5%`,
|
|
89
|
+
},
|
|
90
|
+
});
|