@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.
Files changed (101) hide show
  1. package/ios/HediaRecommendationScreen.xcodeproj/project.pbxproj +2 -2
  2. package/ios/Podfile.lock +207 -207
  3. package/package.json +1 -1
  4. package/index.d.ts +0 -5
  5. package/index.js +0 -5
  6. package/src/RecommendationScreen.d.ts +0 -413
  7. package/src/RecommendationScreen.js +0 -493
  8. package/src/__tests__/RecommendationScreen.test.d.ts +0 -1
  9. package/src/__tests__/RecommendationScreen.test.js +0 -965
  10. package/src/__tests__/RecommendationUtils.test.d.ts +0 -1
  11. package/src/__tests__/RecommendationUtils.test.js +0 -216
  12. package/src/__tests__/Translate.test.d.ts +0 -1
  13. package/src/__tests__/Translate.test.js +0 -27
  14. package/src/__tests__/Utils.test.d.ts +0 -1
  15. package/src/__tests__/Utils.test.js +0 -66
  16. package/src/__tests__/Validations.test.d.ts +0 -1
  17. package/src/__tests__/Validations.test.js +0 -465
  18. package/src/__tests__/components/Activity.test.d.ts +0 -1
  19. package/src/__tests__/components/Activity.test.js +0 -86
  20. package/src/__tests__/components/Emotion.test.d.ts +0 -1
  21. package/src/__tests__/components/Emotion.test.js +0 -70
  22. package/src/__tests__/components/Header.test.d.ts +0 -1
  23. package/src/__tests__/components/Header.test.js +0 -36
  24. package/src/__tests__/components/InfoBars.test.d.ts +0 -1
  25. package/src/__tests__/components/InfoBars.test.js +0 -130
  26. package/src/__tests__/components/InvisibleNumberInput.test.d.ts +0 -1
  27. package/src/__tests__/components/InvisibleNumberInput.test.js +0 -160
  28. package/src/__tests__/components/LimitationMessage.test.d.ts +0 -1
  29. package/src/__tests__/components/LimitationMessage.test.js +0 -47
  30. package/src/__tests__/components/MoodIcon.test.d.ts +0 -1
  31. package/src/__tests__/components/MoodIcon.test.js +0 -30
  32. package/src/__tests__/components/RecommendationModal.test.d.ts +0 -1
  33. package/src/__tests__/components/RecommendationModal.test.js +0 -98
  34. package/src/__tests__/components/RecommendedCarbs.test.d.ts +0 -1
  35. package/src/__tests__/components/RecommendedCarbs.test.js +0 -120
  36. package/src/__tests__/components/RecommendedInsulin.test.d.ts +0 -1
  37. package/src/__tests__/components/RecommendedInsulin.test.js +0 -154
  38. package/src/__tests__/components/Remeasure.test.d.ts +0 -1
  39. package/src/__tests__/components/Remeasure.test.js +0 -78
  40. package/src/__tests__/components/TransferToLogbook.test.d.ts +0 -1
  41. package/src/__tests__/components/TransferToLogbook.test.js +0 -30
  42. package/src/__tests__/components/TwoOptionModal.test.d.ts +0 -1
  43. package/src/__tests__/components/TwoOptionModal.test.js +0 -65
  44. package/src/__tests__/utils.d.ts +0 -16
  45. package/src/__tests__/utils.js +0 -126
  46. package/src/components/Header.d.ts +0 -10
  47. package/src/components/Header.js +0 -75
  48. package/src/components/Icon.d.ts +0 -20
  49. package/src/components/Icon.js +0 -41
  50. package/src/components/InfoBars.d.ts +0 -103
  51. package/src/components/InfoBars.js +0 -129
  52. package/src/components/InvisibleNumberInput.d.ts +0 -89
  53. package/src/components/InvisibleNumberInput.js +0 -122
  54. package/src/components/LimitationMessage.d.ts +0 -14
  55. package/src/components/LimitationMessage.js +0 -31
  56. package/src/components/LineSeparator.d.ts +0 -10
  57. package/src/components/LineSeparator.js +0 -18
  58. package/src/components/RecentInsulin.d.ts +0 -17
  59. package/src/components/RecentInsulin.js +0 -94
  60. package/src/components/RecommendationModal.d.ts +0 -207
  61. package/src/components/RecommendationModal.js +0 -213
  62. package/src/components/RecommendedCarbs.d.ts +0 -94
  63. package/src/components/RecommendedCarbs.js +0 -251
  64. package/src/components/RecommendedInsulin.d.ts +0 -84
  65. package/src/components/RecommendedInsulin.js +0 -170
  66. package/src/components/Remeasure.d.ts +0 -49
  67. package/src/components/Remeasure.js +0 -125
  68. package/src/components/TransferToLogbook.d.ts +0 -34
  69. package/src/components/TransferToLogbook.js +0 -94
  70. package/src/components/TwoOptionModal.d.ts +0 -145
  71. package/src/components/TwoOptionModal.js +0 -148
  72. package/src/components/activity/Activity.d.ts +0 -26
  73. package/src/components/activity/Activity.js +0 -80
  74. package/src/components/activity/ActivityIcon.d.ts +0 -22
  75. package/src/components/activity/ActivityIcon.js +0 -58
  76. package/src/components/activity/ActivityIntensity.d.ts +0 -16
  77. package/src/components/activity/ActivityIntensity.js +0 -59
  78. package/src/components/mood/Emotion.d.ts +0 -38
  79. package/src/components/mood/Emotion.js +0 -65
  80. package/src/components/mood/MoodIcon.d.ts +0 -40
  81. package/src/components/mood/MoodIcon.js +0 -66
  82. package/src/locale/i18nUtils.d.ts +0 -18
  83. package/src/locale/i18nUtils.js +0 -39
  84. package/src/types/enum.d.ts +0 -122
  85. package/src/types/enum.js +0 -138
  86. package/src/types/types.d.ts +0 -17
  87. package/src/types/types.js +0 -1
  88. package/src/utils/AttentionMessages.d.ts +0 -96
  89. package/src/utils/AttentionMessages.js +0 -118
  90. package/src/utils/Constants.d.ts +0 -47
  91. package/src/utils/Constants.js +0 -47
  92. package/src/utils/RecommendationError.d.ts +0 -56
  93. package/src/utils/RecommendationError.js +0 -62
  94. package/src/utils/RecommendationUtils.d.ts +0 -100
  95. package/src/utils/RecommendationUtils.js +0 -199
  96. package/src/utils/Translations.d.ts +0 -9
  97. package/src/utils/Translations.js +0 -14
  98. package/src/utils/Utils.d.ts +0 -105
  99. package/src/utils/Utils.js +0 -141
  100. package/src/utils/Validations.d.ts +0 -250
  101. package/src/utils/Validations.js +0 -409
