@hedia/recommendation-screen 2.1.33 → 2.1.34-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ios/HediaRecommendationScreen.xcodeproj/project.pbxproj +2 -2
- package/ios/Podfile.lock +207 -207
- package/package.json +1 -1
- package/index.d.ts +0 -5
- package/index.js +0 -5
- package/src/RecommendationScreen.d.ts +0 -413
- package/src/RecommendationScreen.js +0 -493
- package/src/__tests__/RecommendationScreen.test.d.ts +0 -1
- package/src/__tests__/RecommendationScreen.test.js +0 -965
- package/src/__tests__/RecommendationUtils.test.d.ts +0 -1
- package/src/__tests__/RecommendationUtils.test.js +0 -216
- package/src/__tests__/Translate.test.d.ts +0 -1
- package/src/__tests__/Translate.test.js +0 -27
- package/src/__tests__/Utils.test.d.ts +0 -1
- package/src/__tests__/Utils.test.js +0 -66
- package/src/__tests__/Validations.test.d.ts +0 -1
- package/src/__tests__/Validations.test.js +0 -465
- package/src/__tests__/components/Activity.test.d.ts +0 -1
- package/src/__tests__/components/Activity.test.js +0 -86
- package/src/__tests__/components/Emotion.test.d.ts +0 -1
- package/src/__tests__/components/Emotion.test.js +0 -70
- package/src/__tests__/components/Header.test.d.ts +0 -1
- package/src/__tests__/components/Header.test.js +0 -36
- package/src/__tests__/components/InfoBars.test.d.ts +0 -1
- package/src/__tests__/components/InfoBars.test.js +0 -130
- package/src/__tests__/components/InvisibleNumberInput.test.d.ts +0 -1
- package/src/__tests__/components/InvisibleNumberInput.test.js +0 -160
- package/src/__tests__/components/LimitationMessage.test.d.ts +0 -1
- package/src/__tests__/components/LimitationMessage.test.js +0 -47
- package/src/__tests__/components/MoodIcon.test.d.ts +0 -1
- package/src/__tests__/components/MoodIcon.test.js +0 -30
- package/src/__tests__/components/RecommendationModal.test.d.ts +0 -1
- package/src/__tests__/components/RecommendationModal.test.js +0 -98
- package/src/__tests__/components/RecommendedCarbs.test.d.ts +0 -1
- package/src/__tests__/components/RecommendedCarbs.test.js +0 -120
- package/src/__tests__/components/RecommendedInsulin.test.d.ts +0 -1
- package/src/__tests__/components/RecommendedInsulin.test.js +0 -154
- package/src/__tests__/components/Remeasure.test.d.ts +0 -1
- package/src/__tests__/components/Remeasure.test.js +0 -78
- package/src/__tests__/components/TransferToLogbook.test.d.ts +0 -1
- package/src/__tests__/components/TransferToLogbook.test.js +0 -30
- package/src/__tests__/components/TwoOptionModal.test.d.ts +0 -1
- package/src/__tests__/components/TwoOptionModal.test.js +0 -65
- package/src/__tests__/utils.d.ts +0 -16
- package/src/__tests__/utils.js +0 -126
- package/src/components/Header.d.ts +0 -10
- package/src/components/Header.js +0 -75
- package/src/components/Icon.d.ts +0 -20
- package/src/components/Icon.js +0 -41
- package/src/components/InfoBars.d.ts +0 -103
- package/src/components/InfoBars.js +0 -129
- package/src/components/InvisibleNumberInput.d.ts +0 -89
- package/src/components/InvisibleNumberInput.js +0 -122
- package/src/components/LimitationMessage.d.ts +0 -14
- package/src/components/LimitationMessage.js +0 -31
- package/src/components/LineSeparator.d.ts +0 -10
- package/src/components/LineSeparator.js +0 -18
- package/src/components/RecentInsulin.d.ts +0 -17
- package/src/components/RecentInsulin.js +0 -94
- package/src/components/RecommendationModal.d.ts +0 -207
- package/src/components/RecommendationModal.js +0 -213
- package/src/components/RecommendedCarbs.d.ts +0 -94
- package/src/components/RecommendedCarbs.js +0 -251
- package/src/components/RecommendedInsulin.d.ts +0 -84
- package/src/components/RecommendedInsulin.js +0 -170
- package/src/components/Remeasure.d.ts +0 -49
- package/src/components/Remeasure.js +0 -125
- package/src/components/TransferToLogbook.d.ts +0 -34
- package/src/components/TransferToLogbook.js +0 -94
- package/src/components/TwoOptionModal.d.ts +0 -145
- package/src/components/TwoOptionModal.js +0 -148
- package/src/components/activity/Activity.d.ts +0 -26
- package/src/components/activity/Activity.js +0 -80
- package/src/components/activity/ActivityIcon.d.ts +0 -22
- package/src/components/activity/ActivityIcon.js +0 -58
- package/src/components/activity/ActivityIntensity.d.ts +0 -16
- package/src/components/activity/ActivityIntensity.js +0 -59
- package/src/components/mood/Emotion.d.ts +0 -38
- package/src/components/mood/Emotion.js +0 -65
- package/src/components/mood/MoodIcon.d.ts +0 -40
- package/src/components/mood/MoodIcon.js +0 -66
- package/src/locale/i18nUtils.d.ts +0 -18
- package/src/locale/i18nUtils.js +0 -39
- package/src/types/enum.d.ts +0 -122
- package/src/types/enum.js +0 -138
- package/src/types/types.d.ts +0 -17
- package/src/types/types.js +0 -1
- package/src/utils/AttentionMessages.d.ts +0 -96
- package/src/utils/AttentionMessages.js +0 -118
- package/src/utils/Constants.d.ts +0 -47
- package/src/utils/Constants.js +0 -47
- package/src/utils/RecommendationError.d.ts +0 -56
- package/src/utils/RecommendationError.js +0 -62
- package/src/utils/RecommendationUtils.d.ts +0 -100
- package/src/utils/RecommendationUtils.js +0 -199
- package/src/utils/Translations.d.ts +0 -9
- package/src/utils/Translations.js +0 -14
- package/src/utils/Utils.d.ts +0 -105
- package/src/utils/Utils.js +0 -141
- package/src/utils/Validations.d.ts +0 -250
- package/src/utils/Validations.js +0 -409
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
export interface IProps {
|
|
3
|
-
/** Whether or not the transfer button shall be visible on the screen. */
|
|
4
|
-
visible: boolean;
|
|
5
|
-
/** To be called when the button is pressed. */
|
|
6
|
-
transfer(): void;
|
|
7
|
-
}
|
|
8
|
-
export interface IState {
|
|
9
|
-
/** Keeps track of whether the button was already pressed and thus should be displayed in the inactive visually distinct pressed state. */
|
|
10
|
-
pressed: boolean;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Render a button for transferring the recommendation to a logbook entry.
|
|
14
|
-
* The button has a visually distinct pressed state to signal to the user that the button was actually activated before returning to the dashboard screen.
|
|
15
|
-
*/
|
|
16
|
-
export default class TransferToLogbook extends React.Component<IProps, IState> {
|
|
17
|
-
/** Initialise the state pressed variable with false */
|
|
18
|
-
state: IState;
|
|
19
|
-
/**
|
|
20
|
-
* Handle what happens when the button is pressed.
|
|
21
|
-
*
|
|
22
|
-
* Steps:
|
|
23
|
-
* 1. Toggle the pressed state to the opposite of its current value.
|
|
24
|
-
* 2. Call the transfer prop callback function.
|
|
25
|
-
*/
|
|
26
|
-
handlePress: () => void;
|
|
27
|
-
/**
|
|
28
|
-
* Steps:
|
|
29
|
-
* 1. If the visible prop is false, display an empty space to keep the correct margins in the screen.
|
|
30
|
-
* 2. Return a JSX element to display a touchable button (that is disabled when the pressed state is true)
|
|
31
|
-
* @returns JSX element for displaying the transfer button
|
|
32
|
-
*/
|
|
33
|
-
render(): JSX.Element;
|
|
34
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
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 { Testing } from "../types/enum";
|
|
6
|
-
import Icon from "./Icon";
|
|
7
|
-
/**
|
|
8
|
-
* Render a button for transferring the recommendation to a logbook entry.
|
|
9
|
-
* The button has a visually distinct pressed state to signal to the user that the button was actually activated before returning to the dashboard screen.
|
|
10
|
-
*/
|
|
11
|
-
export default class TransferToLogbook extends React.Component {
|
|
12
|
-
constructor() {
|
|
13
|
-
super(...arguments);
|
|
14
|
-
/** Initialise the state pressed variable with false */
|
|
15
|
-
this.state = {
|
|
16
|
-
pressed: false,
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Handle what happens when the button is pressed.
|
|
20
|
-
*
|
|
21
|
-
* Steps:
|
|
22
|
-
* 1. Toggle the pressed state to the opposite of its current value.
|
|
23
|
-
* 2. Call the transfer prop callback function.
|
|
24
|
-
*/
|
|
25
|
-
this.handlePress = () => {
|
|
26
|
-
this.setState({
|
|
27
|
-
pressed: !this.state.pressed,
|
|
28
|
-
});
|
|
29
|
-
this.props.transfer();
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Steps:
|
|
34
|
-
* 1. If the visible prop is false, display an empty space to keep the correct margins in the screen.
|
|
35
|
-
* 2. Return a JSX element to display a touchable button (that is disabled when the pressed state is true)
|
|
36
|
-
* @returns JSX element for displaying the transfer button
|
|
37
|
-
*/
|
|
38
|
-
render() {
|
|
39
|
-
if (!this.props.visible) {
|
|
40
|
-
return <View style={addToLogbookStyles.marginContainer}/>;
|
|
41
|
-
}
|
|
42
|
-
return (<TouchableOpacity testID={Testing.Id.TransferToLogbookTestIds.TransferButton} onPress={this.handlePress} disabled={this.state.pressed} style={addToLogbookStyles.container} accessibilityLabel="transferToLogbook">
|
|
43
|
-
{!this.state.pressed ? (<View style={addToLogbookStyles.textContainer}>
|
|
44
|
-
<Text style={addToLogbookStyles.transferText}>{i18n._(t `Transfer to logbook`)}</Text>
|
|
45
|
-
</View>) : (<View style={addToLogbookStyles.textContainerActive}>
|
|
46
|
-
<Icon style={addToLogbookStyles.icon} iconIdentifier={`Feather/check`}/>
|
|
47
|
-
<Text style={addToLogbookStyles.transferTextActive}>{i18n._(t `Transferred to logbook`)}</Text>
|
|
48
|
-
</View>)}
|
|
49
|
-
</TouchableOpacity>);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
const addToLogbookStyles = StyleSheet.create({
|
|
53
|
-
marginContainer: {
|
|
54
|
-
marginVertical: `3%`,
|
|
55
|
-
},
|
|
56
|
-
container: {
|
|
57
|
-
flex: 1,
|
|
58
|
-
margin: `5%`,
|
|
59
|
-
},
|
|
60
|
-
textContainer: {
|
|
61
|
-
flexDirection: `row`,
|
|
62
|
-
justifyContent: `center`,
|
|
63
|
-
borderWidth: 1,
|
|
64
|
-
borderRadius: 100,
|
|
65
|
-
marginHorizontal: `4%`,
|
|
66
|
-
paddingVertical: `4%`,
|
|
67
|
-
borderColor: `#01FFFC`,
|
|
68
|
-
},
|
|
69
|
-
transferText: {
|
|
70
|
-
color: `#01FFFC`,
|
|
71
|
-
fontSize: Dimensions.get(`screen`).width / 22,
|
|
72
|
-
fontWeight: `bold`,
|
|
73
|
-
},
|
|
74
|
-
textContainerActive: {
|
|
75
|
-
flexDirection: `row`,
|
|
76
|
-
backgroundColor: `#01FFFC`,
|
|
77
|
-
justifyContent: `center`,
|
|
78
|
-
borderWidth: 1,
|
|
79
|
-
borderRadius: 100,
|
|
80
|
-
marginHorizontal: `4%`,
|
|
81
|
-
paddingVertical: `4%`,
|
|
82
|
-
},
|
|
83
|
-
icon: {
|
|
84
|
-
paddingTop: `1.3%`,
|
|
85
|
-
color: `#1B1F48`,
|
|
86
|
-
fontSize: Dimensions.get(`screen`).width / 22,
|
|
87
|
-
marginRight: `1%`,
|
|
88
|
-
},
|
|
89
|
-
transferTextActive: {
|
|
90
|
-
color: `#1B1F48`,
|
|
91
|
-
fontSize: Dimensions.get(`screen`).width / 22,
|
|
92
|
-
fontWeight: `bold`,
|
|
93
|
-
},
|
|
94
|
-
});
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
export interface ITwoOptionModalProps {
|
|
3
|
-
/** The title of the modal. */
|
|
4
|
-
title: string;
|
|
5
|
-
/** The message to show in the modal. */
|
|
6
|
-
message: string;
|
|
7
|
-
/** The label of the first option. */
|
|
8
|
-
textFirstOption: string;
|
|
9
|
-
/** The label of the second option. */
|
|
10
|
-
textSecondOption: string;
|
|
11
|
-
/** Whether or not the modal shall have a cancel button in the corner to close the modal. */
|
|
12
|
-
isCancelable?: boolean;
|
|
13
|
-
/** If true the buttons will be displayed side-by-side. If false the buttons will be displayed on top of each other. */
|
|
14
|
-
rowAsButtonLayout: boolean;
|
|
15
|
-
/** To be called if the user taps the first option button. */
|
|
16
|
-
firstOption(): void;
|
|
17
|
-
/** To be called if the user taps the second option button. */
|
|
18
|
-
secondOption(): void;
|
|
19
|
-
/** To be called if the user taps the optionally shown close button. */
|
|
20
|
-
onClose?(): void;
|
|
21
|
-
}
|
|
22
|
-
/** Display a modal with two buttons for the user to choose between. */
|
|
23
|
-
export default class TwoOptionModal extends React.Component<ITwoOptionModalProps> {
|
|
24
|
-
/** Compose a JSX element for displaying the modal. */
|
|
25
|
-
render(): JSX.Element;
|
|
26
|
-
}
|
|
27
|
-
/** @internal */
|
|
28
|
-
export declare const modalStyle: {
|
|
29
|
-
container: {
|
|
30
|
-
justifyContent: "center";
|
|
31
|
-
backgroundColor: string;
|
|
32
|
-
position: "absolute";
|
|
33
|
-
left: 0;
|
|
34
|
-
right: 0;
|
|
35
|
-
top: 0;
|
|
36
|
-
bottom: 0;
|
|
37
|
-
};
|
|
38
|
-
modalContainer: {
|
|
39
|
-
margin: string;
|
|
40
|
-
backgroundColor: string;
|
|
41
|
-
borderRadius: number;
|
|
42
|
-
};
|
|
43
|
-
iconWrapper: {
|
|
44
|
-
alignSelf: "flex-end";
|
|
45
|
-
marginRight: string;
|
|
46
|
-
marginTop: string;
|
|
47
|
-
};
|
|
48
|
-
icon: {
|
|
49
|
-
color: string;
|
|
50
|
-
fontSize: number;
|
|
51
|
-
};
|
|
52
|
-
textContainer: {
|
|
53
|
-
marginHorizontal: string;
|
|
54
|
-
marginBottom: string;
|
|
55
|
-
marginTop: string;
|
|
56
|
-
alignSelf: "flex-start";
|
|
57
|
-
};
|
|
58
|
-
textContainerNotCancelable: {
|
|
59
|
-
marginHorizontal: string;
|
|
60
|
-
marginVertical: string;
|
|
61
|
-
alignSelf: "flex-start";
|
|
62
|
-
};
|
|
63
|
-
titleRowLayout: {
|
|
64
|
-
fontFamily: string;
|
|
65
|
-
color: string;
|
|
66
|
-
fontSize: number;
|
|
67
|
-
fontWeight: "bold";
|
|
68
|
-
textAlign: "center";
|
|
69
|
-
marginBottom: string;
|
|
70
|
-
};
|
|
71
|
-
titleColumnLayout: {
|
|
72
|
-
fontFamily: string;
|
|
73
|
-
color: string;
|
|
74
|
-
fontSize: number;
|
|
75
|
-
fontWeight: "bold";
|
|
76
|
-
textAlign: "center";
|
|
77
|
-
marginBottom: string;
|
|
78
|
-
};
|
|
79
|
-
message: {
|
|
80
|
-
fontFamily: string;
|
|
81
|
-
color: string;
|
|
82
|
-
fontSize: number;
|
|
83
|
-
textAlign: "center";
|
|
84
|
-
};
|
|
85
|
-
buttonContainerRow: {
|
|
86
|
-
flexDirection: "row";
|
|
87
|
-
justifyContent: "space-around";
|
|
88
|
-
marginHorizontal: string;
|
|
89
|
-
marginVertical: string;
|
|
90
|
-
};
|
|
91
|
-
buttonContainerColumn: {
|
|
92
|
-
flexDirection: "column";
|
|
93
|
-
justifyContent: "space-around";
|
|
94
|
-
margin: string;
|
|
95
|
-
};
|
|
96
|
-
buttonRow: {
|
|
97
|
-
height: number;
|
|
98
|
-
marginTop: number;
|
|
99
|
-
borderRadius: number;
|
|
100
|
-
borderWidth: number;
|
|
101
|
-
borderColor: string;
|
|
102
|
-
width: number;
|
|
103
|
-
alignSelf: "center";
|
|
104
|
-
justifyContent: "center";
|
|
105
|
-
};
|
|
106
|
-
firstButtonColumn: {
|
|
107
|
-
height: number;
|
|
108
|
-
width: number;
|
|
109
|
-
marginTop: number;
|
|
110
|
-
backgroundColor: string;
|
|
111
|
-
borderRadius: number;
|
|
112
|
-
borderWidth: number;
|
|
113
|
-
borderColor: string;
|
|
114
|
-
alignSelf: "center";
|
|
115
|
-
justifyContent: "center";
|
|
116
|
-
};
|
|
117
|
-
secondButtonColumn: {
|
|
118
|
-
alignSelf: "center";
|
|
119
|
-
justifyContent: "center";
|
|
120
|
-
height: number;
|
|
121
|
-
width: number;
|
|
122
|
-
marginTop: string;
|
|
123
|
-
};
|
|
124
|
-
textButtonRow: {
|
|
125
|
-
fontFamily: string;
|
|
126
|
-
textAlign: "center";
|
|
127
|
-
fontSize: number;
|
|
128
|
-
color: string;
|
|
129
|
-
};
|
|
130
|
-
textFirstButtonColumn: {
|
|
131
|
-
fontFamily: string;
|
|
132
|
-
textAlign: "center";
|
|
133
|
-
fontSize: number;
|
|
134
|
-
paddingHorizontal: number;
|
|
135
|
-
color: string;
|
|
136
|
-
fontWeight: "700";
|
|
137
|
-
};
|
|
138
|
-
textSecondButtonColumn: {
|
|
139
|
-
fontFamily: string;
|
|
140
|
-
textAlign: "center";
|
|
141
|
-
fontSize: number;
|
|
142
|
-
color: string;
|
|
143
|
-
fontWeight: "bold";
|
|
144
|
-
};
|
|
145
|
-
};
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { Dimensions, StatusBar, StyleSheet, Text, TouchableOpacity, View } from "react-native";
|
|
3
|
-
import { Testing } 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
|
-
const { TwoOptionModalTestIds } = Testing.Id;
|
|
8
|
-
/** Display a modal with two buttons for the user to choose between. */
|
|
9
|
-
export default class TwoOptionModal extends React.Component {
|
|
10
|
-
/** Compose a JSX element for displaying the modal. */
|
|
11
|
-
render() {
|
|
12
|
-
const { rowAsButtonLayout, isCancelable } = this.props;
|
|
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}
|
|
19
|
-
|
|
20
|
-
<View style={isCancelable ? modalStyle.textContainer : modalStyle.textContainerNotCancelable}>
|
|
21
|
-
<Text style={rowAsButtonLayout ? modalStyle.titleRowLayout : modalStyle.titleColumnLayout}>
|
|
22
|
-
{this.props.title}
|
|
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}>
|
|
29
|
-
{this.props.textFirstOption}
|
|
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}>
|
|
34
|
-
{this.props.textSecondOption}
|
|
35
|
-
</Text>
|
|
36
|
-
</TouchableOpacity>
|
|
37
|
-
</View>
|
|
38
|
-
</View>
|
|
39
|
-
</View>);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
const { height, width } = Dimensions.get(`screen`);
|
|
43
|
-
/** @internal */
|
|
44
|
-
export const modalStyle = StyleSheet.create({
|
|
45
|
-
container: {
|
|
46
|
-
...StyleSheet.absoluteFillObject,
|
|
47
|
-
justifyContent: `center`,
|
|
48
|
-
backgroundColor: `rgba(0, 0, 0, 0.9)`,
|
|
49
|
-
},
|
|
50
|
-
modalContainer: {
|
|
51
|
-
margin: `4%`,
|
|
52
|
-
backgroundColor: BACKGROUND_COLOUR_PURPLE,
|
|
53
|
-
borderRadius: width / 25,
|
|
54
|
-
},
|
|
55
|
-
iconWrapper: {
|
|
56
|
-
alignSelf: `flex-end`,
|
|
57
|
-
marginRight: `4%`,
|
|
58
|
-
marginTop: `3%`,
|
|
59
|
-
},
|
|
60
|
-
icon: {
|
|
61
|
-
color: BORDER_COLOUR_GREY,
|
|
62
|
-
fontSize: width / 12,
|
|
63
|
-
},
|
|
64
|
-
textContainer: {
|
|
65
|
-
marginHorizontal: `4%`,
|
|
66
|
-
marginBottom: `5%`,
|
|
67
|
-
marginTop: `2%`,
|
|
68
|
-
alignSelf: `flex-start`,
|
|
69
|
-
},
|
|
70
|
-
textContainerNotCancelable: {
|
|
71
|
-
marginHorizontal: `4%`,
|
|
72
|
-
marginVertical: `5%`,
|
|
73
|
-
alignSelf: `flex-start`,
|
|
74
|
-
},
|
|
75
|
-
titleRowLayout: {
|
|
76
|
-
fontFamily: `Roboto-Regular`,
|
|
77
|
-
color: `rgba(139, 144, 196, 1)`,
|
|
78
|
-
fontSize: width / 17,
|
|
79
|
-
fontWeight: `bold`,
|
|
80
|
-
textAlign: `center`,
|
|
81
|
-
marginBottom: `10%`,
|
|
82
|
-
},
|
|
83
|
-
titleColumnLayout: {
|
|
84
|
-
fontFamily: `Roboto-Regular`,
|
|
85
|
-
color: `rgba(139, 144, 196, 1)`,
|
|
86
|
-
fontSize: width / 17,
|
|
87
|
-
fontWeight: `bold`,
|
|
88
|
-
textAlign: `center`,
|
|
89
|
-
marginBottom: `5%`,
|
|
90
|
-
},
|
|
91
|
-
message: {
|
|
92
|
-
fontFamily: `Roboto-Regular`,
|
|
93
|
-
color: `rgba(245, 242, 242, 1)`,
|
|
94
|
-
fontSize: width / 22,
|
|
95
|
-
textAlign: `center`,
|
|
96
|
-
},
|
|
97
|
-
buttonContainerRow: {
|
|
98
|
-
flexDirection: `row`,
|
|
99
|
-
justifyContent: `space-around`,
|
|
100
|
-
marginHorizontal: `4%`,
|
|
101
|
-
marginVertical: `6%`,
|
|
102
|
-
},
|
|
103
|
-
buttonContainerColumn: {
|
|
104
|
-
flexDirection: `column`,
|
|
105
|
-
justifyContent: `space-around`,
|
|
106
|
-
margin: `4%`,
|
|
107
|
-
},
|
|
108
|
-
buttonRow: {
|
|
109
|
-
...stylesModal.okButton,
|
|
110
|
-
height: height / 16,
|
|
111
|
-
marginTop: 0,
|
|
112
|
-
},
|
|
113
|
-
firstButtonColumn: {
|
|
114
|
-
...stylesModal.okButton,
|
|
115
|
-
height: height / 18,
|
|
116
|
-
width: width / 1.5,
|
|
117
|
-
marginTop: 0,
|
|
118
|
-
backgroundColor: BORDER_COLOUR_TEAL,
|
|
119
|
-
},
|
|
120
|
-
secondButtonColumn: {
|
|
121
|
-
alignSelf: `center`,
|
|
122
|
-
justifyContent: `center`,
|
|
123
|
-
height: height / 18,
|
|
124
|
-
width: width / 1.5,
|
|
125
|
-
marginTop: `2%`,
|
|
126
|
-
},
|
|
127
|
-
textButtonRow: {
|
|
128
|
-
fontFamily: `Roboto-Regular`,
|
|
129
|
-
textAlign: `center`,
|
|
130
|
-
fontSize: width / 24,
|
|
131
|
-
color: `white`,
|
|
132
|
-
},
|
|
133
|
-
textFirstButtonColumn: {
|
|
134
|
-
fontFamily: `Roboto-Regular`,
|
|
135
|
-
textAlign: `center`,
|
|
136
|
-
fontSize: width / 22,
|
|
137
|
-
paddingHorizontal: 15,
|
|
138
|
-
color: `#1B1F48`,
|
|
139
|
-
fontWeight: `700`,
|
|
140
|
-
},
|
|
141
|
-
textSecondButtonColumn: {
|
|
142
|
-
fontFamily: `Roboto-Regular`,
|
|
143
|
-
textAlign: `center`,
|
|
144
|
-
fontSize: width / 26,
|
|
145
|
-
color: BORDER_COLOUR_TEAL,
|
|
146
|
-
fontWeight: `bold`,
|
|
147
|
-
},
|
|
148
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Activity as ActivityTypes, BolusCalculator } from "@hedia/types";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { IActivityDisplayProps } from "../../types/types";
|
|
4
|
-
export interface IProps extends IActivityDisplayProps {
|
|
5
|
-
/** Details about the activity that affect the calculation */
|
|
6
|
-
activity: BolusCalculator.Types.IActivityParams;
|
|
7
|
-
/** The fraction (in the interval [0; 1]) by which the insulin recommendation is being reduced due to physical activity */
|
|
8
|
-
activityReduction: ActivityTypes.Types.ReductionType;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Component for displaying a summary of the entered physical activity along with the effect it has on the insulin recommendation.
|
|
12
|
-
*/
|
|
13
|
-
export default class Activity extends React.Component<IProps> {
|
|
14
|
-
/**
|
|
15
|
-
* Steps:
|
|
16
|
-
* 1. Unpack activity, activityType, activityReduction, and activityTitle from props.
|
|
17
|
-
* 2. Compute the reductionPercentage by multiplying the activityReduction prop by 100 and rounding to the nearest integer.
|
|
18
|
-
* 3. Generate and return the JSX element to display the following on the screen:
|
|
19
|
-
* - Print the activity duration.
|
|
20
|
-
* - Display the ActivityIcon that corresponds to the type of activity.
|
|
21
|
-
* - Display the ActivityIntensity for the activity.
|
|
22
|
-
* - Print the reductionPercentage.
|
|
23
|
-
* @returns JSX Element containing all the user's physical activity details
|
|
24
|
-
*/
|
|
25
|
-
render(): JSX.Element;
|
|
26
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
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 { Testing } from "../../types/enum";
|
|
6
|
-
import { infoStyles } from "../InfoBars";
|
|
7
|
-
import ActivityIcon from "./ActivityIcon";
|
|
8
|
-
import ActivityIntensity from "./ActivityIntensity";
|
|
9
|
-
/**
|
|
10
|
-
* Component for displaying a summary of the entered physical activity along with the effect it has on the insulin recommendation.
|
|
11
|
-
*/
|
|
12
|
-
export default class Activity extends React.Component {
|
|
13
|
-
/**
|
|
14
|
-
* Steps:
|
|
15
|
-
* 1. Unpack activity, activityType, activityReduction, and activityTitle from props.
|
|
16
|
-
* 2. Compute the reductionPercentage by multiplying the activityReduction prop by 100 and rounding to the nearest integer.
|
|
17
|
-
* 3. Generate and return the JSX element to display the following on the screen:
|
|
18
|
-
* - Print the activity duration.
|
|
19
|
-
* - Display the ActivityIcon that corresponds to the type of activity.
|
|
20
|
-
* - Display the ActivityIntensity for the activity.
|
|
21
|
-
* - Print the reductionPercentage.
|
|
22
|
-
* @returns JSX Element containing all the user's physical activity details
|
|
23
|
-
*/
|
|
24
|
-
render() {
|
|
25
|
-
const { activity, activityType, activityReduction, activityTitle } = this.props;
|
|
26
|
-
const reductionPercentage = ((activityReduction ?? 0) * 100).toFixed(0);
|
|
27
|
-
return (<View style={[infoStyles.container, activityStyles.botMargin]}>
|
|
28
|
-
<View style={infoStyles.margin}>
|
|
29
|
-
<View style={infoStyles.border}>
|
|
30
|
-
<View style={infoStyles.borderContainer}>
|
|
31
|
-
<View style={infoStyles.labelContainer}>
|
|
32
|
-
<Text style={infoStyles.label}>{i18n._(t `Activity`)}</Text>
|
|
33
|
-
</View>
|
|
34
|
-
<View style={infoStyles.valueUnitContainer}>
|
|
35
|
-
<View style={infoStyles.valueContainer}>
|
|
36
|
-
<Text style={infoStyles.value}>{activity.activityDuration}</Text>
|
|
37
|
-
</View>
|
|
38
|
-
<View style={infoStyles.unitContainer}>
|
|
39
|
-
<Text style={infoStyles.units}>{i18n._(t `min`)}</Text>
|
|
40
|
-
</View>
|
|
41
|
-
</View>
|
|
42
|
-
</View>
|
|
43
|
-
<ActivityIcon activityType={activityType} activityTitle={activityTitle}/>
|
|
44
|
-
<ActivityIntensity activityIntensity={activity.activityIntensity}/>
|
|
45
|
-
<View style={[infoStyles.borderContainer, activityStyles.topMargin]}>
|
|
46
|
-
<Text style={activityStyles.infoText}>
|
|
47
|
-
{i18n._(t `Based on the selected activity your insulin recommendation is reduced by:`)}
|
|
48
|
-
</Text>
|
|
49
|
-
</View>
|
|
50
|
-
<View style={[infoStyles.borderContainer, activityStyles.verticalMargin]}>
|
|
51
|
-
<Text style={activityStyles.reductionPercentage} testID={Testing.Id.ActivityTestIds.ActivityReduction}>
|
|
52
|
-
{reductionPercentage}%
|
|
53
|
-
</Text>
|
|
54
|
-
</View>
|
|
55
|
-
</View>
|
|
56
|
-
</View>
|
|
57
|
-
</View>);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
const activityStyles = StyleSheet.create({
|
|
61
|
-
topMargin: {
|
|
62
|
-
marginTop: `2%`,
|
|
63
|
-
},
|
|
64
|
-
botMargin: {
|
|
65
|
-
marginBottom: `2%`,
|
|
66
|
-
},
|
|
67
|
-
verticalMargin: {
|
|
68
|
-
marginBottom: `2%`,
|
|
69
|
-
},
|
|
70
|
-
infoText: {
|
|
71
|
-
color: `rgba(160, 180, 240, 1)`,
|
|
72
|
-
fontSize: Dimensions.get(`screen`).width / 24,
|
|
73
|
-
},
|
|
74
|
-
reductionPercentage: {
|
|
75
|
-
color: `white`,
|
|
76
|
-
marginTop: `2%`,
|
|
77
|
-
fontSize: Dimensions.get(`screen`).width / 18,
|
|
78
|
-
fontWeight: `bold`,
|
|
79
|
-
},
|
|
80
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Activity } from "@hedia/types";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { ImageURISource } from "react-native";
|
|
4
|
-
import { IActivityDisplayProps } from "../../types/types";
|
|
5
|
-
/** Mapping from ActivityEnums to corresponding image resource. */
|
|
6
|
-
export declare const ACTIVITY_ICONS: Record<Activity.Enums.ActivityEnum, ImageURISource>;
|
|
7
|
-
/** Component used to displat the user's physical activity type icon */
|
|
8
|
-
export default class ActivityIcon extends React.Component<IActivityDisplayProps> {
|
|
9
|
-
/**
|
|
10
|
-
* @returns The value from the ACTIVITY_ICONS constant that corresponds to the value of the activityType prop.
|
|
11
|
-
*/
|
|
12
|
-
getActivityIcon: () => ImageURISource;
|
|
13
|
-
/**
|
|
14
|
-
* Steps:
|
|
15
|
-
* 1. Unpack activityType and activityTitle from props.
|
|
16
|
-
* 2. Create an accessibility label string by appending ‘_activity’ to the enum label corresponding to the activityType prop.
|
|
17
|
-
* @returns A JSX element including the following:
|
|
18
|
-
* 1. An image component with the generated accessibility label displaying the icon from getActivityIcon().
|
|
19
|
-
* 2. The activityTitle if it is truthy or the string “Untitled Activity” otherwise
|
|
20
|
-
*/
|
|
21
|
-
render(): JSX.Element | null;
|
|
22
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { Activity } from "@hedia/types";
|
|
2
|
-
import { t } from "@lingui/macro";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { Dimensions, Image, StyleSheet, Text, View } from "react-native";
|
|
5
|
-
import { i18n } from "../../locale/i18nUtils";
|
|
6
|
-
const { Other } = Activity.Enums.ActivityEnum;
|
|
7
|
-
/** Mapping from ActivityEnums to corresponding image resource. */
|
|
8
|
-
export const ACTIVITY_ICONS = {
|
|
9
|
-
Run: require(`../../assets/activity/Runner.png`),
|
|
10
|
-
Walk: require(`../../assets/activity/Walk.png`),
|
|
11
|
-
Cycling: require(`../../assets/activity/Cyclist.png`),
|
|
12
|
-
Swim: require(`../../assets/activity/Swimmer.png`),
|
|
13
|
-
Other: require(`../../assets/activity/Other.png`),
|
|
14
|
-
};
|
|
15
|
-
/** Component used to displat the user's physical activity type icon */
|
|
16
|
-
export default class ActivityIcon extends React.Component {
|
|
17
|
-
constructor() {
|
|
18
|
-
super(...arguments);
|
|
19
|
-
/**
|
|
20
|
-
* @returns The value from the ACTIVITY_ICONS constant that corresponds to the value of the activityType prop.
|
|
21
|
-
*/
|
|
22
|
-
this.getActivityIcon = () => {
|
|
23
|
-
return ACTIVITY_ICONS[this.props.activityType ?? Other];
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Steps:
|
|
28
|
-
* 1. Unpack activityType and activityTitle from props.
|
|
29
|
-
* 2. Create an accessibility label string by appending ‘_activity’ to the enum label corresponding to the activityType prop.
|
|
30
|
-
* @returns A JSX element including the following:
|
|
31
|
-
* 1. An image component with the generated accessibility label displaying the icon from getActivityIcon().
|
|
32
|
-
* 2. The activityTitle if it is truthy or the string “Untitled Activity” otherwise
|
|
33
|
-
*/
|
|
34
|
-
render() {
|
|
35
|
-
const { activityType, activityTitle } = this.props;
|
|
36
|
-
const label = `${Activity.Enums.ActivityEnum[activityType ?? Other]}_activity`;
|
|
37
|
-
return (<View style={activityIconStyles.container}>
|
|
38
|
-
<Image style={activityIconStyles.activityIcon} source={this.getActivityIcon()} accessibilityLabel={label}/>
|
|
39
|
-
<Text style={activityIconStyles.activityTitle}>{activityTitle || i18n._(t `Untitled Activity`)}</Text>
|
|
40
|
-
</View>);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
const activityIconStyles = StyleSheet.create({
|
|
44
|
-
container: {
|
|
45
|
-
flex: 1,
|
|
46
|
-
flexDirection: `row`,
|
|
47
|
-
alignItems: `center`,
|
|
48
|
-
marginTop: `1%`,
|
|
49
|
-
},
|
|
50
|
-
activityIcon: {
|
|
51
|
-
resizeMode: `contain`,
|
|
52
|
-
height: Dimensions.get(`screen`).width / 16,
|
|
53
|
-
},
|
|
54
|
-
activityTitle: {
|
|
55
|
-
color: `white`,
|
|
56
|
-
fontSize: Dimensions.get(`screen`).width / 25,
|
|
57
|
-
},
|
|
58
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { BolusCalculator } from "@hedia/types";
|
|
2
|
-
import React from "react";
|
|
3
|
-
export interface IProps {
|
|
4
|
-
/** - Indicates the intensity of the activity. */
|
|
5
|
-
activityIntensity: BolusCalculator.Types.IActivityParams["activityIntensity"];
|
|
6
|
-
}
|
|
7
|
-
/** Component used to display the users's physical activity intensity on its corresponding background color */
|
|
8
|
-
export default class ActivityIntensity extends React.Component<IProps> {
|
|
9
|
-
/**
|
|
10
|
-
* Steps:
|
|
11
|
-
* 1. Set intensity to the activityIntensity prop.
|
|
12
|
-
* 2. Set the style variable to the style that correspond to the intensity.
|
|
13
|
-
* @returns JSX element that displays the intensity of the user’s activity along with the associated color coding
|
|
14
|
-
*/
|
|
15
|
-
render: () => JSX.Element;
|
|
16
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Activity } from "@hedia/types";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { Dimensions, StyleSheet, Text, View } from "react-native";
|
|
4
|
-
import { ActivityIntensityTranslations } from "../../utils/Translations";
|
|
5
|
-
import { infoStyles } from "../InfoBars";
|
|
6
|
-
/** Component used to display the users's physical activity intensity on its corresponding background color */
|
|
7
|
-
export default class ActivityIntensity extends React.Component {
|
|
8
|
-
constructor() {
|
|
9
|
-
super(...arguments);
|
|
10
|
-
/**
|
|
11
|
-
* Steps:
|
|
12
|
-
* 1. Set intensity to the activityIntensity prop.
|
|
13
|
-
* 2. Set the style variable to the style that correspond to the intensity.
|
|
14
|
-
* @returns JSX element that displays the intensity of the user’s activity along with the associated color coding
|
|
15
|
-
*/
|
|
16
|
-
this.render = () => {
|
|
17
|
-
const intensity = this.props.activityIntensity;
|
|
18
|
-
const style = activityIntensityStyles[intensity];
|
|
19
|
-
return (<View style={[infoStyles.margin, activityIntensityStyles.row]}>
|
|
20
|
-
<View style={activityIntensityStyles.intensityContainer}>
|
|
21
|
-
<View style={[activityIntensityStyles.intensityTextContainer, style]}>
|
|
22
|
-
<Text style={activityIntensityStyles.bold}>{ActivityIntensityTranslations[intensity]()}</Text>
|
|
23
|
-
</View>
|
|
24
|
-
</View>
|
|
25
|
-
<View style={activityIntensityStyles.intensityContainerOffset}/>
|
|
26
|
-
</View>);
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
const activityIntensityStyles = StyleSheet.create({
|
|
31
|
-
row: {
|
|
32
|
-
flexDirection: `row`,
|
|
33
|
-
},
|
|
34
|
-
intensityTextContainer: {
|
|
35
|
-
alignItems: `center`,
|
|
36
|
-
justifyContent: `center`,
|
|
37
|
-
padding: `5%`,
|
|
38
|
-
borderRadius: 5,
|
|
39
|
-
},
|
|
40
|
-
[Activity.Enums.ActivityIntensity.light]: {
|
|
41
|
-
backgroundColor: `#A5D871`,
|
|
42
|
-
},
|
|
43
|
-
[Activity.Enums.ActivityIntensity.moderate]: {
|
|
44
|
-
backgroundColor: `#F9BD5A`,
|
|
45
|
-
},
|
|
46
|
-
[Activity.Enums.ActivityIntensity.hard]: {
|
|
47
|
-
backgroundColor: `#EC5466`,
|
|
48
|
-
},
|
|
49
|
-
intensityContainer: {
|
|
50
|
-
flex: 5,
|
|
51
|
-
},
|
|
52
|
-
intensityContainerOffset: {
|
|
53
|
-
flex: 16,
|
|
54
|
-
},
|
|
55
|
-
bold: {
|
|
56
|
-
fontWeight: `bold`,
|
|
57
|
-
fontSize: Dimensions.get(`screen`).width / 30,
|
|
58
|
-
},
|
|
59
|
-
});
|