@hedia/recommendation-screen 2.1.3-beta.6 → 2.1.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.
- package/coverage/clover.xml +29 -29
- package/coverage/coverage-final.json +27 -27
- package/coverage/lcov-report/index.html +1 -1
- package/coverage/lcov-report/src/RecommendationScreen.tsx.html +1 -1
- package/coverage/lcov-report/src/__tests__/index.html +1 -1
- package/coverage/lcov-report/src/__tests__/utils.tsx.html +1 -1
- package/coverage/lcov-report/src/components/Header.tsx.html +1 -1
- package/coverage/lcov-report/src/components/InfoBars.tsx.html +1 -1
- package/coverage/lcov-report/src/components/InvisibleNumberInput.tsx.html +1 -1
- package/coverage/lcov-report/src/components/LimitationMessage.tsx.html +1 -1
- package/coverage/lcov-report/src/components/LineSeparator.tsx.html +1 -1
- package/coverage/lcov-report/src/components/RecentInsulin.tsx.html +1 -1
- package/coverage/lcov-report/src/components/RecommendationModal.tsx.html +1 -1
- package/coverage/lcov-report/src/components/RecommendedCarbs.tsx.html +1 -1
- package/coverage/lcov-report/src/components/RecommendedInsulin.tsx.html +1 -1
- package/coverage/lcov-report/src/components/Remeasure.tsx.html +1 -1
- package/coverage/lcov-report/src/components/TransferToLogbook.tsx.html +1 -1
- package/coverage/lcov-report/src/components/TwoOptionModal.tsx.html +1 -1
- package/coverage/lcov-report/src/components/activity/Activity.tsx.html +1 -1
- package/coverage/lcov-report/src/components/activity/ActivityIcon.tsx.html +1 -1
- package/coverage/lcov-report/src/components/activity/ActivityIntensity.tsx.html +1 -1
- package/coverage/lcov-report/src/components/activity/index.html +1 -1
- package/coverage/lcov-report/src/components/index.html +1 -1
- package/coverage/lcov-report/src/components/mood/Emotion.tsx.html +1 -1
- package/coverage/lcov-report/src/components/mood/MoodIcon.tsx.html +1 -1
- package/coverage/lcov-report/src/components/mood/index.html +1 -1
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/locale/i18nUtils.ts.html +1 -1
- package/coverage/lcov-report/src/locale/index.html +1 -1
- package/coverage/lcov-report/src/utils/AttentionMessages.tsx.html +1 -1
- package/coverage/lcov-report/src/utils/Constants.ts.html +1 -1
- package/coverage/lcov-report/src/utils/RecommendationError.tsx.html +1 -1
- package/coverage/lcov-report/src/utils/RecommendationUtils.ts.html +1 -1
- package/coverage/lcov-report/src/utils/Translations.ts.html +1 -1
- package/coverage/lcov-report/src/utils/Utils.ts.html +1 -1
- package/coverage/lcov-report/src/utils/Validations.ts.html +1 -1
- package/coverage/lcov-report/src/utils/index.html +1 -1
- package/index.js +5 -31
- package/package.json +1 -1
- package/src/RecommendationScreen.js +76 -101
- package/src/__tests__/RecommendationScreen.test.js +404 -409
- package/src/__tests__/RecommendationUtils.test.js +117 -119
- package/src/__tests__/Translate.test.js +14 -16
- package/src/__tests__/Utils.test.js +16 -18
- package/src/__tests__/Validations.test.js +30 -51
- package/src/__tests__/components/Activity.test.js +51 -56
- package/src/__tests__/components/Emotion.test.js +28 -33
- package/src/__tests__/components/Header.test.js +24 -29
- package/src/__tests__/components/InfoBars.test.js +59 -64
- package/src/__tests__/components/InvisibleNumberInput.test.js +22 -27
- package/src/__tests__/components/LimitationMessage.test.js +28 -33
- package/src/__tests__/components/MoodIcon.test.js +9 -14
- package/src/__tests__/components/RecommendationModal.test.js +56 -61
- package/src/__tests__/components/RecommendedCarbs.test.js +58 -63
- package/src/__tests__/components/RecommendedInsulin.test.js +60 -65
- package/src/__tests__/components/Remeasure.test.js +32 -37
- package/src/__tests__/components/TransferToLogbook.test.js +15 -20
- package/src/__tests__/components/TwoOptionModal.test.js +22 -27
- package/src/__tests__/utils.js +22 -38
- package/src/components/Header.js +34 -41
- package/src/components/Icon.js +2 -8
- package/src/components/InfoBars.js +36 -43
- package/src/components/InvisibleNumberInput.js +5 -11
- package/src/components/LimitationMessage.js +18 -40
- package/src/components/LineSeparator.js +7 -13
- package/src/components/RecentInsulin.js +33 -39
- package/src/components/RecommendationModal.js +59 -85
- package/src/components/RecommendedCarbs.js +93 -99
- package/src/components/RecommendedInsulin.js +46 -52
- package/src/components/Remeasure.js +36 -42
- package/src/components/TransferToLogbook.js +20 -26
- package/src/components/TwoOptionModal.js +39 -65
- package/src/components/activity/Activity.js +42 -48
- package/src/components/activity/ActivityIcon.js +15 -21
- package/src/components/activity/ActivityIntensity.js +19 -25
- package/src/components/mood/Emotion.js +17 -23
- package/src/components/mood/MoodIcon.js +11 -17
- package/src/locale/i18nUtils.js +17 -24
- package/src/types/enum.js +28 -31
- package/src/types/types.js +1 -2
- package/src/utils/AttentionMessages.js +24 -32
- package/src/utils/Constants.js +23 -26
- package/src/utils/RecommendationError.js +28 -54
- package/src/utils/RecommendationUtils.js +60 -72
- package/src/utils/Translations.js +6 -9
- package/src/utils/Utils.js +8 -12
- package/src/utils/Validations.js +77 -107
- package/tsconfig.json +3 -3
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
const Icon_1 = __importDefault(require("./Icon"));
|
|
16
|
-
const InfoBars_1 = require("./InfoBars");
|
|
17
|
-
const InvisibleNumberInput_1 = __importDefault(require("./InvisibleNumberInput"));
|
|
18
|
-
const SAFETY_INSULIN_LIMIT = types_1.BolusCalculator.Constants.SAFETY_INSULIN_LIMIT;
|
|
19
|
-
class RecommendedInsulin extends react_1.default.Component {
|
|
1
|
+
import { BolusCalculator } from "@hedia/types";
|
|
2
|
+
import { t } from "@lingui/macro";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Alert, Dimensions, Platform, StyleSheet, Text, TouchableOpacity, View } from "react-native";
|
|
5
|
+
import LinearGradient from "react-native-linear-gradient";
|
|
6
|
+
import { i18n } from "../locale/i18nUtils";
|
|
7
|
+
import { RecommendedInsulinTestIds } from "../types/enum";
|
|
8
|
+
import { Messages } from "../utils/AttentionMessages";
|
|
9
|
+
import { Utils } from "../utils/Utils";
|
|
10
|
+
import Icon from "./Icon";
|
|
11
|
+
import { infoStyles } from "./InfoBars";
|
|
12
|
+
import InvisibleNumberInput from "./InvisibleNumberInput";
|
|
13
|
+
const SAFETY_INSULIN_LIMIT = BolusCalculator.Constants.SAFETY_INSULIN_LIMIT;
|
|
14
|
+
export default class RecommendedInsulin extends React.Component {
|
|
20
15
|
constructor(props) {
|
|
21
16
|
super(props);
|
|
22
17
|
this.handleOnPress = () => {
|
|
@@ -30,15 +25,15 @@ class RecommendedInsulin extends react_1.default.Component {
|
|
|
30
25
|
return replacedZero;
|
|
31
26
|
};
|
|
32
27
|
this.handleUpdatedInsulin = (value) => {
|
|
33
|
-
const rounded =
|
|
28
|
+
const rounded = Utils.roundValue(value, this.props.injectionMethod);
|
|
34
29
|
// https://hedia.atlassian.net/browse/HDA-795
|
|
35
30
|
const limited = (1 - (this.props.activityReduction ?? 0)) * SAFETY_INSULIN_LIMIT;
|
|
36
31
|
if (rounded > limited) {
|
|
37
32
|
this.setState({ partialInput: this.props.insulinRecommendation?.toString() ?? null });
|
|
38
33
|
this.props.updateRecommendedInsulin(this.props.insulinRecommendation);
|
|
39
|
-
return
|
|
34
|
+
return Alert.alert(i18n._(t `Attention`), Messages.InsulinInputWasLimited(this.props.activityReduction), [
|
|
40
35
|
{
|
|
41
|
-
text:
|
|
36
|
+
text: i18n._(t `OK`),
|
|
42
37
|
},
|
|
43
38
|
]);
|
|
44
39
|
}
|
|
@@ -46,29 +41,29 @@ class RecommendedInsulin extends react_1.default.Component {
|
|
|
46
41
|
this.props.updateRecommendedInsulin(rounded);
|
|
47
42
|
};
|
|
48
43
|
this.render = () => {
|
|
49
|
-
const paddingBottom =
|
|
44
|
+
const paddingBottom = Platform.OS === `ios` ? `3%` : `1%`;
|
|
50
45
|
const shownInsulin = this.state.partialInput ?? this.props.insulinRecommendation ?? `0`;
|
|
51
|
-
return (<
|
|
52
|
-
<
|
|
53
|
-
<
|
|
54
|
-
<
|
|
55
|
-
<
|
|
56
|
-
{
|
|
57
|
-
</
|
|
58
|
-
</
|
|
59
|
-
<
|
|
60
|
-
<
|
|
61
|
-
<
|
|
46
|
+
return (<React.Fragment>
|
|
47
|
+
<TouchableOpacity accessibilityLabel="editRecommendedInsulin" testID={RecommendedInsulinTestIds.EditRecommendedInsulin} onPress={this.handleOnPress}>
|
|
48
|
+
<LinearGradient style={recommendedInsulinStyles.container} colors={[`#a200ff`, `#578aff`]} start={{ x: 0, y: 0 }} end={{ x: 1, y: 0 }}>
|
|
49
|
+
<View style={recommendedInsulinStyles.recommendedTextContainer}>
|
|
50
|
+
<Text style={recommendedInsulinStyles.recommendedText}>
|
|
51
|
+
{i18n._(t `Recommended amount of insulin`)}
|
|
52
|
+
</Text>
|
|
53
|
+
</View>
|
|
54
|
+
<View style={[recommendedInsulinStyles.recommendedContainer, { paddingBottom }]}>
|
|
55
|
+
<View style={recommendedInsulinStyles.valueContainer}>
|
|
56
|
+
<Text style={recommendedInsulinStyles.value} testID={RecommendedInsulinTestIds.ShownInsulinText}>
|
|
62
57
|
{shownInsulin}
|
|
63
|
-
</
|
|
64
|
-
<
|
|
65
|
-
</
|
|
66
|
-
<
|
|
67
|
-
</
|
|
68
|
-
</
|
|
69
|
-
</
|
|
70
|
-
<
|
|
71
|
-
</
|
|
58
|
+
</Text>
|
|
59
|
+
<Text style={recommendedInsulinStyles.units}>{i18n._(t `Units`)}</Text>
|
|
60
|
+
</View>
|
|
61
|
+
<Icon style={recommendedInsulinStyles.editIcon} iconIdentifier={`Feather/edit`}/>
|
|
62
|
+
</View>
|
|
63
|
+
</LinearGradient>
|
|
64
|
+
</TouchableOpacity>
|
|
65
|
+
<InvisibleNumberInput testID={RecommendedInsulinTestIds.InvisibleInsulinInput} decimalPlaces={3} negativeAllowed={false} cleanPartialInput={false} partialInput={this.updatePartially} onEnd={this.handleUpdatedInsulin} visible={(visible) => (this.callbackInput = visible)} startValue={`${shownInsulin}`}/>
|
|
66
|
+
</React.Fragment>);
|
|
72
67
|
};
|
|
73
68
|
this.state = {
|
|
74
69
|
partialInput: undefined,
|
|
@@ -81,11 +76,10 @@ class RecommendedInsulin extends react_1.default.Component {
|
|
|
81
76
|
}
|
|
82
77
|
}
|
|
83
78
|
}
|
|
84
|
-
|
|
85
|
-
const recommendedInsulinStyles = react_native_1.StyleSheet.create({
|
|
79
|
+
const recommendedInsulinStyles = StyleSheet.create({
|
|
86
80
|
container: {
|
|
87
|
-
marginHorizontal:
|
|
88
|
-
marginTop:
|
|
81
|
+
marginHorizontal: infoStyles.margin.margin,
|
|
82
|
+
marginTop: infoStyles.margin.margin,
|
|
89
83
|
borderRadius: 5,
|
|
90
84
|
},
|
|
91
85
|
recommendedTextContainer: {
|
|
@@ -95,7 +89,7 @@ const recommendedInsulinStyles = react_native_1.StyleSheet.create({
|
|
|
95
89
|
},
|
|
96
90
|
recommendedText: {
|
|
97
91
|
paddingTop: `1%`,
|
|
98
|
-
...
|
|
92
|
+
...infoStyles.label,
|
|
99
93
|
},
|
|
100
94
|
recommendedContainer: {
|
|
101
95
|
flex: 1,
|
|
@@ -106,22 +100,22 @@ const recommendedInsulinStyles = react_native_1.StyleSheet.create({
|
|
|
106
100
|
flex: 1,
|
|
107
101
|
flexDirection: `row`,
|
|
108
102
|
justifyContent: `center`,
|
|
109
|
-
minHeight:
|
|
103
|
+
minHeight: Dimensions.get(`screen`).width / 4,
|
|
110
104
|
},
|
|
111
105
|
value: {
|
|
112
106
|
color: `white`,
|
|
113
107
|
fontWeight: `bold`,
|
|
114
|
-
fontSize:
|
|
108
|
+
fontSize: Dimensions.get(`screen`).width / 5,
|
|
115
109
|
},
|
|
116
110
|
units: {
|
|
117
111
|
alignSelf: `flex-end`,
|
|
118
112
|
color: `white`,
|
|
119
|
-
fontSize:
|
|
113
|
+
fontSize: Dimensions.get(`screen`).width / 28,
|
|
120
114
|
paddingBottom: `6%`,
|
|
121
115
|
},
|
|
122
116
|
editIcon: {
|
|
123
117
|
color: `white`,
|
|
124
|
-
fontSize:
|
|
118
|
+
fontSize: Dimensions.get(`screen`).width / 28,
|
|
125
119
|
textAlignVertical: `center`,
|
|
126
120
|
paddingBottom: `10%`,
|
|
127
121
|
marginRight: `5%`,
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const i18nUtils_1 = require("../locale/i18nUtils");
|
|
11
|
-
const enum_1 = require("../types/enum");
|
|
12
|
-
const Constants_1 = require("../utils/Constants");
|
|
13
|
-
const InfoBars_1 = require("./InfoBars");
|
|
14
|
-
class Remeasure extends react_1.default.Component {
|
|
1
|
+
import { t } from "@lingui/macro";
|
|
2
|
+
import Slider from "@react-native-community/slider";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Dimensions, Platform, StyleSheet, Text, View } from "react-native";
|
|
5
|
+
import { i18n } from "../locale/i18nUtils";
|
|
6
|
+
import { RemeasureTestIds } from "../types/enum";
|
|
7
|
+
import { BORDER_COLOUR_GREY, BORDER_COLOUR_TEAL } from "../utils/Constants";
|
|
8
|
+
import { infoStyles } from "./InfoBars";
|
|
9
|
+
export default class Remeasure extends React.Component {
|
|
15
10
|
constructor() {
|
|
16
11
|
super(...arguments);
|
|
17
12
|
this.handleSliderChange = (remeasureTime) => {
|
|
@@ -30,38 +25,37 @@ class Remeasure extends react_1.default.Component {
|
|
|
30
25
|
render() {
|
|
31
26
|
const measure = this.props.remeasureTime > 0;
|
|
32
27
|
const limited = this.limitTime(this.props.remeasureTime);
|
|
33
|
-
const marginHorizontal =
|
|
28
|
+
const marginHorizontal = Platform.OS === `ios` ? `3%` : `0%`;
|
|
34
29
|
const valueContainer = measure ? remeasureStyles.valueContainer : variantStyles.centeredValueContainer;
|
|
35
|
-
return (<
|
|
36
|
-
<
|
|
37
|
-
<
|
|
38
|
-
<
|
|
39
|
-
</
|
|
40
|
-
<
|
|
41
|
-
<
|
|
42
|
-
<
|
|
43
|
-
</
|
|
44
|
-
{measure ? (<
|
|
45
|
-
<
|
|
46
|
-
</
|
|
47
|
-
</
|
|
48
|
-
</
|
|
49
|
-
<
|
|
30
|
+
return (<View style={remeasureStyles.container}>
|
|
31
|
+
<View style={remeasureStyles.borderContainer}>
|
|
32
|
+
<View style={remeasureStyles.remeasureContainer}>
|
|
33
|
+
<Text style={remeasureStyles.remeasureLabel}>{i18n._(t `Remind me to remeasure in`)}</Text>
|
|
34
|
+
</View>
|
|
35
|
+
<View style={remeasureStyles.valueUnitContainer}>
|
|
36
|
+
<View style={valueContainer}>
|
|
37
|
+
<Text style={remeasureStyles.value}>{measure ? limited : i18n._(t `OFF`)}</Text>
|
|
38
|
+
</View>
|
|
39
|
+
{measure ? (<View style={remeasureStyles.unitContainer}>
|
|
40
|
+
<Text style={remeasureStyles.units}>{i18n._(t `hours`)}</Text>
|
|
41
|
+
</View>) : null}
|
|
42
|
+
</View>
|
|
43
|
+
</View>
|
|
44
|
+
<Slider ref={(slider) => {
|
|
50
45
|
if (slider !== null) {
|
|
51
46
|
this.slider = slider;
|
|
52
47
|
}
|
|
53
|
-
}} testID={
|
|
54
|
-
</
|
|
48
|
+
}} testID={RemeasureTestIds.RemeasureSlider} accessibilityLabel="remeasureSlider" maximumTrackTintColor={BORDER_COLOUR_GREY} minimumTrackTintColor={BORDER_COLOUR_TEAL} thumbTintColor={BORDER_COLOUR_TEAL} maximumValue={6} minimumValue={0} step={0.5} style={[remeasureStyles.sliderStyle, { marginHorizontal }]} onValueChange={this.handleSliderChange}/>
|
|
49
|
+
</View>);
|
|
55
50
|
}
|
|
56
51
|
}
|
|
57
|
-
|
|
58
|
-
const remeasureStyles = react_native_1.StyleSheet.create({
|
|
52
|
+
const remeasureStyles = StyleSheet.create({
|
|
59
53
|
container: {
|
|
60
54
|
flexDirection: `column`,
|
|
61
55
|
padding: `3%`,
|
|
62
56
|
},
|
|
63
57
|
borderContainer: {
|
|
64
|
-
...
|
|
58
|
+
...infoStyles.borderContainer,
|
|
65
59
|
alignItems: `center`,
|
|
66
60
|
},
|
|
67
61
|
remeasureContainer: {
|
|
@@ -69,30 +63,30 @@ const remeasureStyles = react_native_1.StyleSheet.create({
|
|
|
69
63
|
},
|
|
70
64
|
remeasureLabel: {
|
|
71
65
|
color: `white`,
|
|
72
|
-
fontSize:
|
|
66
|
+
fontSize: Dimensions.get(`screen`).width / 25,
|
|
73
67
|
fontWeight: `bold`,
|
|
74
68
|
},
|
|
75
69
|
valueUnitContainer: {
|
|
76
|
-
...
|
|
70
|
+
...infoStyles.valueUnitContainer,
|
|
77
71
|
},
|
|
78
72
|
valueContainer: {
|
|
79
|
-
...
|
|
73
|
+
...infoStyles.valueContainer,
|
|
80
74
|
},
|
|
81
75
|
value: {
|
|
82
|
-
...
|
|
76
|
+
...infoStyles.value,
|
|
83
77
|
},
|
|
84
78
|
unitContainer: {
|
|
85
|
-
...
|
|
79
|
+
...infoStyles.unitContainer,
|
|
86
80
|
},
|
|
87
81
|
units: {
|
|
88
|
-
...
|
|
82
|
+
...infoStyles.units,
|
|
89
83
|
},
|
|
90
84
|
sliderStyle: {
|
|
91
85
|
marginTop: `3%`,
|
|
92
86
|
marginBottom: `2%`,
|
|
93
87
|
},
|
|
94
88
|
});
|
|
95
|
-
const variantStyles =
|
|
89
|
+
const variantStyles = StyleSheet.create({
|
|
96
90
|
centeredValueContainer: {
|
|
97
91
|
...remeasureStyles.valueContainer,
|
|
98
92
|
alignItems: `center`,
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const macro_1 = require("@lingui/macro");
|
|
9
|
-
const i18nUtils_1 = require("../locale/i18nUtils");
|
|
10
|
-
const enum_1 = require("../types/enum");
|
|
11
|
-
const Icon_1 = __importDefault(require("./Icon"));
|
|
12
|
-
class TransferToLogbook extends react_1.default.Component {
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Dimensions, StyleSheet, Text, TouchableOpacity, View } from "react-native";
|
|
3
|
+
import { t } from "@lingui/macro";
|
|
4
|
+
import { i18n } from "../locale/i18nUtils";
|
|
5
|
+
import { TransferToLogbookTestIds } from "../types/enum";
|
|
6
|
+
import Icon from "./Icon";
|
|
7
|
+
export default class TransferToLogbook extends React.Component {
|
|
13
8
|
constructor() {
|
|
14
9
|
super(...arguments);
|
|
15
10
|
this.state = {
|
|
@@ -24,20 +19,19 @@ class TransferToLogbook extends react_1.default.Component {
|
|
|
24
19
|
}
|
|
25
20
|
render() {
|
|
26
21
|
if (!this.props.visible) {
|
|
27
|
-
return <
|
|
22
|
+
return <View style={addToLogbookStyles.marginContainer}/>;
|
|
28
23
|
}
|
|
29
|
-
return (<
|
|
30
|
-
{!this.state.pressed ? (<
|
|
31
|
-
<
|
|
32
|
-
</
|
|
33
|
-
<
|
|
34
|
-
<
|
|
35
|
-
</
|
|
36
|
-
</
|
|
24
|
+
return (<TouchableOpacity testID={TransferToLogbookTestIds.TransferButton} onPress={this.handlePress} disabled={this.state.pressed} style={addToLogbookStyles.container} accessibilityLabel="transferToLogbook">
|
|
25
|
+
{!this.state.pressed ? (<View style={addToLogbookStyles.textContainer}>
|
|
26
|
+
<Text style={addToLogbookStyles.transferText}>{i18n._(t `Transfer to logbook`)}</Text>
|
|
27
|
+
</View>) : (<View style={addToLogbookStyles.textContainerActive}>
|
|
28
|
+
<Icon style={addToLogbookStyles.icon} iconIdentifier={`Feather/check`}/>
|
|
29
|
+
<Text style={addToLogbookStyles.transferTextActive}>{i18n._(t `Transferred to logbook`)}</Text>
|
|
30
|
+
</View>)}
|
|
31
|
+
</TouchableOpacity>);
|
|
37
32
|
}
|
|
38
33
|
}
|
|
39
|
-
|
|
40
|
-
const addToLogbookStyles = react_native_1.StyleSheet.create({
|
|
34
|
+
const addToLogbookStyles = StyleSheet.create({
|
|
41
35
|
marginContainer: {
|
|
42
36
|
marginVertical: `3%`,
|
|
43
37
|
},
|
|
@@ -56,7 +50,7 @@ const addToLogbookStyles = react_native_1.StyleSheet.create({
|
|
|
56
50
|
},
|
|
57
51
|
transferText: {
|
|
58
52
|
color: `#01FFFC`,
|
|
59
|
-
fontSize:
|
|
53
|
+
fontSize: Dimensions.get(`screen`).width / 22,
|
|
60
54
|
fontWeight: `bold`,
|
|
61
55
|
},
|
|
62
56
|
textContainerActive: {
|
|
@@ -71,12 +65,12 @@ const addToLogbookStyles = react_native_1.StyleSheet.create({
|
|
|
71
65
|
icon: {
|
|
72
66
|
paddingTop: `1.3%`,
|
|
73
67
|
color: `#1B1F48`,
|
|
74
|
-
fontSize:
|
|
68
|
+
fontSize: Dimensions.get(`screen`).width / 22,
|
|
75
69
|
marginRight: `1%`,
|
|
76
70
|
},
|
|
77
71
|
transferTextActive: {
|
|
78
72
|
color: `#1B1F48`,
|
|
79
|
-
fontSize:
|
|
73
|
+
fontSize: Dimensions.get(`screen`).width / 22,
|
|
80
74
|
fontWeight: `bold`,
|
|
81
75
|
},
|
|
82
76
|
});
|
|
@@ -1,80 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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.prototype.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
|
-
exports.modalStyle = void 0;
|
|
26
|
-
const React = __importStar(require("react"));
|
|
27
|
-
const react_native_1 = require("react-native");
|
|
28
|
-
const enum_1 = require("../types/enum");
|
|
29
|
-
const Constants_1 = require("../utils/Constants");
|
|
30
|
-
const Icon_1 = __importDefault(require("./Icon"));
|
|
31
|
-
const RecommendationModal_1 = require("./RecommendationModal");
|
|
32
|
-
class TwoOptionModal extends React.Component {
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Dimensions, StatusBar, StyleSheet, Text, TouchableOpacity, View } from "react-native";
|
|
3
|
+
import { TwoOptionModalTestIds } from "../types/enum";
|
|
4
|
+
import { BACKGROUND_COLOUR_PURPLE, BORDER_COLOUR_GREY, BORDER_COLOUR_TEAL } from "../utils/Constants";
|
|
5
|
+
import Icon from "./Icon";
|
|
6
|
+
import { stylesModal } from "./RecommendationModal";
|
|
7
|
+
export default class TwoOptionModal extends React.Component {
|
|
33
8
|
constructor(props) {
|
|
34
9
|
super(props);
|
|
35
10
|
}
|
|
36
11
|
render() {
|
|
37
12
|
const { rowAsButtonLayout, isCancelable } = this.props;
|
|
38
|
-
return (<
|
|
39
|
-
<
|
|
40
|
-
<
|
|
41
|
-
{isCancelable ? (<
|
|
42
|
-
<
|
|
43
|
-
</
|
|
13
|
+
return (<View style={modalStyle.container}>
|
|
14
|
+
<StatusBar backgroundColor={`rgba(0, 0, 0, 1)`}/>
|
|
15
|
+
<View style={modalStyle.modalContainer}>
|
|
16
|
+
{isCancelable ? (<TouchableOpacity onPress={this.props.onClose} testID={TwoOptionModalTestIds.ExitButton} style={modalStyle.iconWrapper}>
|
|
17
|
+
<Icon accessibilityLabel="ModalExitIcon" iconIdentifier={`Ionicons/ios-close-circle-outline`} style={modalStyle.icon}/>
|
|
18
|
+
</TouchableOpacity>) : null}
|
|
44
19
|
|
|
45
|
-
<
|
|
46
|
-
<
|
|
20
|
+
<View style={isCancelable ? modalStyle.textContainer : modalStyle.textContainerNotCancelable}>
|
|
21
|
+
<Text style={rowAsButtonLayout ? modalStyle.titleRowLayout : modalStyle.titleColumnLayout}>
|
|
47
22
|
{this.props.title}
|
|
48
|
-
</
|
|
49
|
-
<
|
|
50
|
-
</
|
|
51
|
-
<
|
|
52
|
-
<
|
|
53
|
-
<
|
|
23
|
+
</Text>
|
|
24
|
+
<Text style={modalStyle.message}>{this.props.message}</Text>
|
|
25
|
+
</View>
|
|
26
|
+
<View style={rowAsButtonLayout ? modalStyle.buttonContainerRow : modalStyle.buttonContainerColumn}>
|
|
27
|
+
<TouchableOpacity testID={TwoOptionModalTestIds.FirstOption} accessibilityLabel="firstOptionButton" onPress={this.props.firstOption} style={rowAsButtonLayout ? modalStyle.buttonRow : modalStyle.firstButtonColumn}>
|
|
28
|
+
<Text style={rowAsButtonLayout ? modalStyle.textButtonRow : modalStyle.textFirstButtonColumn}>
|
|
54
29
|
{this.props.textFirstOption}
|
|
55
|
-
</
|
|
56
|
-
</
|
|
57
|
-
<
|
|
58
|
-
<
|
|
30
|
+
</Text>
|
|
31
|
+
</TouchableOpacity>
|
|
32
|
+
<TouchableOpacity testID={TwoOptionModalTestIds.SecondOption} accessibilityLabel="secondOptionButton" onPress={this.props.secondOption} style={rowAsButtonLayout ? modalStyle.buttonRow : modalStyle.secondButtonColumn}>
|
|
33
|
+
<Text style={rowAsButtonLayout ? modalStyle.textButtonRow : modalStyle.textSecondButtonColumn}>
|
|
59
34
|
{this.props.textSecondOption}
|
|
60
|
-
</
|
|
61
|
-
</
|
|
62
|
-
</
|
|
63
|
-
</
|
|
64
|
-
</
|
|
35
|
+
</Text>
|
|
36
|
+
</TouchableOpacity>
|
|
37
|
+
</View>
|
|
38
|
+
</View>
|
|
39
|
+
</View>);
|
|
65
40
|
}
|
|
66
41
|
}
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
exports.modalStyle = react_native_1.StyleSheet.create({
|
|
42
|
+
const { height, width } = Dimensions.get(`screen`);
|
|
43
|
+
export const modalStyle = StyleSheet.create({
|
|
70
44
|
container: {
|
|
71
|
-
...
|
|
45
|
+
...StyleSheet.absoluteFillObject,
|
|
72
46
|
justifyContent: `center`,
|
|
73
47
|
backgroundColor: `rgba(0, 0, 0, 0.9)`,
|
|
74
48
|
},
|
|
75
49
|
modalContainer: {
|
|
76
50
|
margin: `4%`,
|
|
77
|
-
backgroundColor:
|
|
51
|
+
backgroundColor: BACKGROUND_COLOUR_PURPLE,
|
|
78
52
|
borderRadius: width / 25,
|
|
79
53
|
},
|
|
80
54
|
iconWrapper: {
|
|
@@ -83,7 +57,7 @@ exports.modalStyle = react_native_1.StyleSheet.create({
|
|
|
83
57
|
marginTop: `3%`,
|
|
84
58
|
},
|
|
85
59
|
icon: {
|
|
86
|
-
color:
|
|
60
|
+
color: BORDER_COLOUR_GREY,
|
|
87
61
|
fontSize: width / 12,
|
|
88
62
|
},
|
|
89
63
|
textContainer: {
|
|
@@ -131,16 +105,16 @@ exports.modalStyle = react_native_1.StyleSheet.create({
|
|
|
131
105
|
margin: `4%`,
|
|
132
106
|
},
|
|
133
107
|
buttonRow: {
|
|
134
|
-
...
|
|
108
|
+
...stylesModal.okButton,
|
|
135
109
|
height: height / 16,
|
|
136
110
|
marginTop: 0,
|
|
137
111
|
},
|
|
138
112
|
firstButtonColumn: {
|
|
139
|
-
...
|
|
113
|
+
...stylesModal.okButton,
|
|
140
114
|
height: height / 18,
|
|
141
115
|
width: width / 1.5,
|
|
142
116
|
marginTop: 0,
|
|
143
|
-
backgroundColor:
|
|
117
|
+
backgroundColor: BORDER_COLOUR_TEAL,
|
|
144
118
|
},
|
|
145
119
|
secondButtonColumn: {
|
|
146
120
|
alignSelf: `center`,
|
|
@@ -165,7 +139,7 @@ exports.modalStyle = react_native_1.StyleSheet.create({
|
|
|
165
139
|
fontFamily: `Roboto-Regular`,
|
|
166
140
|
textAlign: `center`,
|
|
167
141
|
fontSize: width / 26,
|
|
168
|
-
color:
|
|
142
|
+
color: BORDER_COLOUR_TEAL,
|
|
169
143
|
fontWeight: `bold`,
|
|
170
144
|
},
|
|
171
145
|
});
|
|
@@ -1,55 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const enum_1 = require("../../types/enum");
|
|
11
|
-
const InfoBars_1 = require("../InfoBars");
|
|
12
|
-
const ActivityIcon_1 = __importDefault(require("./ActivityIcon"));
|
|
13
|
-
const ActivityIntensity_1 = __importDefault(require("./ActivityIntensity"));
|
|
14
|
-
class Activity extends react_1.default.Component {
|
|
1
|
+
import { t } from "@lingui/macro";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Dimensions, StyleSheet, Text, View } from "react-native";
|
|
4
|
+
import { i18n } from "../../locale/i18nUtils";
|
|
5
|
+
import { ActivityTestIds } from "../../types/enum";
|
|
6
|
+
import { infoStyles } from "../InfoBars";
|
|
7
|
+
import ActivityIcon from "./ActivityIcon";
|
|
8
|
+
import ActivityIntensity from "./ActivityIntensity";
|
|
9
|
+
export default class Activity extends React.Component {
|
|
15
10
|
render() {
|
|
16
11
|
const { activity, activityType, activityReduction, activityTitle } = this.props;
|
|
17
12
|
const reductionPercentage = ((activityReduction ?? 0) * 100).toFixed(0);
|
|
18
|
-
return (<
|
|
19
|
-
<
|
|
20
|
-
<
|
|
21
|
-
<
|
|
22
|
-
<
|
|
23
|
-
<
|
|
24
|
-
</
|
|
25
|
-
<
|
|
26
|
-
<
|
|
27
|
-
<
|
|
28
|
-
</
|
|
29
|
-
<
|
|
30
|
-
<
|
|
31
|
-
</
|
|
32
|
-
</
|
|
33
|
-
</
|
|
34
|
-
<
|
|
35
|
-
<
|
|
36
|
-
<
|
|
37
|
-
<
|
|
38
|
-
{
|
|
39
|
-
</
|
|
40
|
-
</
|
|
41
|
-
<
|
|
42
|
-
<
|
|
13
|
+
return (<View style={[infoStyles.container, activityStyles.botMargin]}>
|
|
14
|
+
<View style={infoStyles.margin}>
|
|
15
|
+
<View style={infoStyles.border}>
|
|
16
|
+
<View style={infoStyles.borderContainer}>
|
|
17
|
+
<View style={infoStyles.labelContainer}>
|
|
18
|
+
<Text style={infoStyles.label}>{i18n._(t `Activity`)}</Text>
|
|
19
|
+
</View>
|
|
20
|
+
<View style={infoStyles.valueUnitContainer}>
|
|
21
|
+
<View style={infoStyles.valueContainer}>
|
|
22
|
+
<Text style={infoStyles.value}>{activity.activityDuration}</Text>
|
|
23
|
+
</View>
|
|
24
|
+
<View style={infoStyles.unitContainer}>
|
|
25
|
+
<Text style={infoStyles.units}>{i18n._(t `min`)}</Text>
|
|
26
|
+
</View>
|
|
27
|
+
</View>
|
|
28
|
+
</View>
|
|
29
|
+
<ActivityIcon activityType={activityType} activityTitle={activityTitle}/>
|
|
30
|
+
<ActivityIntensity activityIntensity={activity.activityIntensity}/>
|
|
31
|
+
<View style={[infoStyles.borderContainer, activityStyles.topMargin]}>
|
|
32
|
+
<Text style={activityStyles.infoText}>
|
|
33
|
+
{i18n._(t `Based on the selected activity your insulin recommendation is reduced by:`)}
|
|
34
|
+
</Text>
|
|
35
|
+
</View>
|
|
36
|
+
<View style={[infoStyles.borderContainer, activityStyles.verticalMargin]}>
|
|
37
|
+
<Text style={activityStyles.reductionPercentage} testID={ActivityTestIds.ActivityReduction}>
|
|
43
38
|
{reductionPercentage}%
|
|
44
|
-
</
|
|
45
|
-
</
|
|
46
|
-
</
|
|
47
|
-
</
|
|
48
|
-
</
|
|
39
|
+
</Text>
|
|
40
|
+
</View>
|
|
41
|
+
</View>
|
|
42
|
+
</View>
|
|
43
|
+
</View>);
|
|
49
44
|
}
|
|
50
45
|
}
|
|
51
|
-
|
|
52
|
-
const activityStyles = react_native_1.StyleSheet.create({
|
|
46
|
+
const activityStyles = StyleSheet.create({
|
|
53
47
|
topMargin: {
|
|
54
48
|
marginTop: `2%`,
|
|
55
49
|
},
|
|
@@ -61,12 +55,12 @@ const activityStyles = react_native_1.StyleSheet.create({
|
|
|
61
55
|
},
|
|
62
56
|
infoText: {
|
|
63
57
|
color: `rgba(160, 180, 240, 1)`,
|
|
64
|
-
fontSize:
|
|
58
|
+
fontSize: Dimensions.get(`screen`).width / 24,
|
|
65
59
|
},
|
|
66
60
|
reductionPercentage: {
|
|
67
61
|
color: `white`,
|
|
68
62
|
marginTop: `2%`,
|
|
69
|
-
fontSize:
|
|
63
|
+
fontSize: Dimensions.get(`screen`).width / 18,
|
|
70
64
|
fontWeight: `bold`,
|
|
71
65
|
},
|
|
72
66
|
});
|