@@ -1,103 +0,0 @@
1
- import { BloodGlucoseUnit, BloodKetonesUnit } from "@hedia/types";
2
- import React from "react";
3
- import { Testing } from "../types/enum";
4
- export interface IProps {
5
- /** The display label that describes the value to the user. */
6
- label: string;
7
- /** The value to display. */
8
- value: string | null;
9
- /** Unit label to print after the value. */
10
- unit: string | BloodGlucoseUnit | BloodKetonesUnit | null;
11
- /** If true then a dash character (“-”) will be printed in place of the value if the value is null. */
12
- showNullAsDash: boolean;
13
- /** optional object that contains as properties a valueID and a unitID */
14
- testID?: {
15
- valueID: Testing.Id.InfoBarTestIds.Value;
16
- unitID: Testing.Id.InfoBarTestIds.Unit;
17
- };
18
- }
19
- /** A standard panel to display some data that the user entered. */
20
- export default class InfoBars extends React.Component<IProps> {
21
- /**
22
- * Determine the value to be displayed in the infobar.
23
- *
24
- * Steps:
25
- * 1. Unpack showNullAsDash, unit, and value from props.
26
- * 2. Set noDecimal to be true if unit is BloodGlucoseUnit.MG_DL or if unit is BloodKetonesUnit.MG_DL.
27
- * 3. Set nullPlaceholder to be ‘-' if noDecimal is true and to '-.-’ otherwise.
28
- * 4. Return value if it is not null or undefined. Otherwise, if showNullAsDash is true then return nullPlaceholder, otherwise return the string '0'.
29
- * @returns The string to display as the value in the infobar.
30
- */
31
- displayValue: () => string;
32
- /**
33
- * Determine the unit string to be displayed in the infobar.
34
- *
35
- * Steps:
36
- * 1. Unpack unit from props.
37
- * 2. Return unit if unit is “units” or the result of calling formatUnit() with unit as argument otherwise.
38
- * @returns The string to display as the unit in the infobar
39
- */
40
- displayUnit: () => string | null;
41
- /**
42
- * @returns JSX element to display a card with the entered value.
43
- */
44
- render(): JSX.Element;
45
- }
46
- /** @internal */
47
- export declare const infoStyles: {
48
- container: {
49
- flex: number;
50
- };
51
- margin: {
52
- flex: number;
53
- margin: string;
54
- marginBottom: number;
55
- };
56
- border: {
57
- borderWidth: number;
58
- borderColor: string;
59
- borderRadius: number;
60
- paddingVertical: string;
61
- };
62
- borderContainer: {
63
- flex: number;
64
- flexDirection: "row";
65
- justifyContent: "space-between";
66
- paddingHorizontal: string;
67
- };
68
- labelContainer: {
69
- flex: number;
70
- justifyContent: "center";
71
- };
72
- label: {
73
- color: string;
74
- fontSize: number;
75
- fontWeight: "bold";
76
- };
77
- valueUnitContainer: {
78
- flex: number;
79
- justifyContent: "flex-end";
80
- flexDirection: "row";
81
- };
82
- valueContainer: {
83
- flex: number;
84
- justifyContent: "flex-end";
85
- };
86
- value: {
87
- color: string;
88
- fontSize: number;
89
- fontWeight: "bold";
90
- textAlign: "right";
91
- };
92
- unitContainer: {
93
- flex: number;
94
- justifyContent: "flex-end";
95
- paddingBottom: string;
96
- };
97
- units: {
98
- color: string;
99
- fontSize: number;
100
- textAlign: "left";
101
- paddingLeft: string;
102
- };
103
- };
@@ -1,129 +0,0 @@
1
- import { BloodGlucoseUnit, BloodKetonesUnit } from "@hedia/types";
2
- import { t } from "@lingui/macro";
3
- import React from "react";
4
- import { Dimensions, StyleSheet, Text, View } from "react-native";
5
- import { i18n } from "../locale/i18nUtils";
6
- import { BORDER_COLOUR_GREY } from "../utils/Constants";
7
- import { Utils } from "../utils/Utils";
8
- /** A standard panel to display some data that the user entered. */
9
- export default class InfoBars extends React.Component {
10
- constructor() {
11
- super(...arguments);
12
- /**
13
- * Determine the value to be displayed in the infobar.
14
- *
15
- * Steps:
16
- * 1. Unpack showNullAsDash, unit, and value from props.
17
- * 2. Set noDecimal to be true if unit is BloodGlucoseUnit.MG_DL or if unit is BloodKetonesUnit.MG_DL.
18
- * 3. Set nullPlaceholder to be ‘-' if noDecimal is true and to '-.-’ otherwise.
19
- * 4. Return value if it is not null or undefined. Otherwise, if showNullAsDash is true then return nullPlaceholder, otherwise return the string '0'.
20
- * @returns The string to display as the value in the infobar.
21
- */
22
- this.displayValue = () => {
23
- const { showNullAsDash, unit, value } = this.props;
24
- const noDecimal = unit === BloodGlucoseUnit.MG_DL || unit === BloodKetonesUnit.MG_DL;
25
- const nullPlaceholder = noDecimal || !unit ? `-` : `-.-`;
26
- return value ?? (showNullAsDash ? nullPlaceholder : `0`);
27
- };
28
- /**
29
- * Determine the unit string to be displayed in the infobar.
30
- *
31
- * Steps:
32
- * 1. Unpack unit from props.
33
- * 2. Return unit if unit is “units” or the result of calling formatUnit() with unit as argument otherwise.
34
- * @returns The string to display as the unit in the infobar
35
- */
36
- this.displayUnit = () => {
37
- const { unit } = this.props;
38
- if (!unit) {
39
- return null;
40
- }
41
- return unit === i18n._(t `units`) ? unit : Utils.formatUnit(unit);
42
- };
43
- }
44
- /**
45
- * @returns JSX element to display a card with the entered value.
46
- */
47
- render() {
48
- const { testID } = this.props;
49
- return (<View style={infoStyles.container}>
50
- <View style={infoStyles.margin}>
51
- <View style={infoStyles.border}>
52
- <View style={infoStyles.borderContainer}>
53
- <View style={infoStyles.labelContainer}>
54
- <Text style={infoStyles.label}>{this.props.label}</Text>
55
- </View>
56
- <View style={infoStyles.valueUnitContainer}>
57
- <View style={infoStyles.valueContainer}>
58
- <Text style={infoStyles.value} testID={testID?.valueID}>
59
- {this.displayValue()}
60
- </Text>
61
- </View>
62
- <View style={infoStyles.unitContainer}>
63
- <Text style={infoStyles.units} testID={testID?.unitID}>
64
- {this.displayUnit()}
65
- </Text>
66
- </View>
67
- </View>
68
- </View>
69
- </View>
70
- </View>
71
- </View>);
72
- }
73
- }
74
- /** @internal */
75
- export const infoStyles = StyleSheet.create({
76
- container: { flex: 1 },
77
- margin: {
78
- flex: 1,
79
- margin: `3%`,
80
- marginBottom: 0,
81
- },
82
- border: {
83
- borderWidth: 2,
84
- borderColor: BORDER_COLOUR_GREY,
85
- borderRadius: 5,
86
- paddingVertical: `1%`,
87
- },
88
- borderContainer: {
89
- flex: 1,
90
- flexDirection: `row`,
91
- justifyContent: `space-between`,
92
- paddingHorizontal: `3%`,
93
- },
94
- labelContainer: {
95
- flex: 7,
96
- justifyContent: `center`,
97
- },
98
- label: {
99
- color: `white`,
100
- fontSize: Dimensions.get(`screen`).width / 22,
101
- fontWeight: `bold`,
102
- },
103
- valueUnitContainer: {
104
- flex: 6.5,
105
- justifyContent: `flex-end`,
106
- flexDirection: `row`,
107
- },
108
- valueContainer: {
109
- flex: 5,
110
- justifyContent: `flex-end`,
111
- },
112
- value: {
113
- color: `white`,
114
- fontSize: Dimensions.get(`screen`).width / 15,
115
- fontWeight: `bold`,
116
- textAlign: `right`,
117
- },
118
- unitContainer: {
119
- flex: 3,
120
- justifyContent: `flex-end`,
121
- paddingBottom: `3%`,
122
- },
123
- units: {
124
- color: `white`,
125
- fontSize: Dimensions.get(`screen`).width / 30,
126
- textAlign: `left`,
127
- paddingLeft: `5%`,
128
- },
129
- });
@@ -1,89 +0,0 @@
1
- import React from "react";
2
- import { TextInput } from "react-native";
3
- export interface IProps {
4
- /** The initial value to put in the input field. */
5
- startValue?: string;
6
- /** The precision with which the content of the input field may be displayed */
7
- decimalPlaces: number;
8
- /** Whether or not the clean method should be used on the content every time it is changed */
9
- cleanPartialInput: boolean;
10
- /** Whether or not negative values can be entered. */
11
- negativeAllowed: boolean;
12
- /** Max length of the content in the input field. */
13
- maxLength?: number;
14
- /** Test id used for component testing */
15
- testID: string;
16
- /** Callback function taking a function as argument - For passing a reference for the input field’s to the parent component. */
17
- visible(toggle: () => void): void;
18
- /** Callback function taking a number argument - To be called when the user finishes editing the invisible text field with the final numerical value as argument. */
19
- onEnd?(value: number): void;
20
- /** Callback function taking a string as input and not returning anything - To be called every time the content in the input field changes. */
21
- partialInput?(value: string): void;
22
- }
23
- export interface IState {
24
- /** For storing the value of the text input so it is available for handling in onEndEdit() when editing the text input ends. */
25
- value: string;
26
- }
27
- /**
28
- * InvisibleNumberInput is used to enable numerical input by the user without displaying a traditional input field on the screen.
29
- * Since the input field is made invisible and thus can’t be tapped directly by the user we need to be able to call
30
- * its focus() method from the parent component in order to activate the input field and show the keyboard.
31
- * We do this by defining a function that calls the input field’s focus() method inside the InvisibleNumberInput component when it has been mounted.
32
- * This function is then passed to the parent by giving it as the argument for a callback function named visible.
33
- */
34
- export default class InvisibleNumberInput extends React.Component<IProps, IState> {
35
- /** For holding a reference to the TextInput component so it can be focused when the InvisibleNumberInput component has been mounted. */
36
- textInput?: TextInput;
37
- /** Initialise the state value variable with `0` */
38
- state: IState;
39
- /**
40
- * Called immediately after a component is mounted. Setting state here will trigger re-rendering.
41
- * Perform various initialisation steps:
42
- * 1. Set the value state of the component to the startValue prop (or to '0' if it is undefined)
43
- * 2. Call the visible callback function using an anonymous function as argument. The anonymous function shall do the following:
44
- * - Set the value state of the InvisibleNumberInput component to the startValue prop (or to '0' if it is undefined)
45
- * - Return the value from calling the focus() method on the input field.
46
- */
47
- componentDidMount(): void;
48
- /**
49
- * Sanitise a user-entered value by removing invalid characters
50
- *
51
- * Steps:
52
- * 1. Use regular expressions to make the following manipulations to the text argument in the defined order and save the result to a local string variable named replaced.
53
- * - Replace any commas with periods
54
- * - Remove any characters that comes after two groups of zero or more digits separated by a period.
55
- * 2. Define a function named round that rounds a given string that contains a number to have the amount of decimals given by the decimalPlaces prop. Return the result as a string.
56
- * 3. If the value of the replaced variable from step 1 is not a NaN (not a number) when converted to a Number type then use the round function defined in step 2 on replaced and return the result
57
- * 4. (If the NaN-check from step 2 didn’t fail) return the string '0'.
58
-
59
- * @param text The string input to clean up
60
- * @returns A string with the cleaned text.
61
- */
62
- cleanInput: (text: string) => string;
63
- /**
64
- * Handle what happens when the text in the input field is being changed.
65
- * That includes cleaning the text a little and then saving the value and potentially calling a callback function.
66
- *
67
- * Steps:
68
- * 1. If the cleanPartialInput prop is true, use the cleanInput() method to to clean the content of the text argument and save it to a variable named cleaned.
69
- * Otherwise just replace any commas in the text argument with periods and save the result to the same variable.
70
- * 2. Remove repeated periods from the text in the cleaned variable and save the the result in a new variable named replacedSeparator.
71
- * 3. Set the value state of the component to replacedSeparator.
72
- * 4. If the partialInput callback function prop is defined, call it with replacedSeparator as argument.
73
- * @param text The updated text in the input field
74
- */
75
- handleOnChangeText: (text: string) => void;
76
- /**
77
- * Handle what should happen when the user finish editing the input field.
78
- *
79
- * Steps:
80
- * 1. Use the cleanInput() method on the value state and store the result in a variable named cleaned.
81
- * 2. If the onEnd prop is not null, then convert the value of cleaned to a number and use it as an argument to call the onEnd prop function.
82
- */
83
- onEndEdit: () => void;
84
- /**
85
- * @returns JSX element to display a TextInput field with the component’s value state as its value
86
- * and the handleOnChangeText() and onEndEdit() methods as the textInput’s onChangeText and onEndEditing respectively.
87
- */
88
- render(): JSX.Element;
89
- }
@@ -1,122 +0,0 @@
1
- import React from "react";
2
- import { Platform, StyleSheet, TextInput } from "react-native";
3
- /**
4
- * InvisibleNumberInput is used to enable numerical input by the user without displaying a traditional input field on the screen.
5
- * Since the input field is made invisible and thus can’t be tapped directly by the user we need to be able to call
6
- * its focus() method from the parent component in order to activate the input field and show the keyboard.
7
- * We do this by defining a function that calls the input field’s focus() method inside the InvisibleNumberInput component when it has been mounted.
8
- * This function is then passed to the parent by giving it as the argument for a callback function named visible.
9
- */
10
- export default class InvisibleNumberInput extends React.Component {
11
- constructor() {
12
- super(...arguments);
13
- /** Initialise the state value variable with `0` */
14
- this.state = {
15
- value: `0`,
16
- };
17
- /**
18
- * Sanitise a user-entered value by removing invalid characters
19
- *
20
- * Steps:
21
- * 1. Use regular expressions to make the following manipulations to the text argument in the defined order and save the result to a local string variable named replaced.
22
- * - Replace any commas with periods
23
- * - Remove any characters that comes after two groups of zero or more digits separated by a period.
24
- * 2. Define a function named round that rounds a given string that contains a number to have the amount of decimals given by the decimalPlaces prop. Return the result as a string.
25
- * 3. If the value of the replaced variable from step 1 is not a NaN (not a number) when converted to a Number type then use the round function defined in step 2 on replaced and return the result
26
- * 4. (If the NaN-check from step 2 didn’t fail) return the string '0'.
27
-
28
- * @param text The string input to clean up
29
- * @returns A string with the cleaned text.
30
- */
31
- this.cleanInput = (text) => {
32
- const replaced = text.replace(/\,/g, `.`).replace(/(\d*\.\d*).*/, `$1`);
33
- const round = (value) => {
34
- const temp = Number(value) * Math.pow(10, this.props.decimalPlaces);
35
- const rounded = Math.round(temp) / Math.pow(10, this.props.decimalPlaces);
36
- return rounded.toFixed(this.props.decimalPlaces);
37
- };
38
- if (!isNaN(Number(replaced))) {
39
- return round(replaced);
40
- }
41
- return `0`;
42
- };
43
- /**
44
- * Handle what happens when the text in the input field is being changed.
45
- * That includes cleaning the text a little and then saving the value and potentially calling a callback function.
46
- *
47
- * Steps:
48
- * 1. If the cleanPartialInput prop is true, use the cleanInput() method to to clean the content of the text argument and save it to a variable named cleaned.
49
- * Otherwise just replace any commas in the text argument with periods and save the result to the same variable.
50
- * 2. Remove repeated periods from the text in the cleaned variable and save the the result in a new variable named replacedSeparator.
51
- * 3. Set the value state of the component to replacedSeparator.
52
- * 4. If the partialInput callback function prop is defined, call it with replacedSeparator as argument.
53
- * @param text The updated text in the input field
54
- */
55
- this.handleOnChangeText = (text) => {
56
- const cleaned = this.props.cleanPartialInput ? this.cleanInput(text) : text.replace(/\,/g, `.`);
57
- let replacedSeparator = cleaned.replace(/\.+/g, `.`).replace(/(\d*\.\d*).*/, `$1`);
58
- if (!this.props.negativeAllowed) {
59
- replacedSeparator = replacedSeparator.replace(/[^0-9.]/g, ``);
60
- }
61
- this.setState({
62
- value: `${replacedSeparator}`,
63
- });
64
- this.props.partialInput?.(`${replacedSeparator}`);
65
- };
66
- /**
67
- * Handle what should happen when the user finish editing the input field.
68
- *
69
- * Steps:
70
- * 1. Use the cleanInput() method on the value state and store the result in a variable named cleaned.
71
- * 2. If the onEnd prop is not null, then convert the value of cleaned to a number and use it as an argument to call the onEnd prop function.
72
- */
73
- this.onEndEdit = () => {
74
- const cleaned = this.cleanInput(this.state.value);
75
- this.props.onEnd?.(Number(cleaned));
76
- };
77
- }
78
- /**
79
- * Called immediately after a component is mounted. Setting state here will trigger re-rendering.
80
- * Perform various initialisation steps:
81
- * 1. Set the value state of the component to the startValue prop (or to '0' if it is undefined)
82
- * 2. Call the visible callback function using an anonymous function as argument. The anonymous function shall do the following:
83
- * - Set the value state of the InvisibleNumberInput component to the startValue prop (or to '0' if it is undefined)
84
- * - Return the value from calling the focus() method on the input field.
85
- */
86
- componentDidMount() {
87
- this.setState({
88
- value: this.props.startValue ?? `0`,
89
- });
90
- this.props.visible(() => {
91
- this.setState({
92
- value: this.props.startValue ?? `0`,
93
- });
94
- return this.textInput?.focus();
95
- });
96
- }
97
- /**
98
- * @returns JSX element to display a TextInput field with the component’s value state as its value
99
- * and the handleOnChangeText() and onEndEdit() methods as the textInput’s onChangeText and onEndEditing respectively.
100
- */
101
- render() {
102
- const { testID } = this.props;
103
- return (<TextInput testID={testID} accessibilityLabel={`InvisibleNumberInput`} value={`${this.state.value}`} ref={(textInput) => {
104
- if (textInput !== null) {
105
- this.textInput = textInput;
106
- }
107
- }} style={inputStyles.input} keyboardType={`numeric`} returnKeyType={`done`} onChangeText={this.handleOnChangeText} onEndEditing={this.onEndEdit} maxLength={this.props.maxLength} selectTextOnFocus/>);
108
- }
109
- }
110
- const inputStyles = StyleSheet.create({
111
- input: {
112
- ...Platform.select({
113
- ios: {
114
- width: 0,
115
- height: 0,
116
- },
117
- android: {
118
- opacity: 0,
119
- },
120
- }),
121
- },
122
- });
@@ -1,14 +0,0 @@
1
- import * as React from "react";
2
- export interface ILimitationMessageProps {
3
- /** The message to display to the user. */
4
- limitationMessage: string | null;
5
- /** Callback function taking no arguments and giving no return value - To be called when the user presses the “OK” button. */
6
- onPressNextButton(): void;
7
- }
8
- /** Display a message on the screen to inform the user that their insulin recommendation was limited. */
9
- export default class LimitationMessage extends React.Component<ILimitationMessageProps> {
10
- /**
11
- * @returns JSX element for displaying a dialog with the limitationMessage and an “OK” button that calls the onPressNextButton prop callback when tapped.
12
- */
13
- render: () => JSX.Element;
14
- }
@@ -1,31 +0,0 @@
1
- import { t } from "@lingui/macro";
2
- import * as React from "react";
3
- import { Text, TouchableOpacity, View } from "react-native";
4
- import { i18n } from "../locale/i18nUtils";
5
- import { Testing } from "../types/enum";
6
- import { stylesModal } from "./RecommendationModal";
7
- /** Display a message on the screen to inform the user that their insulin recommendation was limited. */
8
- export default class LimitationMessage extends React.Component {
9
- constructor() {
10
- super(...arguments);
11
- /**
12
- * @returns JSX element for displaying a dialog with the limitationMessage and an “OK” button that calls the onPressNextButton prop callback when tapped.
13
- */
14
- this.render = () => {
15
- const { limitationMessage } = this.props;
16
- return (<React.Fragment>
17
- <View style={stylesModal.container}>
18
- <View style={stylesModal.titleContainer}>
19
- <Text style={stylesModal.textTittleMessage}>{i18n._(t `Attention`)}</Text>
20
- </View>
21
- <Text style={stylesModal.textMessage}>{limitationMessage}</Text>
22
- </View>
23
- <View style={stylesModal.containerAcceptButton}>
24
- <TouchableOpacity testID={Testing.Id.LimitationMessageTestIds.OkButton} accessibilityLabel="nextButtonModal" style={stylesModal.okButton} onPress={this.props.onPressNextButton}>
25
- <Text style={stylesModal.buttonText}>{i18n._(t `OK`)}</Text>
26
- </TouchableOpacity>
27
- </View>
28
- </React.Fragment>);
29
- };
30
- }
31
- }
@@ -1,10 +0,0 @@
1
- import React from "react";
2
- export interface IProps {
3
- /** The color that the line should have. */
4
- color: string;
5
- }
6
- /** Display a horizontal line for visually separating elements in the user interface. */
7
- export default class LineSeparator extends React.Component<IProps> {
8
- /** @return JSX element for displaying a thin horizontal line in the given color. */
9
- render(): JSX.Element;
10
- }
@@ -1,18 +0,0 @@
1
- import React from "react";
2
- import { StyleSheet, View } from "react-native";
3
- /** Display a horizontal line for visually separating elements in the user interface. */
4
- export default class LineSeparator extends React.Component {
5
- /** @return JSX element for displaying a thin horizontal line in the given color. */
6
- render() {
7
- return (<React.Fragment>
8
- <View style={[lineSeparatorStyles.lineStyle, { borderBottomColor: this.props.color }]}/>
9
- </React.Fragment>);
10
- }
11
- }
12
- const lineSeparatorStyles = StyleSheet.create({
13
- lineStyle: {
14
- marginHorizontal: `3%`,
15
- marginVertical: `2%`,
16
- borderBottomWidth: 1,
17
- },
18
- });
@@ -1,17 +0,0 @@
1
- import React from "react";
2
- export interface IProps {
3
- /** Callback function taking no arguments and returning no value - To be called if the user presses the “Yes” button. */
4
- onRecentInsulinYes(): void;
5
- /** Callback function taking no arguments and returning no value - To be called if the user presses the “No” button. */
6
- onRecentInsulinNo(): void;
7
- }
8
- /** Display a card that prompts the user to recall if they injected insulin recently. */
9
- export default class RecentInsulin extends React.Component<IProps> {
10
- /**
11
- *
12
- * @returns JSX element that displays a card with the question “Have you taken insulin within the last 4 hours? Along with two buttons labeled “Yes” and “No” respectively.
13
- * If the user taps the “Yes” button, the onRecentInsulinYes prop callback function should be called.
14
- * If the user taps the “No” button, the onRecentInsulinNo prop callback function should be called.
15
- */
16
- render: () => JSX.Element;
17
- }
@@ -1,94 +0,0 @@
1
- import { t } from "@lingui/macro";
2
- import React from "react";
3
- import { Dimensions, StyleSheet, Text, TouchableOpacity, View } from "react-native";
4
- import { i18n } from "../locale/i18nUtils";
5
- import { Testing } from "../types/enum";
6
- import { infoStyles } from "./InfoBars";
7
- /** Display a card that prompts the user to recall if they injected insulin recently. */
8
- export default class RecentInsulin extends React.Component {
9
- constructor() {
10
- super(...arguments);
11
- /**
12
- *
13
- * @returns JSX element that displays a card with the question “Have you taken insulin within the last 4 hours? Along with two buttons labeled “Yes” and “No” respectively.
14
- * If the user taps the “Yes” button, the onRecentInsulinYes prop callback function should be called.
15
- * If the user taps the “No” button, the onRecentInsulinNo prop callback function should be called.
16
- */
17
- this.render = () => {
18
- return (<View style={recentInsulinStyles.container}>
19
- <View style={recentInsulinStyles.titleContainer}>
20
- <Text style={recentInsulinStyles.recommended}>{i18n._(t `Recommended amount of insulin`)}</Text>
21
- </View>
22
- <View style={recentInsulinStyles.takenInsulinContainer}>
23
- <Text style={recentInsulinStyles.takenInsulin}>
24
- {i18n._(t `Have you taken insulin within the last 4 hours?`)}
25
- </Text>
26
- </View>
27
- <View style={recentInsulinStyles.buttonContainer}>
28
- <View style={recentInsulinStyles.filler}/>
29
- <TouchableOpacity testID={Testing.Id.RecentInsulinTestIds.Yes} onPress={this.props.onRecentInsulinYes} style={[recentInsulinStyles.yesNoContainer, { marginRight: `2%` }]}>
30
- <Text style={recentInsulinStyles.yesNoText}>{i18n._(t `Yes`)}</Text>
31
- </TouchableOpacity>
32
- <TouchableOpacity testID={Testing.Id.RecentInsulinTestIds.No} onPress={this.props.onRecentInsulinNo} style={[recentInsulinStyles.yesNoContainer, { marginLeft: `2%` }]}>
33
- <Text style={recentInsulinStyles.yesNoText}>{i18n._(t `No`)}</Text>
34
- </TouchableOpacity>
35
- <View style={recentInsulinStyles.filler}/>
36
- </View>
37
- </View>);
38
- };
39
- }
40
- }
41
- const recentInsulinStyles = StyleSheet.create({
42
- container: {
43
- ...infoStyles.margin,
44
- backgroundColor: `rgba(118, 82, 255, 0.5)`,
45
- borderRadius: 5,
46
- },
47
- titleContainer: {
48
- flex: 1,
49
- justifyContent: `center`,
50
- alignItems: `center`,
51
- marginTop: `4%`,
52
- marginBottom: `4%`,
53
- },
54
- recommended: {
55
- ...infoStyles.label,
56
- },
57
- takenInsulinContainer: {
58
- flex: 1,
59
- justifyContent: `center`,
60
- alignItems: `center`,
61
- marginTop: `2%`,
62
- },
63
- takenInsulin: {
64
- ...infoStyles.label,
65
- fontSize: Dimensions.get(`screen`).width / 27,
66
- textAlign: `center`,
67
- },
68
- buttonContainer: {
69
- flex: 1,
70
- flexDirection: `row`,
71
- justifyContent: `space-evenly`,
72
- marginTop: `4%`,
73
- marginBottom: `5%`,
74
- },
75
- yesNoContainer: {
76
- flex: 1,
77
- borderColor: `white`,
78
- borderRadius: 100,
79
- borderWidth: 2,
80
- paddingHorizontal: `2%`,
81
- paddingVertical: `1%`,
82
- },
83
- yesNoText: {
84
- textAlign: `center`,
85
- paddingTop: `1%`,
86
- paddingBottom: `1%`,
87
- color: `white`,
88
- fontSize: Dimensions.get(`screen`).width / 25,
89
- fontWeight: `bold`,
90
- },
91
- filler: {
92
- flex: 1,
93
- },
94
- });