@hedia/recommendation-screen 1.0.2 → 1.0.3

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.
Files changed (38) hide show
  1. package/Changelog.md +4 -0
  2. package/index.d.ts +5 -0
  3. package/index.js +16 -0
  4. package/package.json +1 -1
  5. package/src/RecommendationScreen.d.ts +42 -0
  6. package/src/RecommendationScreen.js +141 -0
  7. package/src/components/Emotion.d.ts +14 -0
  8. package/src/components/Emotion.js +54 -0
  9. package/src/components/Header.d.ts +52 -0
  10. package/src/components/Header.js +82 -0
  11. package/src/components/InfoBars.d.ts +67 -0
  12. package/src/components/InfoBars.js +89 -0
  13. package/src/components/InvisibleNumberInput.d.ts +24 -0
  14. package/src/components/InvisibleNumberInput.js +64 -0
  15. package/src/components/MoodIcon.d.ts +14 -0
  16. package/src/components/MoodIcon.js +53 -0
  17. package/src/components/RecentInsulin.d.ts +9 -0
  18. package/src/components/RecentInsulin.js +90 -0
  19. package/src/components/RecommendedCarbs.d.ts +30 -0
  20. package/src/components/RecommendedCarbs.js +192 -0
  21. package/src/components/RecommendedInsulin.d.ts +22 -0
  22. package/src/components/RecommendedInsulin.js +109 -0
  23. package/src/components/Remeasure.d.ts +13 -0
  24. package/src/components/Remeasure.js +88 -0
  25. package/src/components/TransferToLogbook.d.ts +14 -0
  26. package/src/components/TransferToLogbook.js +80 -0
  27. package/src/locale/i18nUtils.d.ts +5 -0
  28. package/src/locale/i18nUtils.js +22 -0
  29. package/src/types/enum.d.ts +26 -0
  30. package/src/types/enum.js +34 -0
  31. package/src/types/types.d.ts +21 -0
  32. package/src/types/types.js +2 -0
  33. package/src/utils/Constants.d.ts +3 -0
  34. package/src/utils/Constants.js +6 -0
  35. package/src/utils/RecommendationError.d.ts +9 -0
  36. package/src/utils/RecommendationError.js +16 -0
  37. package/src/utils/Utils.d.ts +5 -0
  38. package/src/utils/Utils.js +24 -0
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import { ImageURISource } from "react-native";
3
+ import { MoodEnum } from "../types/enum";
4
+ interface IProps {
5
+ mood: MoodEnum;
6
+ active: boolean;
7
+ onPress(toggle: boolean): void;
8
+ }
9
+ export default class MoodIcon extends React.Component<IProps> {
10
+ getMoodIcon: () => ImageURISource;
11
+ handleOnPress: () => void;
12
+ render(): JSX.Element;
13
+ }
14
+ export {};
@@ -0,0 +1,53 @@
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 enum_1 = require("../types/enum");
9
+ const moods_inactive = {
10
+ 1: require(`../assets/sad.png`),
11
+ 2: require(`../assets/semi_sad.png`),
12
+ 3: require(`../assets/neutral.png`),
13
+ 4: require(`../assets/semi_happy.png`),
14
+ 5: require(`../assets/happy.png`),
15
+ };
16
+ const moods_active = {
17
+ 1: require(`../assets/sad_active.png`),
18
+ 2: require(`../assets/semi_sad_active.png`),
19
+ 3: require(`../assets/neutral_active.png`),
20
+ 4: require(`../assets/semi_happy_active.png`),
21
+ 5: require(`../assets/happy_active.png`),
22
+ };
23
+ class MoodIcon extends react_1.default.Component {
24
+ constructor() {
25
+ super(...arguments);
26
+ this.getMoodIcon = () => {
27
+ if (this.props.active) {
28
+ return moods_active[this.props.mood];
29
+ }
30
+ return moods_inactive[this.props.mood];
31
+ };
32
+ this.handleOnPress = () => {
33
+ this.props.onPress(!this.props.active);
34
+ };
35
+ }
36
+ render() {
37
+ const { mood, active } = this.props;
38
+ const label = `${enum_1.MoodEnum[mood]}_${active}`;
39
+ return (<react_native_1.TouchableOpacity style={moodIconStyles.container} onPress={this.handleOnPress} accessibilityLabel={label}>
40
+ <react_native_1.Image style={moodIconStyles.icon} source={this.getMoodIcon()}/>
41
+ </react_native_1.TouchableOpacity>);
42
+ }
43
+ }
44
+ exports.default = MoodIcon;
45
+ const moodIconStyles = react_native_1.StyleSheet.create({
46
+ container: {
47
+ marginHorizontal: `1%`,
48
+ },
49
+ icon: {
50
+ width: react_native_1.Dimensions.get(`screen`).width / 8,
51
+ height: react_native_1.Dimensions.get(`screen`).width / 8,
52
+ },
53
+ });
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ interface IProps {
3
+ onRecentInsulinYes(): void;
4
+ onRecentInsulinNo(): void;
5
+ }
6
+ export default class RecentInsulin extends React.Component<IProps> {
7
+ render: () => JSX.Element;
8
+ }
9
+ export {};
@@ -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
+ const react_1 = __importDefault(require("react"));
7
+ const react_native_1 = require("react-native");
8
+ const i18nUtils_1 = require("../locale/i18nUtils");
9
+ const InfoBars_1 = require("./InfoBars");
10
+ class RecentInsulin extends react_1.default.Component {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.render = () => {
14
+ return (<react_native_1.View style={recentInsulinStyles.container}>
15
+ <react_native_1.View style={recentInsulinStyles.titleContainer}>
16
+ <react_native_1.Text style={recentInsulinStyles.recommended}>{i18nUtils_1.i18n._("Recommended amount of insulin")}</react_native_1.Text>
17
+ </react_native_1.View>
18
+ <react_native_1.View style={recentInsulinStyles.takenInsulinContainer}>
19
+ <react_native_1.Text style={recentInsulinStyles.takenInsulin}>
20
+ {i18nUtils_1.i18n._("Have you taken insulin within the last 4 hours?")}
21
+ </react_native_1.Text>
22
+ </react_native_1.View>
23
+ <react_native_1.View style={recentInsulinStyles.buttonContainer}>
24
+ <react_native_1.View style={recentInsulinStyles.filler}/>
25
+ <react_native_1.TouchableOpacity onPress={this.props.onRecentInsulinYes} style={[recentInsulinStyles.yesNoContainer, { marginRight: `2%` }]}>
26
+ <react_native_1.Text style={recentInsulinStyles.yesNoText}>{i18nUtils_1.i18n._("Yes")}</react_native_1.Text>
27
+ </react_native_1.TouchableOpacity>
28
+ <react_native_1.TouchableOpacity onPress={this.props.onRecentInsulinNo} style={[recentInsulinStyles.yesNoContainer, { marginLeft: `2%` }]}>
29
+ <react_native_1.Text style={recentInsulinStyles.yesNoText}>{i18nUtils_1.i18n._("No")}</react_native_1.Text>
30
+ </react_native_1.TouchableOpacity>
31
+ <react_native_1.View style={recentInsulinStyles.filler}/>
32
+ </react_native_1.View>
33
+ </react_native_1.View>);
34
+ };
35
+ }
36
+ }
37
+ exports.default = RecentInsulin;
38
+ const recentInsulinStyles = react_native_1.StyleSheet.create({
39
+ container: {
40
+ ...InfoBars_1.infoStyles.margin,
41
+ backgroundColor: `rgba(118, 82, 255, 0.5)`,
42
+ borderRadius: 5,
43
+ },
44
+ titleContainer: {
45
+ flex: 1,
46
+ justifyContent: `center`,
47
+ alignItems: `center`,
48
+ marginTop: `4%`,
49
+ marginBottom: `4%`,
50
+ },
51
+ recommended: {
52
+ ...InfoBars_1.infoStyles.label,
53
+ },
54
+ takenInsulinContainer: {
55
+ flex: 1,
56
+ justifyContent: `center`,
57
+ alignItems: `center`,
58
+ marginTop: `2%`,
59
+ },
60
+ takenInsulin: {
61
+ ...InfoBars_1.infoStyles.label,
62
+ fontSize: react_native_1.Dimensions.get(`screen`).width / 27,
63
+ },
64
+ buttonContainer: {
65
+ flex: 1,
66
+ flexDirection: `row`,
67
+ justifyContent: `space-evenly`,
68
+ marginTop: `4%`,
69
+ marginBottom: `5%`,
70
+ },
71
+ yesNoContainer: {
72
+ flex: 1,
73
+ borderColor: `white`,
74
+ borderRadius: 100,
75
+ borderWidth: 2,
76
+ paddingHorizontal: `2%`,
77
+ paddingVertical: `1%`,
78
+ },
79
+ yesNoText: {
80
+ textAlign: `center`,
81
+ paddingTop: `1%`,
82
+ paddingBottom: `1%`,
83
+ color: `white`,
84
+ fontSize: react_native_1.Dimensions.get(`screen`).width / 25,
85
+ fontWeight: `bold`,
86
+ },
87
+ filler: {
88
+ flex: 1,
89
+ },
90
+ });
@@ -0,0 +1,30 @@
1
+ import React from "react";
2
+ import { RecommendationError } from "../utils/RecommendationError";
3
+ interface ICalculationRow {
4
+ label: string;
5
+ info: string;
6
+ value: string;
7
+ units: string;
8
+ }
9
+ interface IProps {
10
+ recommendedCarbs?: string;
11
+ enteredCarbs: string;
12
+ removeRecommendedCarbs(): void;
13
+ changedRecommendedCarbs(value: number): void;
14
+ onError(error: RecommendationError): void;
15
+ }
16
+ interface IState {
17
+ remeasureTime: number;
18
+ partialInput: string;
19
+ }
20
+ export default class RecommendedCarbs extends React.Component<IProps, IState> {
21
+ state: IState;
22
+ callbackInput: () => void;
23
+ showTextInput: () => void;
24
+ handlePartialInput: (partialInput: string) => void;
25
+ handleChangedCarbs: (carbs: number) => void;
26
+ renderRecommendedCarbs: () => JSX.Element;
27
+ renderRow: (row: ICalculationRow) => JSX.Element;
28
+ render(): JSX.Element;
29
+ }
30
+ export {};
@@ -0,0 +1,192 @@
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 Constants_1 = require("../utils/Constants");
10
+ const RecommendationError_1 = require("../utils/RecommendationError");
11
+ const Icon_1 = __importDefault(require("./Icon"));
12
+ const InfoBars_1 = require("./InfoBars");
13
+ const InvisibleNumberInput_1 = __importDefault(require("./InvisibleNumberInput"));
14
+ class RecommendedCarbs extends react_1.default.Component {
15
+ constructor() {
16
+ super(...arguments);
17
+ this.state = {
18
+ remeasureTime: 1.5,
19
+ partialInput: null,
20
+ };
21
+ this.showTextInput = () => {
22
+ this.callbackInput?.();
23
+ };
24
+ this.handlePartialInput = (partialInput) => {
25
+ this.setState({
26
+ partialInput,
27
+ });
28
+ };
29
+ this.handleChangedCarbs = (carbs) => {
30
+ if (carbs >= 0) {
31
+ if (carbs > 300) {
32
+ return this.props.onError(RecommendationError_1.CarbohydrateLimitError);
33
+ }
34
+ this.props.changedRecommendedCarbs(carbs);
35
+ }
36
+ };
37
+ this.renderRecommendedCarbs = () => {
38
+ return (<react_1.default.Fragment>
39
+ <react_native_1.View style={calculationStyles.borderContainer}>
40
+ <react_native_1.View style={calculationStyles.recommendedContainer}>
41
+ <react_native_1.TouchableOpacity accessibilityLabel="removeRecommendedCarbs" style={calculationStyles.removeRecommended} onPress={this.props.removeRecommendedCarbs}>
42
+ <Icon_1.default iconIdentifier={`Ionicons/ios-close-circle-outline`} style={calculationStyles.removeRecommendedIcon}/>
43
+ </react_native_1.TouchableOpacity>
44
+ <react_native_1.Text style={calculationStyles.recommendedLabel}>{i18nUtils_1.i18n._("Recommended")}</react_native_1.Text>
45
+ </react_native_1.View>
46
+ <react_native_1.View style={calculationStyles.additionalContainer}>
47
+ <react_native_1.Text style={calculationStyles.additional}>{i18nUtils_1.i18n._("Additional")}</react_native_1.Text>
48
+ </react_native_1.View>
49
+ <react_native_1.View style={{ flex: calculationStyles.valueUnitContainer[`flex`] }}>
50
+ <react_native_1.TouchableOpacity accessibilityLabel="editRecommendedCarbsButton" onPress={this.showTextInput} style={[calculationStyles.valueUnitContainer, calculationStyles.recommendedBorder]}>
51
+ <react_native_1.View style={calculationStyles.valueContainer}>
52
+ <react_native_1.Text style={[calculationStyles.value, { color: Constants_1.BORDER_COLOUR_TEAL }]}>
53
+ +{this.state.partialInput ?? this.props.recommendedCarbs}
54
+ </react_native_1.Text>
55
+ </react_native_1.View>
56
+ <react_native_1.View style={[calculationStyles.unitContainer]}>
57
+ <react_native_1.View style={calculationStyles.editIconContainer}>
58
+ <Icon_1.default style={calculationStyles.editIcon} iconIdentifier={`Feather/edit`}/>
59
+ </react_native_1.View>
60
+ <react_native_1.Text style={[calculationStyles.units, { color: Constants_1.BORDER_COLOUR_TEAL }]}>
61
+ {i18nUtils_1.i18n._("g carbs")}
62
+ </react_native_1.Text>
63
+ </react_native_1.View>
64
+ </react_native_1.TouchableOpacity>
65
+ </react_native_1.View>
66
+ </react_native_1.View>
67
+ {this.renderRow({
68
+ label: ``,
69
+ info: i18nUtils_1.i18n._("Total"),
70
+ value: `0`,
71
+ units: i18nUtils_1.i18n._("g carbs"),
72
+ })}
73
+ <InvisibleNumberInput_1.default negativeAllowed={false} cleanPartialInput={true} decimalPlaces={0} visible={(callback) => (this.callbackInput = callback)} partialInput={this.handlePartialInput} onEnd={(val) => {
74
+ this.handleChangedCarbs(val);
75
+ }} startValue={this.props.recommendedCarbs}/>
76
+ </react_1.default.Fragment>);
77
+ };
78
+ this.renderRow = (row) => {
79
+ return (<react_native_1.View style={calculationStyles.borderContainer}>
80
+ <react_native_1.View style={calculationStyles.foodContainer}>
81
+ <react_native_1.Text style={calculationStyles.foodLabel}>{row.label}</react_native_1.Text>
82
+ </react_native_1.View>
83
+ <react_native_1.View style={calculationStyles.enteredContainer}>
84
+ <react_native_1.Text style={calculationStyles.entered}>{row.info}</react_native_1.Text>
85
+ </react_native_1.View>
86
+ <react_native_1.View style={calculationStyles.valueUnitContainer}>
87
+ <react_native_1.View style={calculationStyles.valueContainer}>
88
+ <react_native_1.Text style={calculationStyles.value}>{row.value}</react_native_1.Text>
89
+ </react_native_1.View>
90
+ <react_native_1.View style={calculationStyles.unitContainer}>
91
+ <react_native_1.Text style={calculationStyles.units}>{row.units}</react_native_1.Text>
92
+ </react_native_1.View>
93
+ </react_native_1.View>
94
+ </react_native_1.View>);
95
+ };
96
+ }
97
+ render() {
98
+ const carbs = Number(this.props.recommendedCarbs);
99
+ return (<react_1.default.Fragment>
100
+ {this.renderRow({
101
+ label: i18nUtils_1.i18n._("Food"),
102
+ info: i18nUtils_1.i18n._("Entered"),
103
+ value: this.props.enteredCarbs,
104
+ units: i18nUtils_1.i18n._("g carbs"),
105
+ })}
106
+ {!isNaN(carbs) && carbs > 0 ? this.renderRecommendedCarbs() : null}
107
+ </react_1.default.Fragment>);
108
+ }
109
+ }
110
+ exports.default = RecommendedCarbs;
111
+ const calculationStyles = react_native_1.StyleSheet.create({
112
+ borderContainer: {
113
+ ...InfoBars_1.infoStyles.borderContainer,
114
+ alignItems: `center`,
115
+ },
116
+ foodContainer: {
117
+ flex: 4,
118
+ },
119
+ foodLabel: {
120
+ color: `white`,
121
+ fontSize: react_native_1.Dimensions.get(`screen`).width / 22,
122
+ fontWeight: `bold`,
123
+ },
124
+ enteredContainer: {
125
+ flex: 3,
126
+ alignItems: `flex-end`,
127
+ },
128
+ entered: {
129
+ color: `white`,
130
+ fontSize: react_native_1.Dimensions.get(`screen`).width / 23,
131
+ },
132
+ valueUnitContainer: {
133
+ ...InfoBars_1.infoStyles.valueUnitContainer,
134
+ },
135
+ valueContainer: {
136
+ ...InfoBars_1.infoStyles.valueContainer,
137
+ },
138
+ value: {
139
+ ...InfoBars_1.infoStyles.value,
140
+ },
141
+ unitContainer: {
142
+ ...InfoBars_1.infoStyles.unitContainer,
143
+ },
144
+ units: {
145
+ ...InfoBars_1.infoStyles.units,
146
+ },
147
+ editIconContainer: {
148
+ justifyContent: `flex-end`,
149
+ flexDirection: `row`,
150
+ paddingRight: `5%`,
151
+ },
152
+ editIcon: {
153
+ color: Constants_1.BORDER_COLOUR_TEAL,
154
+ fontSize: react_native_1.Dimensions.get(`screen`).width / 30,
155
+ },
156
+ recommendedContainer: {
157
+ flex: 4,
158
+ flexDirection: `row`,
159
+ },
160
+ recommendedLabel: {
161
+ color: Constants_1.BORDER_COLOUR_TEAL,
162
+ fontSize: react_native_1.Dimensions.get(`screen`).width / 27,
163
+ fontWeight: `bold`,
164
+ },
165
+ removeRecommended: {
166
+ justifyContent: `center`,
167
+ padding: `1%`,
168
+ marginRight: `2%`,
169
+ marginTop: `1%`,
170
+ },
171
+ removeRecommendedIcon: {
172
+ color: Constants_1.BORDER_COLOUR_TEAL,
173
+ fontSize: react_native_1.Dimensions.get(`screen`).width / 26,
174
+ },
175
+ additionalContainer: {
176
+ flex: 3,
177
+ alignItems: `flex-end`,
178
+ },
179
+ additional: {
180
+ color: Constants_1.BORDER_COLOUR_TEAL,
181
+ fontSize: react_native_1.Dimensions.get(`screen`).width / 27,
182
+ },
183
+ recommendedBorder: {
184
+ borderWidth: 2,
185
+ borderColor: Constants_1.BORDER_COLOUR_TEAL,
186
+ borderRadius: 5,
187
+ paddingBottom: `2%`,
188
+ marginLeft: `10%`,
189
+ paddingRight: `3%`,
190
+ marginRight: `7%`,
191
+ },
192
+ });
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ import { InjectionMethod } from "../types/enum";
3
+ import { RecommendationError } from "../utils/RecommendationError";
4
+ interface IProps {
5
+ insulinRecommendation?: number;
6
+ activityReduction?: number;
7
+ injectionMethod: InjectionMethod;
8
+ updateRecommendedInsulin(value: number): void;
9
+ onError(error: RecommendationError): void;
10
+ }
11
+ interface IState {
12
+ insulin: string;
13
+ }
14
+ export default class RecommendedInsulin extends React.Component<IProps, IState> {
15
+ callbackInput: () => void;
16
+ constructor(props: IProps);
17
+ handleOnPress: () => void;
18
+ updatePartially: (insulin: string) => string;
19
+ handleUpdatedInsulin: (value: number) => void;
20
+ render: () => JSX.Element;
21
+ }
22
+ export {};
@@ -0,0 +1,109 @@
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 react_native_linear_gradient_1 = __importDefault(require("react-native-linear-gradient"));
9
+ const i18nUtils_1 = require("../locale/i18nUtils");
10
+ const RecommendationError_1 = require("../utils/RecommendationError");
11
+ const Utils_1 = require("../utils/Utils");
12
+ const Icon_1 = __importDefault(require("./Icon"));
13
+ const InfoBars_1 = require("./InfoBars");
14
+ const InvisibleNumberInput_1 = __importDefault(require("./InvisibleNumberInput"));
15
+ class RecommendedInsulin extends react_1.default.Component {
16
+ constructor(props) {
17
+ super(props);
18
+ this.handleOnPress = () => {
19
+ this.callbackInput?.();
20
+ };
21
+ this.updatePartially = (insulin) => {
22
+ const replacedZero = insulin.length > 1 && insulin.startsWith(`0`) && !insulin.startsWith(`0.`) ? insulin.substring(1) : insulin;
23
+ this.setState({
24
+ insulin: replacedZero,
25
+ });
26
+ return replacedZero;
27
+ };
28
+ this.handleUpdatedInsulin = (value) => {
29
+ const rounded = Utils_1.Utils.roundValue(value, this.props.injectionMethod);
30
+ // https://hedia.atlassian.net/browse/HDA-795
31
+ const limited = (1 - this.props.activityReduction) * 50;
32
+ if (rounded > limited) {
33
+ this.updatePartially(`${limited}`);
34
+ return this.props.onError(RecommendationError_1.InsulinLimitError);
35
+ }
36
+ this.updatePartially(`${rounded}`);
37
+ this.props.updateRecommendedInsulin(rounded);
38
+ };
39
+ this.render = () => {
40
+ return (<react_1.default.Fragment>
41
+ <react_native_1.TouchableOpacity accessibilityLabel="editRecommendedInsulin" onPress={this.handleOnPress}>
42
+ <react_native_linear_gradient_1.default style={recommendedInsulinStyles.container} colors={[`#a200ff`, `#578aff`]} start={{ x: 0, y: 0 }} end={{ x: 1, y: 0 }}>
43
+ <react_native_1.View style={recommendedInsulinStyles.recommendedTextContainer}>
44
+ <react_native_1.Text style={recommendedInsulinStyles.recommendedText}>
45
+ {i18nUtils_1.i18n._("Recommended amount of insulin")}
46
+ </react_native_1.Text>
47
+ </react_native_1.View>
48
+ <react_native_1.View style={recommendedInsulinStyles.recommendedContainer}>
49
+ <react_native_1.View style={recommendedInsulinStyles.valueContainer}>
50
+ <react_native_1.Text style={recommendedInsulinStyles.value}>{this.state.insulin}</react_native_1.Text>
51
+ <react_native_1.Text style={recommendedInsulinStyles.units}>{i18nUtils_1.i18n._("Units")}</react_native_1.Text>
52
+ </react_native_1.View>
53
+ <Icon_1.default style={recommendedInsulinStyles.editIcon} iconIdentifier={`Feather/edit`}/>
54
+ </react_native_1.View>
55
+ </react_native_linear_gradient_1.default>
56
+ </react_native_1.TouchableOpacity>
57
+ <InvisibleNumberInput_1.default decimalPlaces={3} negativeAllowed={false} cleanPartialInput={false} partialInput={this.updatePartially} onEnd={this.handleUpdatedInsulin} visible={(visible) => (this.callbackInput = visible)} startValue={`${this.state.insulin}`}/>
58
+ </react_1.default.Fragment>);
59
+ };
60
+ this.state = {
61
+ insulin: `${props.insulinRecommendation ?? 0}`,
62
+ };
63
+ }
64
+ }
65
+ exports.default = RecommendedInsulin;
66
+ const recommendedInsulinStyles = react_native_1.StyleSheet.create({
67
+ container: {
68
+ marginHorizontal: InfoBars_1.infoStyles.margin.margin,
69
+ borderRadius: 5,
70
+ },
71
+ recommendedTextContainer: {
72
+ flex: 1,
73
+ alignItems: `center`,
74
+ marginTop: `3%`,
75
+ },
76
+ recommendedText: {
77
+ color: `white`,
78
+ fontWeight: `bold`,
79
+ fontSize: react_native_1.Dimensions.get(`screen`).width / 24,
80
+ },
81
+ recommendedContainer: {
82
+ flex: 1,
83
+ flexDirection: `row`,
84
+ marginLeft: `10%`,
85
+ },
86
+ valueContainer: {
87
+ flex: 1,
88
+ flexDirection: `row`,
89
+ justifyContent: `center`,
90
+ },
91
+ value: {
92
+ color: `white`,
93
+ fontWeight: `bold`,
94
+ fontSize: react_native_1.Dimensions.get(`screen`).width / 5,
95
+ },
96
+ units: {
97
+ color: `white`,
98
+ fontSize: react_native_1.Dimensions.get(`screen`).width / 28,
99
+ textAlignVertical: `bottom`,
100
+ paddingBottom: `6%`,
101
+ },
102
+ editIcon: {
103
+ color: `white`,
104
+ fontSize: react_native_1.Dimensions.get(`screen`).width / 28,
105
+ textAlignVertical: `center`,
106
+ paddingBottom: `10%`,
107
+ marginRight: `5%`,
108
+ },
109
+ });
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ interface IProps {
3
+ remeasureTime: number;
4
+ onSliderChange(value: number): void;
5
+ }
6
+ export default class Remeasure extends React.Component<IProps, null> {
7
+ private slider;
8
+ componentDidMount(): void;
9
+ handleSliderChange: (remeasureTime: number) => void;
10
+ limitTime: (remeasureTime: number) => number;
11
+ render(): JSX.Element;
12
+ }
13
+ export {};
@@ -0,0 +1,88 @@
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 slider_1 = __importDefault(require("@react-native-community/slider"));
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 InfoBars_1 = require("./InfoBars");
12
+ class Remeasure extends react_1.default.Component {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.handleSliderChange = (remeasureTime) => {
16
+ const limited = this.limitTime(remeasureTime);
17
+ this.setState({
18
+ remeasureTime: limited,
19
+ });
20
+ this.props.onSliderChange(limited);
21
+ };
22
+ this.limitTime = (remeasureTime) => {
23
+ return Math.min(Math.max(0, remeasureTime), 4);
24
+ };
25
+ }
26
+ componentDidMount() {
27
+ this.slider.setNativeProps({
28
+ value: this.props.remeasureTime,
29
+ });
30
+ }
31
+ render() {
32
+ const measure = this.props.remeasureTime > 0;
33
+ const limited = this.limitTime(this.props.remeasureTime);
34
+ return (<react_native_1.View style={remeasureStyles.container}>
35
+ <react_native_1.View style={remeasureStyles.borderContainer}>
36
+ <react_native_1.View style={remeasureStyles.remeasureContainer}>
37
+ <react_native_1.Text style={remeasureStyles.remeasureLabel}>{i18nUtils_1.i18n._("Remind me to remeasure in")}</react_native_1.Text>
38
+ </react_native_1.View>
39
+ <react_native_1.View style={remeasureStyles.valueUnitContainer}>
40
+ <react_native_1.View style={remeasureStyles.valueContainer}>
41
+ <react_native_1.Text style={remeasureStyles.value}>{measure ? limited : i18nUtils_1.i18n._("OFF")}</react_native_1.Text>
42
+ </react_native_1.View>
43
+ <react_native_1.View style={remeasureStyles.unitContainer}>
44
+ <react_native_1.Text style={remeasureStyles.units}>{measure ? i18nUtils_1.i18n._("hours") : ``}</react_native_1.Text>
45
+ </react_native_1.View>
46
+ </react_native_1.View>
47
+ </react_native_1.View>
48
+ <slider_1.default ref={(slider) => (this.slider = slider)} accessibilityLabel="remeasureSlider" maximumTrackTintColor={Constants_1.BORDER_COLOUR_TEAL} minimumTrackTintColor={Constants_1.BORDER_COLOUR_TEAL} thumbTintColor={Constants_1.BORDER_COLOUR_TEAL} maximumValue={4} minimumValue={0} step={0.5} style={remeasureStyles.sliderStyle} onValueChange={this.handleSliderChange}></slider_1.default>
49
+ </react_native_1.View>);
50
+ }
51
+ }
52
+ exports.default = Remeasure;
53
+ const remeasureStyles = react_native_1.StyleSheet.create({
54
+ container: {
55
+ flexDirection: `column`,
56
+ },
57
+ borderContainer: {
58
+ ...InfoBars_1.infoStyles.borderContainer,
59
+ alignItems: `center`,
60
+ },
61
+ remeasureContainer: {
62
+ flex: 7,
63
+ },
64
+ remeasureLabel: {
65
+ color: `white`,
66
+ fontSize: react_native_1.Dimensions.get(`screen`).width / 25,
67
+ fontWeight: `bold`,
68
+ },
69
+ valueUnitContainer: {
70
+ ...InfoBars_1.infoStyles.valueUnitContainer,
71
+ },
72
+ valueContainer: {
73
+ ...InfoBars_1.infoStyles.valueContainer,
74
+ },
75
+ value: {
76
+ ...InfoBars_1.infoStyles.value,
77
+ },
78
+ unitContainer: {
79
+ ...InfoBars_1.infoStyles.unitContainer,
80
+ },
81
+ units: {
82
+ ...InfoBars_1.infoStyles.units,
83
+ },
84
+ sliderStyle: {
85
+ marginTop: `3%`,
86
+ marginBottom: `2%`,
87
+ },
88
+ });
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ interface IProps {
3
+ visible: boolean;
4
+ transfer(): void;
5
+ }
6
+ interface IState {
7
+ pressed: boolean;
8
+ }
9
+ export default class TransferToLogbook extends React.Component<IProps, IState> {
10
+ state: IState;
11
+ handlePress: () => void;
12
+ render(): JSX.Element;
13
+ }
14
+ export {};