@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.
Files changed (91) hide show
  1. package/android/app/src/main/res/values/color.xml +3 -0
  2. package/android/app/src/main/res/values/styles.xml +3 -0
  3. package/index.ts +3 -16
  4. package/ios/HediaRecommendationScreen/Info.plist +80 -57
  5. package/ios/HediaRecommendationScreen.xcodeproj/project.pbxproj +1085 -807
  6. package/ios/HediaRecommendationScreen.xcworkspace/contents.xcworkspacedata +10 -0
  7. package/ios/HediaRecommendationScreen.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  8. package/ios/Podfile +106 -104
  9. package/ios/Podfile.lock +474 -0
  10. package/jest.mock.js +1 -0
  11. package/package.json +9 -2
  12. package/src/RecommendationScreen.tsx +130 -60
  13. package/src/assets/activity/Cyclist.png +0 -0
  14. package/src/assets/activity/Other.png +0 -0
  15. package/src/assets/activity/Runner.png +0 -0
  16. package/src/assets/activity/Swimmer.png +0 -0
  17. package/src/assets/activity/Walk.png +0 -0
  18. package/src/components/Header.tsx +7 -14
  19. package/src/components/HediaRecommendationModal.tsx +231 -0
  20. package/src/components/InfoBars.tsx +3 -3
  21. package/src/components/InvisibleNumberInput.tsx +7 -7
  22. package/src/components/RecentInsulin.tsx +6 -5
  23. package/src/components/RecommendedCarbs.tsx +24 -24
  24. package/src/components/RecommendedInsulin.tsx +18 -15
  25. package/src/components/Remeasure.tsx +15 -13
  26. package/src/components/TransferToLogbook.tsx +6 -4
  27. package/src/components/activity/Activity.tsx +74 -0
  28. package/src/components/activity/ActivityIcon.tsx +52 -0
  29. package/src/components/activity/ActivityIntensity.tsx +66 -0
  30. package/src/components/mood/Emotion.tsx +64 -0
  31. package/src/components/{MoodIcon.tsx → mood/MoodIcon.tsx} +17 -17
  32. package/src/locale/da/messages.js +1 -1
  33. package/src/locale/da/messages.po +191 -49
  34. package/src/locale/en/messages.js +1 -1
  35. package/src/locale/en/messages.po +193 -51
  36. package/src/types/enum.ts +48 -3
  37. package/src/types/types.ts +21 -1
  38. package/src/utils/AttentionMessages.ts +59 -0
  39. package/src/utils/Constants.ts +20 -1
  40. package/src/utils/RecommendationError.ts +114 -28
  41. package/src/utils/RecommendationUtils.ts +128 -0
  42. package/src/utils/Utils.ts +13 -5
  43. package/src/utils/Validations.ts +210 -0
  44. package/App.jsx +0 -70
  45. package/index.d.ts +0 -5
  46. package/index.js +0 -16
  47. package/src/RecommendationScreen.d.ts +0 -43
  48. package/src/RecommendationScreen.jsx +0 -158
  49. package/src/components/Emotion.d.ts +0 -14
  50. package/src/components/Emotion.jsx +0 -54
  51. package/src/components/Emotion.tsx +0 -70
  52. package/src/components/Header.d.ts +0 -52
  53. package/src/components/Header.jsx +0 -82
  54. package/src/components/InfoBars.d.ts +0 -67
  55. package/src/components/InfoBars.jsx +0 -90
  56. package/src/components/InvisibleNumberInput.d.ts +0 -24
  57. package/src/components/InvisibleNumberInput.jsx +0 -64
  58. package/src/components/MoodIcon.d.ts +0 -14
  59. package/src/components/MoodIcon.jsx +0 -53
  60. package/src/components/RecentInsulin.d.ts +0 -9
  61. package/src/components/RecentInsulin.jsx +0 -90
  62. package/src/components/RecommendedCarbs.d.ts +0 -30
  63. package/src/components/RecommendedCarbs.jsx +0 -193
  64. package/src/components/RecommendedInsulin.d.ts +0 -22
  65. package/src/components/RecommendedInsulin.jsx +0 -109
  66. package/src/components/Remeasure.d.ts +0 -13
  67. package/src/components/Remeasure.jsx +0 -88
  68. package/src/components/TransferToLogbook.d.ts +0 -14
  69. package/src/components/TransferToLogbook.jsx +0 -80
  70. package/src/locale/i18nUtils.d.ts +0 -5
  71. package/src/locale/i18nUtils.js +0 -22
  72. package/src/types/enum.d.ts +0 -34
  73. package/src/types/enum.js +0 -43
  74. package/src/types/types.d.ts +0 -21
  75. package/src/types/types.js +0 -2
  76. package/src/utils/Constants.d.ts +0 -3
  77. package/src/utils/Constants.js +0 -6
  78. package/src/utils/RecommendationError.d.ts +0 -11
  79. package/src/utils/RecommendationError.js +0 -18
  80. package/src/utils/Utils.d.ts +0 -5
  81. package/src/utils/Utils.js +0 -24
  82. /package/src/assets/{happy.png → mood/happy.png} +0 -0
  83. /package/src/assets/{happy_active.png → mood/happy_active.png} +0 -0
  84. /package/src/assets/{neutral.png → mood/neutral.png} +0 -0
  85. /package/src/assets/{neutral_active.png → mood/neutral_active.png} +0 -0
  86. /package/src/assets/{sad.png → mood/sad.png} +0 -0
  87. /package/src/assets/{sad_active.png → mood/sad_active.png} +0 -0
  88. /package/src/assets/{semi_happy.png → mood/semi_happy.png} +0 -0
  89. /package/src/assets/{semi_happy_active.png → mood/semi_happy_active.png} +0 -0
  90. /package/src/assets/{semi_sad.png → mood/semi_sad.png} +0 -0
  91. /package/src/assets/{semi_sad_active.png → mood/semi_sad_active.png} +0 -0
