@hedia/recommendation-screen 1.0.7 → 1.1.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/android/app/src/main/res/values/color.xml +3 -0
- package/android/app/src/main/res/values/styles.xml +3 -0
- package/index.ts +3 -16
- package/ios/HediaRecommendationScreen/Info.plist +80 -57
- package/ios/HediaRecommendationScreen.xcodeproj/project.pbxproj +1085 -807
- package/ios/HediaRecommendationScreen.xcworkspace/contents.xcworkspacedata +10 -0
- package/ios/HediaRecommendationScreen.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/Podfile +106 -104
- package/ios/Podfile.lock +474 -0
- package/jest.mock.js +1 -0
- package/package.json +9 -2
- package/src/RecommendationScreen.tsx +130 -60
- package/src/assets/activity/Cyclist.png +0 -0
- package/src/assets/activity/Other.png +0 -0
- package/src/assets/activity/Runner.png +0 -0
- package/src/assets/activity/Swimmer.png +0 -0
- package/src/assets/activity/Walk.png +0 -0
- package/src/components/Header.tsx +7 -14
- package/src/components/HediaRecommendationModal.tsx +231 -0
- package/src/components/InfoBars.tsx +3 -3
- package/src/components/InvisibleNumberInput.tsx +7 -7
- package/src/components/RecentInsulin.tsx +6 -5
- package/src/components/RecommendedCarbs.tsx +24 -24
- package/src/components/RecommendedInsulin.tsx +18 -15
- package/src/components/Remeasure.tsx +15 -13
- package/src/components/TransferToLogbook.tsx +6 -4
- package/src/components/activity/Activity.tsx +74 -0
- package/src/components/activity/ActivityIcon.tsx +52 -0
- package/src/components/activity/ActivityIntensity.tsx +66 -0
- package/src/components/mood/Emotion.tsx +64 -0
- package/src/components/{MoodIcon.tsx → mood/MoodIcon.tsx} +17 -17
- package/src/locale/da/messages.js +1 -1
- package/src/locale/da/messages.po +191 -49
- package/src/locale/en/messages.js +1 -1
- package/src/locale/en/messages.po +193 -51
- package/src/types/enum.ts +48 -3
- package/src/types/types.ts +21 -1
- package/src/utils/AttentionMessages.ts +59 -0
- package/src/utils/Constants.ts +20 -1
- package/src/utils/RecommendationError.ts +114 -28
- package/src/utils/RecommendationUtils.ts +128 -0
- package/src/utils/Utils.ts +13 -5
- package/src/utils/Validations.ts +210 -0
- package/App.jsx +0 -70
- package/index.d.ts +0 -5
- package/index.js +0 -16
- package/src/RecommendationScreen.d.ts +0 -43
- package/src/RecommendationScreen.jsx +0 -158
- package/src/components/Emotion.d.ts +0 -14
- package/src/components/Emotion.jsx +0 -54
- package/src/components/Emotion.tsx +0 -70
- package/src/components/Header.d.ts +0 -52
- package/src/components/Header.jsx +0 -82
- package/src/components/InfoBars.d.ts +0 -67
- package/src/components/InfoBars.jsx +0 -90
- package/src/components/InvisibleNumberInput.d.ts +0 -24
- package/src/components/InvisibleNumberInput.jsx +0 -64
- package/src/components/MoodIcon.d.ts +0 -14
- package/src/components/MoodIcon.jsx +0 -53
- package/src/components/RecentInsulin.d.ts +0 -9
- package/src/components/RecentInsulin.jsx +0 -90
- package/src/components/RecommendedCarbs.d.ts +0 -30
- package/src/components/RecommendedCarbs.jsx +0 -193
- package/src/components/RecommendedInsulin.d.ts +0 -22
- package/src/components/RecommendedInsulin.jsx +0 -109
- package/src/components/Remeasure.d.ts +0 -13
- package/src/components/Remeasure.jsx +0 -88
- package/src/components/TransferToLogbook.d.ts +0 -14
- package/src/components/TransferToLogbook.jsx +0 -80
- package/src/locale/i18nUtils.d.ts +0 -5
- package/src/locale/i18nUtils.js +0 -22
- package/src/types/enum.d.ts +0 -34
- package/src/types/enum.js +0 -43
- package/src/types/types.d.ts +0 -21
- package/src/types/types.js +0 -2
- package/src/utils/Constants.d.ts +0 -3
- package/src/utils/Constants.js +0 -6
- package/src/utils/RecommendationError.d.ts +0 -11
- package/src/utils/RecommendationError.js +0 -18
- package/src/utils/Utils.d.ts +0 -5
- package/src/utils/Utils.js +0 -24
- /package/src/assets/{happy.png → mood/happy.png} +0 -0
- /package/src/assets/{happy_active.png → mood/happy_active.png} +0 -0
- /package/src/assets/{neutral.png → mood/neutral.png} +0 -0
- /package/src/assets/{neutral_active.png → mood/neutral_active.png} +0 -0
- /package/src/assets/{sad.png → mood/sad.png} +0 -0
- /package/src/assets/{sad_active.png → mood/sad_active.png} +0 -0
- /package/src/assets/{semi_happy.png → mood/semi_happy.png} +0 -0
- /package/src/assets/{semi_happy_active.png → mood/semi_happy_active.png} +0 -0
- /package/src/assets/{semi_sad.png → mood/semi_sad.png} +0 -0
- /package/src/assets/{semi_sad_active.png → mood/semi_sad_active.png} +0 -0
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const react_native_1 = require("react-native");
|
|
8
|
-
const i18nUtils_1 = require("../locale/i18nUtils");
|
|
9
|
-
const 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
|
-
});
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Dimensions, Image, StyleSheet, Text, View } from "react-native";
|
|
3
|
-
import { i18n } from "../locale/i18nUtils";
|
|
4
|
-
import { MoodEnum } from "../types/enum";
|
|
5
|
-
import MoodIcon from "./MoodIcon";
|
|
6
|
-
|
|
7
|
-
interface IProps {
|
|
8
|
-
moodSelected(mood: MoodEnum | 0): void;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
type value = keyof typeof MoodEnum;
|
|
12
|
-
|
|
13
|
-
interface IState {
|
|
14
|
-
selected: MoodEnum | 0;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export default class Emotion extends React.Component<IProps, IState> {
|
|
18
|
-
public state: IState = {
|
|
19
|
-
selected: 0,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
public handleIconPress = (selected: number, toggle: boolean) => {
|
|
23
|
-
const select = toggle ? selected : 0;
|
|
24
|
-
this.setState({
|
|
25
|
-
selected: select,
|
|
26
|
-
});
|
|
27
|
-
this.props.moodSelected(select);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
public render() {
|
|
31
|
-
const values = Object.values(MoodEnum).filter((val) => isNaN(Number(val))) as Array<value>;
|
|
32
|
-
|
|
33
|
-
const mapped = values.map((key) => {
|
|
34
|
-
const moodValue = MoodEnum[key];
|
|
35
|
-
return (
|
|
36
|
-
<MoodIcon
|
|
37
|
-
onPress={(toggle) => this.handleIconPress(moodValue, toggle)}
|
|
38
|
-
active={moodValue === this.state.selected}
|
|
39
|
-
mood={moodValue}
|
|
40
|
-
key={moodValue}
|
|
41
|
-
/>
|
|
42
|
-
);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<View style={emotionStyles.container}>
|
|
47
|
-
<View style={emotionStyles.feelingContainer}>
|
|
48
|
-
<Text style={emotionStyles.feelingText}>{i18n._("How are you feeling?")}</Text>
|
|
49
|
-
</View>
|
|
50
|
-
<View style={emotionStyles.moodIconContainer}>{mapped}</View>
|
|
51
|
-
</View>
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const emotionStyles = StyleSheet.create({
|
|
57
|
-
container: {
|
|
58
|
-
flex: 1,
|
|
59
|
-
},
|
|
60
|
-
feelingContainer: {
|
|
61
|
-
marginVertical: `3%`,
|
|
62
|
-
},
|
|
63
|
-
feelingText: {
|
|
64
|
-
textAlign: `center`,
|
|
65
|
-
color: `white`,
|
|
66
|
-
fontWeight: `bold`,
|
|
67
|
-
fontSize: Dimensions.get(`screen`).width / 26,
|
|
68
|
-
},
|
|
69
|
-
moodIconContainer: { flex: 1, flexDirection: `row`, justifyContent: `center` },
|
|
70
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
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
|
-
});
|
|
@@ -1,67 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
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
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { TextInput } from "react-native";
|
|
3
|
-
interface IProps {
|
|
4
|
-
startValue?: string;
|
|
5
|
-
decimalPlaces: number;
|
|
6
|
-
cleanPartialInput: boolean;
|
|
7
|
-
negativeAllowed: boolean;
|
|
8
|
-
visible(toggle: () => void): void;
|
|
9
|
-
onEnd?(value: number): void;
|
|
10
|
-
partialInput?(value: string): void;
|
|
11
|
-
}
|
|
12
|
-
interface IState {
|
|
13
|
-
value: string;
|
|
14
|
-
}
|
|
15
|
-
export default class InvisibleNumberInput extends React.Component<IProps, IState> {
|
|
16
|
-
textInput: TextInput;
|
|
17
|
-
state: IState;
|
|
18
|
-
componentDidMount(): void;
|
|
19
|
-
cleanInput: (text: string) => string;
|
|
20
|
-
handleOnChangeText: (text: string) => void;
|
|
21
|
-
onEndEdit: () => void;
|
|
22
|
-
render(): JSX.Element;
|
|
23
|
-
}
|
|
24
|
-
export {};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const react_native_1 = require("react-native");
|
|
8
|
-
class InvisibleNumberInput extends react_1.default.Component {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(...arguments);
|
|
11
|
-
this.state = {
|
|
12
|
-
value: `0`,
|
|
13
|
-
};
|
|
14
|
-
this.cleanInput = (text) => {
|
|
15
|
-
const replaced = text.replace(/\,/g, `.`).replace(/(\d*\.\d*).*/, `$1`);
|
|
16
|
-
const round = (value) => {
|
|
17
|
-
const temp = Number(value) * Math.pow(10, this.props.decimalPlaces);
|
|
18
|
-
const rounded = Math.round(temp) / Math.pow(10, this.props.decimalPlaces);
|
|
19
|
-
if (this.props.negativeAllowed) {
|
|
20
|
-
return rounded.toFixed(this.props.decimalPlaces);
|
|
21
|
-
}
|
|
22
|
-
return Math.abs(rounded).toFixed(this.props.decimalPlaces);
|
|
23
|
-
};
|
|
24
|
-
if (!isNaN(Number(replaced))) {
|
|
25
|
-
return round(replaced);
|
|
26
|
-
}
|
|
27
|
-
return `0`;
|
|
28
|
-
};
|
|
29
|
-
this.handleOnChangeText = (text) => {
|
|
30
|
-
const cleaned = this.props.cleanPartialInput ? this.cleanInput(text) : text.replace(/\,/g, `.`);
|
|
31
|
-
const replacedSeperator = cleaned.replace(/\.+/g, `.`);
|
|
32
|
-
this.setState({
|
|
33
|
-
value: `${replacedSeperator}`,
|
|
34
|
-
});
|
|
35
|
-
this.props.partialInput?.(`${replacedSeperator}`);
|
|
36
|
-
};
|
|
37
|
-
this.onEndEdit = () => {
|
|
38
|
-
const cleaned = this.cleanInput(this.state.value);
|
|
39
|
-
this.props.onEnd?.(Number(cleaned));
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
componentDidMount() {
|
|
43
|
-
this.setState({
|
|
44
|
-
value: this.props.startValue ?? `0`,
|
|
45
|
-
});
|
|
46
|
-
this.props.visible(() => {
|
|
47
|
-
this.setState({
|
|
48
|
-
value: this.props.startValue ?? `0`,
|
|
49
|
-
});
|
|
50
|
-
return this.textInput.focus();
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
render() {
|
|
54
|
-
return (<react_native_1.TextInput accessibilityLabel="InvisibleNumberInput" value={`${this.state.value}`} ref={(textInput) => (this.textInput = textInput)} style={inputStyles.textInput} keyboardType="numeric" onChangeText={this.handleOnChangeText} onEndEditing={this.onEndEdit}/>);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
exports.default = InvisibleNumberInput;
|
|
58
|
-
const inputStyles = react_native_1.StyleSheet.create({
|
|
59
|
-
textInput: {
|
|
60
|
-
width: 0,
|
|
61
|
-
height: 0,
|
|
62
|
-
padding: 0.2,
|
|
63
|
-
},
|
|
64
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const react_native_1 = require("react-native");
|
|
8
|
-
const 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
|
-
});
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const react_native_1 = require("react-native");
|
|
8
|
-
const i18nUtils_1 = require("../locale/i18nUtils");
|
|
9
|
-
const 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
|
-
});
|