@@ -1,30 +0,0 @@
1
- import React from "react";
2
- import { RecommendationError } from "../utils/RecommendationError";
3
- interface ICalculationRow {
4
- label: string;
5
- info: string;
6
- value: string;
7
- units: string;
8
- }
9
- interface IProps {
10
- recommendedCarbs?: string;
11
- enteredCarbs: string;
12
- removeRecommendedCarbs(): void;
13
- changedRecommendedCarbs(value: number): void;
14
- onError(error: RecommendationError): void;
15
- }
16
- interface IState {
17
- remeasureTime: number;
18
- partialInput: string;
19
- }
20
- export default class RecommendedCarbs extends React.Component<IProps, IState> {
21
- state: IState;
22
- callbackInput: () => void;
23
- showTextInput: () => void;
24
- handlePartialInput: (partialInput: string) => void;
25
- handleChangedCarbs: (carbs: number) => void;
26
- renderRecommendedCarbs: () => JSX.Element;
27
- renderRow: (row: ICalculationRow) => JSX.Element;
28
- render(): JSX.Element;
29
- }
30
- export {};
@@ -1,193 +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 Constants_1 = require("../utils/Constants");
10
- const RecommendationError_1 = require("../utils/RecommendationError");
11
- const Icon_1 = __importDefault(require("./Icon"));
12
- const InfoBars_1 = require("./InfoBars");
13
- const InvisibleNumberInput_1 = __importDefault(require("./InvisibleNumberInput"));
14
- class RecommendedCarbs extends react_1.default.Component {
15
- constructor() {
16
- super(...arguments);
17
- this.state = {
18
- remeasureTime: 1.5,
19
- partialInput: null,
20
- };
21
- this.showTextInput = () => {
22
- this.callbackInput?.();
23
- };
24
- this.handlePartialInput = (partialInput) => {
25
- this.setState({
26
- partialInput,
27
- });
28
- };
29
- this.handleChangedCarbs = (carbs) => {
30
- if (carbs >= 0) {
31
- if (carbs > 300) {
32
- return this.props.onError(RecommendationError_1.CarbohydrateLimitError);
33
- }
34
- this.props.changedRecommendedCarbs(carbs);
35
- }
36
- };
37
- this.renderRecommendedCarbs = () => {
38
- const shownCarbs = this.state.partialInput ?? Math.round(Number(this.props.recommendedCarbs));
39
- return (<react_1.default.Fragment>
40
- <react_native_1.View style={calculationStyles.borderContainer}>
41
- <react_native_1.View style={calculationStyles.recommendedContainer}>
42
- <react_native_1.TouchableOpacity accessibilityLabel="removeRecommendedCarbs" style={calculationStyles.removeRecommended} onPress={this.props.removeRecommendedCarbs}>
43
- <Icon_1.default iconIdentifier={`Ionicons/ios-close-circle-outline`} style={calculationStyles.removeRecommendedIcon}/>
44
- </react_native_1.TouchableOpacity>
45
- <react_native_1.Text style={calculationStyles.recommendedLabel}>{i18nUtils_1.i18n._("Recommended")}</react_native_1.Text>
46
- </react_native_1.View>
47
- <react_native_1.View style={calculationStyles.additionalContainer}>
48
- <react_native_1.Text style={calculationStyles.additional}>{i18nUtils_1.i18n._("Additional")}</react_native_1.Text>
49
- </react_native_1.View>
50
- <react_native_1.View style={{ flex: calculationStyles.valueUnitContainer[`flex`] }}>
51
- <react_native_1.TouchableOpacity accessibilityLabel="editRecommendedCarbsButton" onPress={this.showTextInput} style={[calculationStyles.valueUnitContainer, calculationStyles.recommendedBorder]}>
52
- <react_native_1.View style={calculationStyles.valueContainer}>
53
- <react_native_1.Text style={[calculationStyles.value, { color: Constants_1.BORDER_COLOUR_TEAL }]}>
54
- +{shownCarbs}
55
- </react_native_1.Text>
56
- </react_native_1.View>
57
- <react_native_1.View style={[calculationStyles.unitContainer]}>
58
- <react_native_1.View style={calculationStyles.editIconContainer}>
59
- <Icon_1.default style={calculationStyles.editIcon} iconIdentifier={`Feather/edit`}/>
60
- </react_native_1.View>
61
- <react_native_1.Text style={[calculationStyles.units, { color: Constants_1.BORDER_COLOUR_TEAL }]}>
62
- {i18nUtils_1.i18n._("g carbs")}
63
- </react_native_1.Text>
64
- </react_native_1.View>
65
- </react_native_1.TouchableOpacity>
66
- </react_native_1.View>
67
- </react_native_1.View>
68
- {this.renderRow({
69
- label: ``,
70
- info: i18nUtils_1.i18n._("Total"),
71
- value: `0`,
72
- units: i18nUtils_1.i18n._("g carbs"),
73
- })}
74
- <InvisibleNumberInput_1.default negativeAllowed={false} cleanPartialInput={true} decimalPlaces={0} visible={(callback) => (this.callbackInput = callback)} partialInput={this.handlePartialInput} onEnd={(val) => {
75
- this.handleChangedCarbs(val);
76
- }} startValue={this.props.recommendedCarbs}/>
77
- </react_1.default.Fragment>);
78
- };
79
- this.renderRow = (row) => {
80
- return (<react_native_1.View style={calculationStyles.borderContainer}>
81
- <react_native_1.View style={calculationStyles.foodContainer}>
82
- <react_native_1.Text style={calculationStyles.foodLabel}>{row.label}</react_native_1.Text>
83
- </react_native_1.View>
84
- <react_native_1.View style={calculationStyles.enteredContainer}>
85
- <react_native_1.Text style={calculationStyles.entered}>{row.info}</react_native_1.Text>
86
- </react_native_1.View>
87
- <react_native_1.View style={calculationStyles.valueUnitContainer}>
88
- <react_native_1.View style={calculationStyles.valueContainer}>
89
- <react_native_1.Text style={calculationStyles.value}>{row.value}</react_native_1.Text>
90
- </react_native_1.View>
91
- <react_native_1.View style={calculationStyles.unitContainer}>
92
- <react_native_1.Text style={calculationStyles.units}>{row.units}</react_native_1.Text>
93
- </react_native_1.View>
94
- </react_native_1.View>
95
- </react_native_1.View>);
96
- };
97
- }
98
- render() {
99
- const carbs = Number(this.props.recommendedCarbs);
100
- return (<react_1.default.Fragment>
101
- {this.renderRow({
102
- label: i18nUtils_1.i18n._("Food"),
103
- info: i18nUtils_1.i18n._("Entered"),
104
- value: this.props.enteredCarbs,
105
- units: i18nUtils_1.i18n._("g carbs"),
106
- })}
107
- {!isNaN(carbs) && carbs > 0 ? this.renderRecommendedCarbs() : null}
108
- </react_1.default.Fragment>);
109
- }
110
- }
111
- exports.default = RecommendedCarbs;
112
- const calculationStyles = react_native_1.StyleSheet.create({
113
- borderContainer: {
114
- ...InfoBars_1.infoStyles.borderContainer,
115
- alignItems: `center`,
116
- },
117
- foodContainer: {
118
- flex: 4,
119
- },
120
- foodLabel: {
121
- color: `white`,
122
- fontSize: react_native_1.Dimensions.get(`screen`).width / 22,
123
- fontWeight: `bold`,
124
- },
125
- enteredContainer: {
126
- flex: 3,
127
- alignItems: `flex-end`,
128
- },
129
- entered: {
130
- color: `white`,
131
- fontSize: react_native_1.Dimensions.get(`screen`).width / 23,
132
- },
133
- valueUnitContainer: {
134
- ...InfoBars_1.infoStyles.valueUnitContainer,
135
- },
136
- valueContainer: {
137
- ...InfoBars_1.infoStyles.valueContainer,
138
- },
139
- value: {
140
- ...InfoBars_1.infoStyles.value,
141
- },
142
- unitContainer: {
143
- ...InfoBars_1.infoStyles.unitContainer,
144
- },
145
- units: {
146
- ...InfoBars_1.infoStyles.units,
147
- },
148
- editIconContainer: {
149
- justifyContent: `flex-end`,
150
- flexDirection: `row`,
151
- paddingRight: `5%`,
152
- },
153
- editIcon: {
154
- color: Constants_1.BORDER_COLOUR_TEAL,
155
- fontSize: react_native_1.Dimensions.get(`screen`).width / 30,
156
- },
157
- recommendedContainer: {
158
- flex: 4,
159
- flexDirection: `row`,
160
- },
161
- recommendedLabel: {
162
- color: Constants_1.BORDER_COLOUR_TEAL,
163
- fontSize: react_native_1.Dimensions.get(`screen`).width / 27,
164
- fontWeight: `bold`,
165
- },
166
- removeRecommended: {
167
- justifyContent: `center`,
168
- padding: `1%`,
169
- marginRight: `2%`,
170
- marginTop: `1%`,
171
- },
172
- removeRecommendedIcon: {
173
- color: Constants_1.BORDER_COLOUR_TEAL,
174
- fontSize: react_native_1.Dimensions.get(`screen`).width / 26,
175
- },
176
- additionalContainer: {
177
- flex: 3,
178
- alignItems: `flex-end`,
179
- },
180
- additional: {
181
- color: Constants_1.BORDER_COLOUR_TEAL,
182
- fontSize: react_native_1.Dimensions.get(`screen`).width / 27,
183
- },
184
- recommendedBorder: {
185
- borderWidth: 2,
186
- borderColor: Constants_1.BORDER_COLOUR_TEAL,
187
- borderRadius: 5,
188
- paddingBottom: `2%`,
189
- marginLeft: `10%`,
190
- paddingRight: `3%`,
191
- marginRight: `7%`,
192
- },
193
- });
@@ -1,22 +0,0 @@
1
- import React from "react";
2
- import { InjectionMethod } from "../types/enum";
3
- import { RecommendationError } from "../utils/RecommendationError";
4
- interface IProps {
5
- insulinRecommendation?: number;
6
- activityReduction?: number;
7
- injectionMethod: InjectionMethod;
8
- updateRecommendedInsulin(value: number): void;
9
- onError(error: RecommendationError): void;
10
- }
11
- interface IState {
12
- insulin: string;
13
- }
14
- export default class RecommendedInsulin extends React.Component<IProps, IState> {
15
- callbackInput: () => void;
16
- constructor(props: IProps);
17
- handleOnPress: () => void;
18
- updatePartially: (insulin: string) => string;
19
- handleUpdatedInsulin: (value: number) => void;
20
- render: () => JSX.Element;
21
- }
22
- export {};
@@ -1,109 +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 react_native_linear_gradient_1 = __importDefault(require("react-native-linear-gradient"));
9
- const i18nUtils_1 = require("../locale/i18nUtils");
10
- const RecommendationError_1 = require("../utils/RecommendationError");
11
- const Utils_1 = require("../utils/Utils");
12
- const Icon_1 = __importDefault(require("./Icon"));
13
- const InfoBars_1 = require("./InfoBars");
14
- const InvisibleNumberInput_1 = __importDefault(require("./InvisibleNumberInput"));
15
- class RecommendedInsulin extends react_1.default.Component {
16
- constructor(props) {
17
- super(props);
18
- this.handleOnPress = () => {
19
- this.callbackInput?.();
20
- };
21
- this.updatePartially = (insulin) => {
22
- const replacedZero = insulin.length > 1 && insulin.startsWith(`0`) && !insulin.startsWith(`0.`) ? insulin.substring(1) : insulin;
23
- this.setState({
24
- insulin: replacedZero,
25
- });
26
- return replacedZero;
27
- };
28
- this.handleUpdatedInsulin = (value) => {
29
- const rounded = Utils_1.Utils.roundValue(value, this.props.injectionMethod);
30
- // https://hedia.atlassian.net/browse/HDA-795
31
- const limited = (1 - this.props.activityReduction) * 50;
32
- if (rounded > limited) {
33
- this.updatePartially(`${limited}`);
34
- return this.props.onError(RecommendationError_1.InsulinLimitError);
35
- }
36
- this.updatePartially(`${rounded}`);
37
- this.props.updateRecommendedInsulin(rounded);
38
- };
39
- this.render = () => {
40
- return (<react_1.default.Fragment>
41
- <react_native_1.TouchableOpacity accessibilityLabel="editRecommendedInsulin" onPress={this.handleOnPress}>
42
- <react_native_linear_gradient_1.default style={recommendedInsulinStyles.container} colors={[`#a200ff`, `#578aff`]} start={{ x: 0, y: 0 }} end={{ x: 1, y: 0 }}>
43
- <react_native_1.View style={recommendedInsulinStyles.recommendedTextContainer}>
44
- <react_native_1.Text style={recommendedInsulinStyles.recommendedText}>
45
- {i18nUtils_1.i18n._("Recommended amount of insulin")}
46
- </react_native_1.Text>
47
- </react_native_1.View>
48
- <react_native_1.View style={recommendedInsulinStyles.recommendedContainer}>
49
- <react_native_1.View style={recommendedInsulinStyles.valueContainer}>
50
- <react_native_1.Text style={recommendedInsulinStyles.value}>{this.state.insulin}</react_native_1.Text>
51
- <react_native_1.Text style={recommendedInsulinStyles.units}>{i18nUtils_1.i18n._("Units")}</react_native_1.Text>
52
- </react_native_1.View>
53
- <Icon_1.default style={recommendedInsulinStyles.editIcon} iconIdentifier={`Feather/edit`}/>
54
- </react_native_1.View>
55
- </react_native_linear_gradient_1.default>
56
- </react_native_1.TouchableOpacity>
57
- <InvisibleNumberInput_1.default decimalPlaces={3} negativeAllowed={false} cleanPartialInput={false} partialInput={this.updatePartially} onEnd={this.handleUpdatedInsulin} visible={(visible) => (this.callbackInput = visible)} startValue={`${this.state.insulin}`}/>
58
- </react_1.default.Fragment>);
59
- };
60
- this.state = {
61
- insulin: `${props.insulinRecommendation ?? 0}`,
62
- };
63
- }
64
- }
65
- exports.default = RecommendedInsulin;
66
- const recommendedInsulinStyles = react_native_1.StyleSheet.create({
67
- container: {
68
- marginHorizontal: InfoBars_1.infoStyles.margin.margin,
69
- borderRadius: 5,
70
- },
71
- recommendedTextContainer: {
72
- flex: 1,
73
- alignItems: `center`,
74
- marginTop: `3%`,
75
- },
76
- recommendedText: {
77
- color: `white`,
78
- fontWeight: `bold`,
79
- fontSize: react_native_1.Dimensions.get(`screen`).width / 24,
80
- },
81
- recommendedContainer: {
82
- flex: 1,
83
- flexDirection: `row`,
84
- marginLeft: `10%`,
85
- },
86
- valueContainer: {
87
- flex: 1,
88
- flexDirection: `row`,
89
- justifyContent: `center`,
90
- },
91
- value: {
92
- color: `white`,
93
- fontWeight: `bold`,
94
- fontSize: react_native_1.Dimensions.get(`screen`).width / 5,
95
- },
96
- units: {
97
- color: `white`,
98
- fontSize: react_native_1.Dimensions.get(`screen`).width / 28,
99
- textAlignVertical: `bottom`,
100
- paddingBottom: `6%`,
101
- },
102
- editIcon: {
103
- color: `white`,
104
- fontSize: react_native_1.Dimensions.get(`screen`).width / 28,
105
- textAlignVertical: `center`,
106
- paddingBottom: `10%`,
107
- marginRight: `5%`,
108
- },
109
- });
@@ -1,13 +0,0 @@
1
- import React from "react";
2
- interface IProps {
3
- remeasureTime: number;
4
- onSliderChange(value: number): void;
5
- }
6
- export default class Remeasure extends React.Component<IProps, null> {
7
- private slider;
8
- componentDidMount(): void;
9
- handleSliderChange: (remeasureTime: number) => void;
10
- limitTime: (remeasureTime: number) => number;
11
- render(): JSX.Element;
12
- }
13
- export {};
@@ -1,88 +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 slider_1 = __importDefault(require("@react-native-community/slider"));
7
- const react_1 = __importDefault(require("react"));
8
- const react_native_1 = require("react-native");
9
- const i18nUtils_1 = require("../locale/i18nUtils");
10
- const Constants_1 = require("../utils/Constants");
11
- const InfoBars_1 = require("./InfoBars");
12
- class Remeasure extends react_1.default.Component {
13
- constructor() {
14
- super(...arguments);
15
- this.handleSliderChange = (remeasureTime) => {
16
- const limited = this.limitTime(remeasureTime);
17
- this.setState({
18
- remeasureTime: limited,
19
- });
20
- this.props.onSliderChange(limited);
21
- };
22
- this.limitTime = (remeasureTime) => {
23
- return Math.min(Math.max(0, remeasureTime), 4);
24
- };
25
- }
26
- componentDidMount() {
27
- this.slider.setNativeProps({
28
- value: this.props.remeasureTime,
29
- });
30
- }
31
- render() {
32
- const measure = this.props.remeasureTime > 0;
33
- const limited = this.limitTime(this.props.remeasureTime);
34
- return (<react_native_1.View style={remeasureStyles.container}>
35
- <react_native_1.View style={remeasureStyles.borderContainer}>
36
- <react_native_1.View style={remeasureStyles.remeasureContainer}>
37
- <react_native_1.Text style={remeasureStyles.remeasureLabel}>{i18nUtils_1.i18n._("Remind me to remeasure in")}</react_native_1.Text>
38
- </react_native_1.View>
39
- <react_native_1.View style={remeasureStyles.valueUnitContainer}>
40
- <react_native_1.View style={remeasureStyles.valueContainer}>
41
- <react_native_1.Text style={remeasureStyles.value}>{measure ? limited : i18nUtils_1.i18n._("OFF")}</react_native_1.Text>
42
- </react_native_1.View>
43
- <react_native_1.View style={remeasureStyles.unitContainer}>
44
- <react_native_1.Text style={remeasureStyles.units}>{measure ? i18nUtils_1.i18n._("hours") : ``}</react_native_1.Text>
45
- </react_native_1.View>
46
- </react_native_1.View>
47
- </react_native_1.View>
48
- <slider_1.default ref={(slider) => (this.slider = slider)} accessibilityLabel="remeasureSlider" maximumTrackTintColor={Constants_1.BORDER_COLOUR_TEAL} minimumTrackTintColor={Constants_1.BORDER_COLOUR_TEAL} thumbTintColor={Constants_1.BORDER_COLOUR_TEAL} maximumValue={4} minimumValue={0} step={0.5} style={remeasureStyles.sliderStyle} onValueChange={this.handleSliderChange}></slider_1.default>
49
- </react_native_1.View>);
50
- }
51
- }
52
- exports.default = Remeasure;
53
- const remeasureStyles = react_native_1.StyleSheet.create({
54
- container: {
55
- flexDirection: `column`,
56
- },
57
- borderContainer: {
58
- ...InfoBars_1.infoStyles.borderContainer,
59
- alignItems: `center`,
60
- },
61
- remeasureContainer: {
62
- flex: 7,
63
- },
64
- remeasureLabel: {
65
- color: `white`,
66
- fontSize: react_native_1.Dimensions.get(`screen`).width / 25,
67
- fontWeight: `bold`,
68
- },
69
- valueUnitContainer: {
70
- ...InfoBars_1.infoStyles.valueUnitContainer,
71
- },
72
- valueContainer: {
73
- ...InfoBars_1.infoStyles.valueContainer,
74
- },
75
- value: {
76
- ...InfoBars_1.infoStyles.value,
77
- },
78
- unitContainer: {
79
- ...InfoBars_1.infoStyles.unitContainer,
80
- },
81
- units: {
82
- ...InfoBars_1.infoStyles.units,
83
- },
84
- sliderStyle: {
85
- marginTop: `3%`,
86
- marginBottom: `2%`,
87
- },
88
- });
@@ -1,14 +0,0 @@
1
- import React from "react";
2
- interface IProps {
3
- visible: boolean;
4
- transfer(): void;
5
- }
6
- interface IState {
7
- pressed: boolean;
8
- }
9
- export default class TransferToLogbook extends React.Component<IProps, IState> {
10
- state: IState;
11
- handlePress: () => void;
12
- render(): JSX.Element;
13
- }
14
- export {};
@@ -1,80 +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 Icon_1 = __importDefault(require("./Icon"));
10
- class TransferToLogbook extends react_1.default.Component {
11
- constructor() {
12
- super(...arguments);
13
- this.state = {
14
- pressed: false,
15
- };
16
- this.handlePress = () => {
17
- this.setState({
18
- pressed: !this.state.pressed,
19
- });
20
- this.props.transfer();
21
- };
22
- }
23
- render() {
24
- if (!this.props.visible) {
25
- return <react_native_1.View style={addToLogbookStyles.marginContainer}/>;
26
- }
27
- return (<react_native_1.TouchableOpacity onPress={this.handlePress} style={addToLogbookStyles.container} accessibilityLabel="transferToLogbook">
28
- {!this.state.pressed ? (<react_native_1.View style={addToLogbookStyles.textContainer}>
29
- <react_native_1.Text style={addToLogbookStyles.transferText}>{i18nUtils_1.i18n._("Transfer to logbook")}</react_native_1.Text>
30
- </react_native_1.View>) : (<react_native_1.View style={addToLogbookStyles.textContainerActive}>
31
- <Icon_1.default style={addToLogbookStyles.icon} iconIdentifier={`Feather/check`}/>
32
- <react_native_1.Text style={addToLogbookStyles.transferTextActive}>{i18nUtils_1.i18n._("Transfered to logbook")}</react_native_1.Text>
33
- </react_native_1.View>)}
34
- </react_native_1.TouchableOpacity>);
35
- }
36
- }
37
- exports.default = TransferToLogbook;
38
- const addToLogbookStyles = react_native_1.StyleSheet.create({
39
- marginContainer: {
40
- marginVertical: `3%`,
41
- },
42
- container: {
43
- flex: 1,
44
- margin: `5%`,
45
- },
46
- textContainer: {
47
- flexDirection: `row`,
48
- justifyContent: `center`,
49
- borderWidth: 1,
50
- borderRadius: 100,
51
- marginHorizontal: `4%`,
52
- paddingVertical: `4%`,
53
- borderColor: `#01FFFC`,
54
- },
55
- transferText: {
56
- color: `#01FFFC`,
57
- fontSize: react_native_1.Dimensions.get(`screen`).width / 22,
58
- fontWeight: `bold`,
59
- },
60
- textContainerActive: {
61
- flexDirection: `row`,
62
- backgroundColor: `#01FFFC`,
63
- justifyContent: `center`,
64
- borderWidth: 1,
65
- borderRadius: 100,
66
- marginHorizontal: `4%`,
67
- paddingVertical: `4%`,
68
- },
69
- icon: {
70
- paddingTop: `1.3%`,
71
- color: `#1B1F48`,
72
- fontSize: react_native_1.Dimensions.get(`screen`).width / 22,
73
- marginRight: `1%`,
74
- },
75
- transferTextActive: {
76
- color: `#1B1F48`,
77
- fontSize: react_native_1.Dimensions.get(`screen`).width / 22,
78
- fontWeight: `bold`,
79
- },
80
- });
@@ -1,5 +0,0 @@
1
- import { Catalogs, I18n } from "@lingui/core";
2
- import { Languages } from "../types/enum.js";
3
- export declare const languageCatalogs: Catalogs;
4
- export declare const i18n: I18n;
5
- export declare function changeLanguage(language: Languages): I18n;
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.changeLanguage = exports.i18n = exports.languageCatalogs = void 0;
4
- const core_1 = require("@lingui/core");
5
- exports.languageCatalogs = {
6
- da: require(`./da/messages.js`),
7
- en: require(`./en/messages.js`),
8
- };
9
- exports.i18n = core_1.setupI18n({
10
- language: `en`,
11
- catalogs: exports.languageCatalogs,
12
- });
13
- function changeLanguage(language) {
14
- if (exports.languageCatalogs[language]) {
15
- exports.i18n.activate(language);
16
- }
17
- else {
18
- exports.i18n.activate(`en`);
19
- }
20
- return exports.i18n;
21
- }
22
- exports.changeLanguage = changeLanguage;
@@ -1,34 +0,0 @@
1
- export declare enum MoodEnum {
2
- Sad = 1,
3
- SemiSad = 2,
4
- Neutral = 3,
5
- SemiHappy = 4,
6
- Happy = 5
7
- }
8
- export declare enum BGUnit {
9
- MMOL_L = "mmol/l",
10
- MG_DL = "mg/dl"
11
- }
12
- export declare enum InjectionMethod {
13
- PenHalf = "Pen-half",
14
- PenWhole = "Pen-whole",
15
- Pump = "Pump"
16
- }
17
- export declare enum Languages {
18
- da = "da",
19
- en = "en"
20
- }
21
- export declare enum RecommendationErrorEnum {
22
- ActivityOutOfRange = 0,
23
- ActivityNull = 1,
24
- CarbohydrateLimit = 2,
25
- InsulinLimit = 3,
26
- SevereHypoglycemia = 4,
27
- TimeoutLimit = 5
28
- }
29
- export declare enum Milliseconds {
30
- Second = 1000,
31
- Minute = 60000,
32
- Hour = 3600000,
33
- Day = 86400000
34
- }
package/src/types/enum.js DELETED
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Milliseconds = exports.RecommendationErrorEnum = exports.Languages = exports.InjectionMethod = exports.BGUnit = exports.MoodEnum = void 0;
4
- var MoodEnum;
5
- (function (MoodEnum) {
6
- MoodEnum[MoodEnum["Sad"] = 1] = "Sad";
7
- MoodEnum[MoodEnum["SemiSad"] = 2] = "SemiSad";
8
- MoodEnum[MoodEnum["Neutral"] = 3] = "Neutral";
9
- MoodEnum[MoodEnum["SemiHappy"] = 4] = "SemiHappy";
10
- MoodEnum[MoodEnum["Happy"] = 5] = "Happy";
11
- })(MoodEnum = exports.MoodEnum || (exports.MoodEnum = {}));
12
- var BGUnit;
13
- (function (BGUnit) {
14
- BGUnit["MMOL_L"] = "mmol/l";
15
- BGUnit["MG_DL"] = "mg/dl";
16
- })(BGUnit = exports.BGUnit || (exports.BGUnit = {}));
17
- var InjectionMethod;
18
- (function (InjectionMethod) {
19
- InjectionMethod["PenHalf"] = "Pen-half";
20
- InjectionMethod["PenWhole"] = "Pen-whole";
21
- InjectionMethod["Pump"] = "Pump";
22
- })(InjectionMethod = exports.InjectionMethod || (exports.InjectionMethod = {}));
23
- var Languages;
24
- (function (Languages) {
25
- Languages["da"] = "da";
26
- Languages["en"] = "en";
27
- })(Languages = exports.Languages || (exports.Languages = {}));
28
- var RecommendationErrorEnum;
29
- (function (RecommendationErrorEnum) {
30
- RecommendationErrorEnum[RecommendationErrorEnum["ActivityOutOfRange"] = 0] = "ActivityOutOfRange";
31
- RecommendationErrorEnum[RecommendationErrorEnum["ActivityNull"] = 1] = "ActivityNull";
32
- RecommendationErrorEnum[RecommendationErrorEnum["CarbohydrateLimit"] = 2] = "CarbohydrateLimit";
33
- RecommendationErrorEnum[RecommendationErrorEnum["InsulinLimit"] = 3] = "InsulinLimit";
34
- RecommendationErrorEnum[RecommendationErrorEnum["SevereHypoglycemia"] = 4] = "SevereHypoglycemia";
35
- RecommendationErrorEnum[RecommendationErrorEnum["TimeoutLimit"] = 5] = "TimeoutLimit";
36
- })(RecommendationErrorEnum = exports.RecommendationErrorEnum || (exports.RecommendationErrorEnum = {}));
37
- var Milliseconds;
38
- (function (Milliseconds) {
39
- Milliseconds[Milliseconds["Second"] = 1000] = "Second";
40
- Milliseconds[Milliseconds["Minute"] = 60000] = "Minute";
41
- Milliseconds[Milliseconds["Hour"] = 3600000] = "Hour";
42
- Milliseconds[Milliseconds["Day"] = 86400000] = "Day";
43
- })(Milliseconds = exports.Milliseconds || (exports.Milliseconds = {}));