@hedia/recommendation-screen 1.8.2 → 2.0.2
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/.github/workflows/ci.yml +0 -0
- package/.github/workflows/publish.yml +48 -0
- package/.github/workflows/version-check.yml +45 -0
- package/.linguirc +0 -0
- package/.npmpackagejsonlintrc.json +0 -0
- package/.prettierignore +0 -0
- package/.prettierrc +0 -0
- package/App.d.ts +4 -5
- package/App.jsx +23 -34
- package/App.tsx +36 -41
- package/Changelog.md +0 -0
- package/README.md +0 -0
- package/android/app/BUCK +0 -0
- package/android/app/build.gradle +0 -0
- package/android/app/build_defs.bzl +0 -0
- package/android/app/debug.keystore +0 -0
- package/android/app/proguard-rules.pro +0 -0
- package/android/app/src/debug/AndroidManifest.xml +0 -0
- package/android/app/src/debug/java/com/hediarecommendationscreen/ReactNativeFlipper.java +0 -0
- package/android/app/src/main/AndroidManifest.xml +0 -0
- package/android/app/src/main/assets/fonts/AntDesign.ttf +0 -0
- package/android/app/src/main/assets/fonts/Entypo.ttf +0 -0
- package/android/app/src/main/assets/fonts/EvilIcons.ttf +0 -0
- package/android/app/src/main/assets/fonts/Feather.ttf +0 -0
- package/android/app/src/main/assets/fonts/FontAwesome.ttf +0 -0
- package/android/app/src/main/assets/fonts/FontAwesome5_Brands.ttf +0 -0
- package/android/app/src/main/assets/fonts/FontAwesome5_Regular.ttf +0 -0
- package/android/app/src/main/assets/fonts/FontAwesome5_Solid.ttf +0 -0
- package/android/app/src/main/assets/fonts/Foundation.ttf +0 -0
- package/android/app/src/main/assets/fonts/Ionicons.ttf +0 -0
- package/android/app/src/main/assets/fonts/MaterialCommunityIcons.ttf +0 -0
- package/android/app/src/main/assets/fonts/MaterialIcons.ttf +0 -0
- package/android/app/src/main/assets/fonts/Octicons.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-Black.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-BlackItalic.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-Bold.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-BoldItalic.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-Italic.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-Light.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-LightItalic.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-Medium.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-MediumItalic.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-Regular.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-Thin.ttf +0 -0
- package/android/app/src/main/assets/fonts/Roboto-ThinItalic.ttf +0 -0
- package/android/app/src/main/assets/fonts/SimpleLineIcons.ttf +0 -0
- package/android/app/src/main/assets/fonts/Zocial.ttf +0 -0
- package/android/app/src/main/java/com/hediarecommendationscreen/MainActivity.java +0 -0
- package/android/app/src/main/java/com/hediarecommendationscreen/MainApplication.java +0 -0
- package/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/values/color.xml +0 -0
- package/android/app/src/main/res/values/strings.xml +0 -0
- package/android/app/src/main/res/values/styles.xml +0 -0
- package/android/build.gradle +0 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -0
- package/android/gradle.properties +0 -0
- package/android/gradlew.bat +0 -0
- package/android/settings.gradle +0 -0
- package/app.json +0 -0
- package/assets/fonts/Roboto/LICENSE.txt +0 -0
- package/assets/fonts/Roboto/Roboto-Black.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-BlackItalic.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-Bold.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-BoldItalic.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-Italic.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-Light.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-LightItalic.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-Medium.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-MediumItalic.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-Regular.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-Thin.ttf +0 -0
- package/assets/fonts/Roboto/Roboto-ThinItalic.ttf +0 -0
- package/babel.config.js +0 -0
- package/ignore-git.sh +1 -1
- package/ignore-publish.sh +2 -1
- package/index.d.ts +2 -2
- package/index.js +2 -3
- package/index.ts +2 -2
- package/ios/HediaRecommendationScreen/AppDelegate.h +0 -0
- package/ios/HediaRecommendationScreen/AppDelegate.m +0 -0
- package/ios/HediaRecommendationScreen/Base.lproj/LaunchScreen.xib +0 -0
- package/ios/HediaRecommendationScreen/Images.xcassets/AppIcon.appiconset/Contents.json +0 -0
- package/ios/HediaRecommendationScreen/Images.xcassets/Contents.json +0 -0
- package/ios/HediaRecommendationScreen/Info.plist +0 -0
- package/ios/HediaRecommendationScreen/main.m +0 -0
- package/ios/HediaRecommendationScreen-tvOS/Info.plist +0 -0
- package/ios/HediaRecommendationScreen-tvOSTests/Info.plist +0 -0
- package/ios/HediaRecommendationScreen.xcodeproj/project.pbxproj +0 -0
- package/ios/HediaRecommendationScreen.xcodeproj/xcshareddata/xcschemes/HediaRecommendationScreen-tvOS.xcscheme +0 -0
- package/ios/HediaRecommendationScreen.xcodeproj/xcshareddata/xcschemes/HediaRecommendationScreen.xcscheme +0 -0
- package/ios/HediaRecommendationScreen.xcworkspace/contents.xcworkspacedata +0 -0
- package/ios/HediaRecommendationScreen.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -0
- package/ios/HediaRecommendationScreenTests/HediaRecommendationScreenTests.m +0 -0
- package/ios/HediaRecommendationScreenTests/Info.plist +0 -0
- package/ios/Podfile +0 -0
- package/ios/Podfile.lock +0 -0
- package/jest.config.js +0 -0
- package/jest.mock.js +0 -0
- package/metro.config.js +0 -0
- package/package.json +8 -10
- package/react-native.config.js +0 -0
- package/src/RecommendationScreen.d.ts +18 -20
- package/src/RecommendationScreen.jsx +26 -15
- package/src/RecommendationScreen.tsx +60 -37
- package/src/__tests__/RecommendationScreen.test.d.ts +0 -0
- package/src/__tests__/RecommendationScreen.test.jsx +163 -138
- package/src/__tests__/RecommendationScreen.test.tsx +256 -159
- package/src/__tests__/RecommendationUtils.test.d.ts +0 -0
- package/src/__tests__/RecommendationUtils.test.js +30 -39
- package/src/__tests__/RecommendationUtils.test.ts +38 -43
- package/src/__tests__/Translate.test.d.ts +0 -0
- package/src/__tests__/Translate.test.jsx +13 -12
- package/src/__tests__/Translate.test.tsx +15 -14
- package/src/__tests__/Utils.test.d.ts +0 -0
- package/src/__tests__/Utils.test.js +22 -20
- package/src/__tests__/Utils.test.ts +32 -21
- package/src/__tests__/Validations.test.d.ts +0 -0
- package/src/__tests__/Validations.test.js +59 -33
- package/src/__tests__/Validations.test.ts +83 -41
- package/src/__tests__/components/Activity.test.d.ts +0 -0
- package/src/__tests__/components/Activity.test.jsx +39 -18
- package/src/__tests__/components/Activity.test.tsx +99 -45
- package/src/__tests__/components/Emotion.test.d.ts +0 -0
- package/src/__tests__/components/Emotion.test.jsx +34 -25
- package/src/__tests__/components/Emotion.test.tsx +41 -24
- package/src/__tests__/components/Header.test.d.ts +0 -0
- package/src/__tests__/components/Header.test.jsx +10 -9
- package/src/__tests__/components/Header.test.tsx +12 -11
- package/src/__tests__/components/InfoBars.test.d.ts +0 -0
- package/src/__tests__/components/InfoBars.test.jsx +1 -0
- package/src/__tests__/components/InfoBars.test.tsx +7 -6
- package/src/__tests__/components/InvisibleNumberInput.test.d.ts +0 -0
- package/src/__tests__/components/InvisibleNumberInput.test.jsx +40 -24
- package/src/__tests__/components/InvisibleNumberInput.test.tsx +41 -17
- package/src/__tests__/components/LimitationMessage.test.d.ts +0 -0
- package/src/__tests__/components/LimitationMessage.test.jsx +11 -30
- package/src/__tests__/components/LimitationMessage.test.tsx +15 -13
- package/src/__tests__/components/MoodIcon.test.d.ts +0 -0
- package/src/__tests__/components/MoodIcon.test.jsx +12 -8
- package/src/__tests__/components/MoodIcon.test.tsx +13 -5
- package/src/__tests__/components/RecommendationModal.test.d.ts +0 -0
- package/src/__tests__/components/RecommendationModal.test.jsx +22 -21
- package/src/__tests__/components/RecommendationModal.test.tsx +29 -27
- package/src/__tests__/components/RecommendedCarbs.test.d.ts +0 -0
- package/src/__tests__/components/RecommendedCarbs.test.jsx +7 -10
- package/src/__tests__/components/RecommendedCarbs.test.tsx +9 -10
- package/src/__tests__/components/RecommendedInsulin.test.d.ts +0 -0
- package/src/__tests__/components/RecommendedInsulin.test.jsx +57 -41
- package/src/__tests__/components/RecommendedInsulin.test.tsx +57 -31
- package/src/__tests__/components/Remeasure.test.d.ts +0 -0
- package/src/__tests__/components/Remeasure.test.jsx +7 -3
- package/src/__tests__/components/Remeasure.test.tsx +11 -3
- package/src/__tests__/components/TransferToLogbook.test.d.ts +0 -0
- package/src/__tests__/components/TransferToLogbook.test.jsx +2 -2
- package/src/__tests__/components/TransferToLogbook.test.tsx +2 -2
- package/src/__tests__/components/TwoOptionModal.test.d.ts +0 -0
- package/src/__tests__/components/TwoOptionModal.test.jsx +5 -4
- package/src/__tests__/components/TwoOptionModal.test.tsx +6 -4
- package/src/__tests__/utils.d.ts +7 -2
- package/src/__tests__/utils.jsx +59 -15
- package/src/__tests__/utils.tsx +63 -16
- 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/assets/mood/happy.png +0 -0
- package/src/assets/mood/happy_active.png +0 -0
- package/src/assets/mood/neutral.png +0 -0
- package/src/assets/mood/neutral_active.png +0 -0
- package/src/assets/mood/sad.png +0 -0
- package/src/assets/mood/sad_active.png +0 -0
- package/src/assets/mood/semi_happy.png +0 -0
- package/src/assets/mood/semi_happy_active.png +0 -0
- package/src/assets/mood/semi_sad.png +0 -0
- package/src/assets/mood/semi_sad_active.png +0 -0
- package/src/components/Header.d.ts +0 -0
- package/src/components/Header.jsx +2 -1
- package/src/components/Header.tsx +2 -1
- package/src/components/Icon.js +0 -0
- package/src/components/InfoBars.d.ts +1 -1
- package/src/components/InfoBars.jsx +0 -0
- package/src/components/InfoBars.tsx +1 -1
- package/src/components/InvisibleNumberInput.d.ts +2 -1
- package/src/components/InvisibleNumberInput.jsx +7 -2
- package/src/components/InvisibleNumberInput.tsx +10 -3
- package/src/components/LimitationMessage.d.ts +1 -1
- package/src/components/LimitationMessage.jsx +3 -2
- package/src/components/LimitationMessage.tsx +3 -1
- package/src/components/LineSeparator.d.ts +0 -0
- package/src/components/LineSeparator.jsx +0 -0
- package/src/components/LineSeparator.tsx +0 -0
- package/src/components/RecentInsulin.d.ts +0 -0
- package/src/components/RecentInsulin.jsx +3 -2
- package/src/components/RecentInsulin.tsx +3 -0
- package/src/components/RecommendationModal.d.ts +4 -4
- package/src/components/RecommendationModal.jsx +10 -9
- package/src/components/RecommendationModal.tsx +19 -8
- package/src/components/RecommendedCarbs.d.ts +4 -3
- package/src/components/RecommendedCarbs.jsx +12 -9
- package/src/components/RecommendedCarbs.tsx +31 -16
- package/src/components/RecommendedInsulin.d.ts +7 -7
- package/src/components/RecommendedInsulin.jsx +11 -7
- package/src/components/RecommendedInsulin.tsx +24 -12
- package/src/components/Remeasure.d.ts +2 -2
- package/src/components/Remeasure.jsx +7 -2
- package/src/components/Remeasure.tsx +10 -4
- package/src/components/TransferToLogbook.d.ts +0 -0
- package/src/components/TransferToLogbook.jsx +2 -1
- package/src/components/TransferToLogbook.tsx +2 -0
- package/src/components/TwoOptionModal.d.ts +5 -3
- package/src/components/TwoOptionModal.jsx +44 -13
- package/src/components/TwoOptionModal.tsx +50 -14
- package/src/components/activity/Activity.d.ts +2 -3
- package/src/components/activity/Activity.jsx +5 -2
- package/src/components/activity/Activity.tsx +7 -5
- package/src/components/activity/ActivityIcon.d.ts +1 -1
- package/src/components/activity/ActivityIcon.jsx +9 -8
- package/src/components/activity/ActivityIcon.tsx +12 -10
- package/src/components/activity/ActivityIntensity.d.ts +1 -1
- package/src/components/activity/ActivityIntensity.jsx +2 -8
- package/src/components/activity/ActivityIntensity.tsx +3 -12
- package/src/components/mood/Emotion.d.ts +5 -4
- package/src/components/mood/Emotion.jsx +4 -3
- package/src/components/mood/Emotion.tsx +9 -7
- package/src/components/mood/MoodIcon.d.ts +2 -2
- package/src/components/mood/MoodIcon.jsx +3 -2
- package/src/components/mood/MoodIcon.tsx +4 -2
- package/src/locale/CleanLanguage.ts +0 -0
- package/src/locale/da/messages.js +1 -1
- package/src/locale/da/messages.po +115 -107
- package/src/locale/de/messages.js +1 -1
- package/src/locale/de/messages.po +115 -107
- package/src/locale/en/messages.js +1 -1
- package/src/locale/en/messages.po +118 -110
- package/src/locale/es/messages.js +1 -1
- package/src/locale/es/messages.po +112 -104
- package/src/locale/fr/messages.js +1 -1
- package/src/locale/fr/messages.po +111 -103
- package/src/locale/i18nUtils.d.ts +3 -4
- package/src/locale/i18nUtils.js +13 -12
- package/src/locale/i18nUtils.ts +14 -14
- package/src/locale/it/messages.js +1 -1
- package/src/locale/it/messages.po +113 -105
- package/src/types/enum.d.ts +52 -44
- package/src/types/enum.js +67 -56
- package/src/types/enum.ts +58 -34
- package/src/types/types.d.ts +9 -23
- package/src/types/types.js +0 -0
- package/src/types/types.ts +9 -25
- package/src/utils/AttentionMessages.d.ts +1 -4
- package/src/utils/AttentionMessages.jsx +8 -30
- package/src/utils/AttentionMessages.tsx +11 -16
- package/src/utils/Constants.d.ts +0 -0
- package/src/utils/Constants.js +0 -0
- package/src/utils/Constants.ts +0 -0
- package/src/utils/RecommendationError.d.ts +2 -0
- package/src/utils/RecommendationError.jsx +45 -40
- package/src/utils/RecommendationError.tsx +17 -4
- package/src/utils/RecommendationUtils.d.ts +7 -8
- package/src/utils/RecommendationUtils.js +15 -7
- package/src/utils/RecommendationUtils.ts +24 -14
- package/src/utils/Translations.d.ts +2 -0
- package/src/utils/Translations.js +10 -0
- package/src/utils/Translations.ts +9 -0
- package/src/utils/Utils.d.ts +4 -5
- package/src/utils/Utils.js +6 -5
- package/src/utils/Utils.ts +10 -8
- package/src/utils/Validations.d.ts +10 -9
- package/src/utils/Validations.js +61 -65
- package/src/utils/Validations.ts +76 -81
- package/tsconfig.json +2 -2
- package/tslint.json +0 -0
|
@@ -7,6 +7,7 @@ const macro_1 = require("@lingui/macro");
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const react_native_1 = require("react-native");
|
|
9
9
|
const i18nUtils_1 = require("../locale/i18nUtils");
|
|
10
|
+
const enum_1 = require("../types/enum");
|
|
10
11
|
const Constants_1 = require("../utils/Constants");
|
|
11
12
|
const RecommendationError_1 = require("../utils/RecommendationError");
|
|
12
13
|
const Icon_1 = __importDefault(require("./Icon"));
|
|
@@ -17,7 +18,7 @@ class RecommendedCarbs extends react_1.default.Component {
|
|
|
17
18
|
constructor() {
|
|
18
19
|
super(...arguments);
|
|
19
20
|
this.state = {
|
|
20
|
-
partialInput:
|
|
21
|
+
partialInput: undefined,
|
|
21
22
|
};
|
|
22
23
|
this.showTextInput = () => {
|
|
23
24
|
this.callbackInput?.();
|
|
@@ -47,7 +48,7 @@ class RecommendedCarbs extends react_1.default.Component {
|
|
|
47
48
|
<LineSeparator_1.default color={Constants_1.BORDER_COLOUR_GREY}/>
|
|
48
49
|
<react_native_1.View style={calculationStyles.borderContainer}>
|
|
49
50
|
<react_native_1.View style={calculationStyles.recommendedContainer}>
|
|
50
|
-
<react_native_1.TouchableOpacity accessibilityLabel="removeRecommendedCarbs" style={calculationStyles.removeRecommended} onPress={this.props.removeRecommendedCarbs}>
|
|
51
|
+
<react_native_1.TouchableOpacity testID={enum_1.RecommendedCarbsTestIds.RemoveRecommendation} accessibilityLabel="removeRecommendedCarbs" style={calculationStyles.removeRecommended} onPress={this.props.removeRecommendedCarbs}>
|
|
51
52
|
<Icon_1.default iconIdentifier={`Ionicons/ios-close-circle-outline`} style={calculationStyles.removeRecommendedIcon}/>
|
|
52
53
|
</react_native_1.TouchableOpacity>
|
|
53
54
|
<react_native_1.Text style={calculationStyles.recommendedLabel}>{i18nUtils_1.i18n._(macro_1.t `Recommended`)}</react_native_1.Text>
|
|
@@ -58,9 +59,9 @@ class RecommendedCarbs extends react_1.default.Component {
|
|
|
58
59
|
<react_native_1.Text style={calculationStyles.recommendedLabel}>{i18nUtils_1.i18n._(macro_1.t `Additional`)}</react_native_1.Text>
|
|
59
60
|
</react_native_1.View>
|
|
60
61
|
<react_native_1.View style={calculationStyles.valueUnitContainer}>
|
|
61
|
-
<react_native_1.TouchableOpacity accessibilityLabel="editRecommendedCarbsButton" onPress={this.showTextInput} style={[calculationStyles.valueUnitContainer]}>
|
|
62
|
+
<react_native_1.TouchableOpacity testID={enum_1.RecommendedCarbsTestIds.EditRecommendedCarbs} accessibilityLabel="editRecommendedCarbsButton" onPress={this.showTextInput} style={[calculationStyles.valueUnitContainer]}>
|
|
62
63
|
<react_native_1.View style={calculationStyles.valueContainer}>
|
|
63
|
-
<react_native_1.Text style={[calculationStyles.value, { color: Constants_1.BORDER_COLOUR_TEAL }]}>
|
|
64
|
+
<react_native_1.Text testID={enum_1.RecommendedCarbsTestIds.RecommendedCarbs} style={[calculationStyles.value, { color: Constants_1.BORDER_COLOUR_TEAL }]}>
|
|
64
65
|
{shownCarbs}
|
|
65
66
|
</react_native_1.Text>
|
|
66
67
|
</react_native_1.View>
|
|
@@ -80,18 +81,20 @@ class RecommendedCarbs extends react_1.default.Component {
|
|
|
80
81
|
label: i18nUtils_1.i18n._(macro_1.t `Total`),
|
|
81
82
|
value: totalCarbs.toString(),
|
|
82
83
|
units: i18nUtils_1.i18n._(macro_1.t `grams`),
|
|
83
|
-
})}
|
|
84
|
-
<InvisibleNumberInput_1.default negativeAllowed={false} cleanPartialInput={true} decimalPlaces={0} visible={(callback) => (this.callbackInput = callback)} partialInput={this.handlePartialInput} onEnd={this.handleChangedCarbs} startValue={this.props.recommendedCarbs} maxLength={3}/>
|
|
84
|
+
}, enum_1.RecommendedCarbsTestIds.TotalCarbs)}
|
|
85
|
+
<InvisibleNumberInput_1.default testID={enum_1.RecommendedCarbsTestIds.InvisibleCarbInput} negativeAllowed={false} cleanPartialInput={true} decimalPlaces={0} visible={(callback) => (this.callbackInput = callback)} partialInput={this.handlePartialInput} onEnd={this.handleChangedCarbs} startValue={this.props.recommendedCarbs} maxLength={3}/>
|
|
85
86
|
</react_1.default.Fragment>);
|
|
86
87
|
};
|
|
87
|
-
this.renderRow = (row) => {
|
|
88
|
+
this.renderRow = (row, testID) => {
|
|
88
89
|
return (<react_native_1.View style={[calculationStyles.borderContainer, { paddingVertical: `1%` }]}>
|
|
89
90
|
<react_native_1.View style={calculationStyles.rowContainer}>
|
|
90
91
|
<react_native_1.Text style={calculationStyles.rowLabel}>{row.label}</react_native_1.Text>
|
|
91
92
|
</react_native_1.View>
|
|
92
93
|
<react_native_1.View style={calculationStyles.valueUnitContainer}>
|
|
93
94
|
<react_native_1.View style={calculationStyles.valueContainer}>
|
|
94
|
-
<react_native_1.Text style={calculationStyles.value}>
|
|
95
|
+
<react_native_1.Text testID={testID} style={calculationStyles.value}>
|
|
96
|
+
{row.value}
|
|
97
|
+
</react_native_1.Text>
|
|
95
98
|
</react_native_1.View>
|
|
96
99
|
<react_native_1.View style={calculationStyles.unitContainer}>
|
|
97
100
|
<react_native_1.Text style={calculationStyles.units}>{row.units}</react_native_1.Text>
|
|
@@ -111,7 +114,7 @@ class RecommendedCarbs extends react_1.default.Component {
|
|
|
111
114
|
label: i18nUtils_1.i18n._(macro_1.t `Entered`),
|
|
112
115
|
value: this.props.enteredCarbs,
|
|
113
116
|
units: i18nUtils_1.i18n._(macro_1.t `grams`),
|
|
114
|
-
})}
|
|
117
|
+
}, enum_1.RecommendedCarbsTestIds.EnteredCarbs)}
|
|
115
118
|
{!isNaN(carbs) && carbs > 0 ? this.renderRecommendedCarbs() : null}
|
|
116
119
|
</react_1.default.Fragment>);
|
|
117
120
|
}
|
|
@@ -2,6 +2,7 @@ import { t } from "@lingui/macro";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Alert, Dimensions, StyleSheet, Text, TouchableOpacity, View } from "react-native";
|
|
4
4
|
import { i18n } from "../locale/i18nUtils";
|
|
5
|
+
import { RecommendedCarbsTestIds } from "../types/enum";
|
|
5
6
|
import { BORDER_COLOUR_GREY, BORDER_COLOUR_TEAL } from "../utils/Constants";
|
|
6
7
|
import { CarbohydrateLimitError } from "../utils/RecommendationError";
|
|
7
8
|
import Icon from "./Icon";
|
|
@@ -26,15 +27,15 @@ interface IProps {
|
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
interface IState {
|
|
29
|
-
partialInput
|
|
30
|
+
partialInput?: string;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
export default class RecommendedCarbs extends React.Component<IProps, IState> {
|
|
33
34
|
public state: IState = {
|
|
34
|
-
partialInput:
|
|
35
|
+
partialInput: undefined,
|
|
35
36
|
};
|
|
36
37
|
|
|
37
|
-
public callbackInput
|
|
38
|
+
public callbackInput?: () => void;
|
|
38
39
|
|
|
39
40
|
public showTextInput = (): void => {
|
|
40
41
|
this.callbackInput?.();
|
|
@@ -69,6 +70,7 @@ export default class RecommendedCarbs extends React.Component<IProps, IState> {
|
|
|
69
70
|
<View style={calculationStyles.borderContainer}>
|
|
70
71
|
<View style={calculationStyles.recommendedContainer}>
|
|
71
72
|
<TouchableOpacity
|
|
73
|
+
testID={RecommendedCarbsTestIds.RemoveRecommendation}
|
|
72
74
|
accessibilityLabel="removeRecommendedCarbs"
|
|
73
75
|
style={calculationStyles.removeRecommended}
|
|
74
76
|
onPress={this.props.removeRecommendedCarbs}
|
|
@@ -87,12 +89,16 @@ export default class RecommendedCarbs extends React.Component<IProps, IState> {
|
|
|
87
89
|
</View>
|
|
88
90
|
<View style={calculationStyles.valueUnitContainer}>
|
|
89
91
|
<TouchableOpacity
|
|
92
|
+
testID={RecommendedCarbsTestIds.EditRecommendedCarbs}
|
|
90
93
|
accessibilityLabel="editRecommendedCarbsButton"
|
|
91
94
|
onPress={this.showTextInput}
|
|
92
95
|
style={[calculationStyles.valueUnitContainer]}
|
|
93
96
|
>
|
|
94
97
|
<View style={calculationStyles.valueContainer}>
|
|
95
|
-
<Text
|
|
98
|
+
<Text
|
|
99
|
+
testID={RecommendedCarbsTestIds.RecommendedCarbs}
|
|
100
|
+
style={[calculationStyles.value, { color: BORDER_COLOUR_TEAL }]}
|
|
101
|
+
>
|
|
96
102
|
{shownCarbs}
|
|
97
103
|
</Text>
|
|
98
104
|
</View>
|
|
@@ -108,12 +114,16 @@ export default class RecommendedCarbs extends React.Component<IProps, IState> {
|
|
|
108
114
|
</View>
|
|
109
115
|
</View>
|
|
110
116
|
<LineSeparator color={BORDER_COLOUR_TEAL} />
|
|
111
|
-
{this.renderRow(
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
{this.renderRow(
|
|
118
|
+
{
|
|
119
|
+
label: i18n._(t`Total`),
|
|
120
|
+
value: totalCarbs.toString(),
|
|
121
|
+
units: i18n._(t`grams`),
|
|
122
|
+
},
|
|
123
|
+
RecommendedCarbsTestIds.TotalCarbs,
|
|
124
|
+
)}
|
|
116
125
|
<InvisibleNumberInput
|
|
126
|
+
testID={RecommendedCarbsTestIds.InvisibleCarbInput}
|
|
117
127
|
negativeAllowed={false}
|
|
118
128
|
cleanPartialInput={true}
|
|
119
129
|
decimalPlaces={0}
|
|
@@ -127,7 +137,7 @@ export default class RecommendedCarbs extends React.Component<IProps, IState> {
|
|
|
127
137
|
);
|
|
128
138
|
};
|
|
129
139
|
|
|
130
|
-
public renderRow = (row: ICalculationRow): JSX.Element => {
|
|
140
|
+
public renderRow = (row: ICalculationRow, testID: RecommendedCarbsTestIds): JSX.Element => {
|
|
131
141
|
return (
|
|
132
142
|
<View style={[calculationStyles.borderContainer, { paddingVertical: `1%` }]}>
|
|
133
143
|
<View style={calculationStyles.rowContainer}>
|
|
@@ -135,7 +145,9 @@ export default class RecommendedCarbs extends React.Component<IProps, IState> {
|
|
|
135
145
|
</View>
|
|
136
146
|
<View style={calculationStyles.valueUnitContainer}>
|
|
137
147
|
<View style={calculationStyles.valueContainer}>
|
|
138
|
-
<Text style={calculationStyles.value}>
|
|
148
|
+
<Text testID={testID} style={calculationStyles.value}>
|
|
149
|
+
{row.value}
|
|
150
|
+
</Text>
|
|
139
151
|
</View>
|
|
140
152
|
<View style={calculationStyles.unitContainer}>
|
|
141
153
|
<Text style={calculationStyles.units}>{row.units}</Text>
|
|
@@ -153,11 +165,14 @@ export default class RecommendedCarbs extends React.Component<IProps, IState> {
|
|
|
153
165
|
<Text style={infoStyles.label}>{i18n._(t`Food`)}</Text>
|
|
154
166
|
<Text style={calculationStyles.foodUnitsLabel}>{`(${i18n._(t`Carbohydrates`)})`}</Text>
|
|
155
167
|
</View>
|
|
156
|
-
{this.renderRow(
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
168
|
+
{this.renderRow(
|
|
169
|
+
{
|
|
170
|
+
label: i18n._(t`Entered`),
|
|
171
|
+
value: this.props.enteredCarbs,
|
|
172
|
+
units: i18n._(t`grams`),
|
|
173
|
+
},
|
|
174
|
+
RecommendedCarbsTestIds.EnteredCarbs,
|
|
175
|
+
)}
|
|
161
176
|
{!isNaN(carbs) && carbs > 0 ? this.renderRecommendedCarbs() : null}
|
|
162
177
|
</React.Fragment>
|
|
163
178
|
);
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
import { UserSettings } from "@hedia/types";
|
|
1
2
|
import React from "react";
|
|
2
|
-
import { InjectionMethod } from "../types/enum";
|
|
3
3
|
interface IProps {
|
|
4
|
-
insulinRecommendation
|
|
5
|
-
enteredInsulin
|
|
6
|
-
activityReduction
|
|
7
|
-
injectionMethod: InjectionMethod;
|
|
4
|
+
insulinRecommendation: number;
|
|
5
|
+
enteredInsulin: number | null;
|
|
6
|
+
activityReduction: number | null;
|
|
7
|
+
injectionMethod: UserSettings.Enums.InjectionMethod;
|
|
8
8
|
updateRecommendedInsulin(value: number): void;
|
|
9
9
|
}
|
|
10
10
|
interface IState {
|
|
11
|
-
partialInput
|
|
11
|
+
partialInput?: string;
|
|
12
12
|
}
|
|
13
13
|
export default class RecommendedInsulin extends React.Component<IProps, IState> {
|
|
14
|
-
callbackInput
|
|
14
|
+
callbackInput?: () => void;
|
|
15
15
|
constructor(props: IProps);
|
|
16
16
|
componentDidUpdate(prevProps: IProps): void;
|
|
17
17
|
handleOnPress: () => void;
|
|
@@ -3,17 +3,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const types_1 = require("@hedia/types");
|
|
7
7
|
const macro_1 = require("@lingui/macro");
|
|
8
8
|
const react_1 = __importDefault(require("react"));
|
|
9
9
|
const react_native_1 = require("react-native");
|
|
10
10
|
const react_native_linear_gradient_1 = __importDefault(require("react-native-linear-gradient"));
|
|
11
11
|
const i18nUtils_1 = require("../locale/i18nUtils");
|
|
12
|
+
const enum_1 = require("../types/enum");
|
|
12
13
|
const AttentionMessages_1 = require("../utils/AttentionMessages");
|
|
13
14
|
const Utils_1 = require("../utils/Utils");
|
|
14
15
|
const Icon_1 = __importDefault(require("./Icon"));
|
|
15
16
|
const InfoBars_1 = require("./InfoBars");
|
|
16
17
|
const InvisibleNumberInput_1 = __importDefault(require("./InvisibleNumberInput"));
|
|
18
|
+
const SAFETY_INSULIN_LIMIT = types_1.BolusCalculator.Constants.SAFETY_INSULIN_LIMIT;
|
|
17
19
|
class RecommendedInsulin extends react_1.default.Component {
|
|
18
20
|
constructor(props) {
|
|
19
21
|
super(props);
|
|
@@ -30,9 +32,9 @@ class RecommendedInsulin extends react_1.default.Component {
|
|
|
30
32
|
this.handleUpdatedInsulin = (value) => {
|
|
31
33
|
const rounded = Utils_1.Utils.roundValue(value, this.props.injectionMethod);
|
|
32
34
|
// https://hedia.atlassian.net/browse/HDA-795
|
|
33
|
-
const limited = (1 - (this.props.activityReduction ?? 0)) *
|
|
35
|
+
const limited = (1 - (this.props.activityReduction ?? 0)) * SAFETY_INSULIN_LIMIT;
|
|
34
36
|
if (rounded > limited) {
|
|
35
|
-
this.setState({ partialInput: this.props.insulinRecommendation?.toString() });
|
|
37
|
+
this.setState({ partialInput: this.props.insulinRecommendation?.toString() ?? null });
|
|
36
38
|
this.props.updateRecommendedInsulin(this.props.insulinRecommendation);
|
|
37
39
|
return react_native_1.Alert.alert(i18nUtils_1.i18n._(macro_1.t `Attention`), AttentionMessages_1.Messages.InsulinInputWasLimited(this.props.activityReduction), [
|
|
38
40
|
{
|
|
@@ -47,7 +49,7 @@ class RecommendedInsulin extends react_1.default.Component {
|
|
|
47
49
|
const paddingBottom = react_native_1.Platform.OS === `ios` ? `3%` : `1%`;
|
|
48
50
|
const shownInsulin = this.state.partialInput ?? this.props.insulinRecommendation ?? `0`;
|
|
49
51
|
return (<react_1.default.Fragment>
|
|
50
|
-
<react_native_1.TouchableOpacity accessibilityLabel="editRecommendedInsulin" onPress={this.handleOnPress}>
|
|
52
|
+
<react_native_1.TouchableOpacity accessibilityLabel="editRecommendedInsulin" testID={enum_1.RecommendedInsulinTestIds.EditRecommendedInsulin} onPress={this.handleOnPress}>
|
|
51
53
|
<react_native_linear_gradient_1.default style={recommendedInsulinStyles.container} colors={[`#a200ff`, `#578aff`]} start={{ x: 0, y: 0 }} end={{ x: 1, y: 0 }}>
|
|
52
54
|
<react_native_1.View style={recommendedInsulinStyles.recommendedTextContainer}>
|
|
53
55
|
<react_native_1.Text style={recommendedInsulinStyles.recommendedText}>
|
|
@@ -56,18 +58,20 @@ class RecommendedInsulin extends react_1.default.Component {
|
|
|
56
58
|
</react_native_1.View>
|
|
57
59
|
<react_native_1.View style={[recommendedInsulinStyles.recommendedContainer, { paddingBottom }]}>
|
|
58
60
|
<react_native_1.View style={recommendedInsulinStyles.valueContainer}>
|
|
59
|
-
<react_native_1.Text style={recommendedInsulinStyles.value}
|
|
61
|
+
<react_native_1.Text style={recommendedInsulinStyles.value} testID={enum_1.RecommendedInsulinTestIds.ShownInsulinText}>
|
|
62
|
+
{shownInsulin}
|
|
63
|
+
</react_native_1.Text>
|
|
60
64
|
<react_native_1.Text style={recommendedInsulinStyles.units}>{i18nUtils_1.i18n._(macro_1.t `Units`)}</react_native_1.Text>
|
|
61
65
|
</react_native_1.View>
|
|
62
66
|
<Icon_1.default style={recommendedInsulinStyles.editIcon} iconIdentifier={`Feather/edit`}/>
|
|
63
67
|
</react_native_1.View>
|
|
64
68
|
</react_native_linear_gradient_1.default>
|
|
65
69
|
</react_native_1.TouchableOpacity>
|
|
66
|
-
<InvisibleNumberInput_1.default decimalPlaces={3} negativeAllowed={false} cleanPartialInput={false} partialInput={this.updatePartially} onEnd={this.handleUpdatedInsulin} visible={(visible) => (this.callbackInput = visible)} startValue={`${shownInsulin}`}/>
|
|
70
|
+
<InvisibleNumberInput_1.default testID={enum_1.RecommendedInsulinTestIds.InvisibleInsulinInput} decimalPlaces={3} negativeAllowed={false} cleanPartialInput={false} partialInput={this.updatePartially} onEnd={this.handleUpdatedInsulin} visible={(visible) => (this.callbackInput = visible)} startValue={`${shownInsulin}`}/>
|
|
67
71
|
</react_1.default.Fragment>);
|
|
68
72
|
};
|
|
69
73
|
this.state = {
|
|
70
|
-
partialInput:
|
|
74
|
+
partialInput: undefined,
|
|
71
75
|
};
|
|
72
76
|
}
|
|
73
77
|
componentDidUpdate(prevProps) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BolusCalculator, UserSettings } from "@hedia/types";
|
|
2
2
|
import { t } from "@lingui/macro";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { Alert, Dimensions, Platform, StyleSheet, Text, TouchableOpacity, View } from "react-native";
|
|
5
5
|
import LinearGradient from "react-native-linear-gradient";
|
|
6
6
|
import { i18n } from "../locale/i18nUtils";
|
|
7
|
-
import {
|
|
7
|
+
import { RecommendedInsulinTestIds } from "../types/enum";
|
|
8
8
|
import { Messages } from "../utils/AttentionMessages";
|
|
9
9
|
import { Utils } from "../utils/Utils";
|
|
10
10
|
import Icon from "./Icon";
|
|
@@ -13,27 +13,29 @@ import InvisibleNumberInput from "./InvisibleNumberInput";
|
|
|
13
13
|
|
|
14
14
|
interface IProps {
|
|
15
15
|
// Values
|
|
16
|
-
insulinRecommendation
|
|
17
|
-
enteredInsulin
|
|
18
|
-
activityReduction
|
|
19
|
-
injectionMethod: InjectionMethod;
|
|
16
|
+
insulinRecommendation: number;
|
|
17
|
+
enteredInsulin: number | null;
|
|
18
|
+
activityReduction: number | null;
|
|
19
|
+
injectionMethod: UserSettings.Enums.InjectionMethod;
|
|
20
20
|
|
|
21
21
|
// Callbacks
|
|
22
22
|
updateRecommendedInsulin(value: number): void;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
interface IState {
|
|
26
|
-
partialInput
|
|
26
|
+
partialInput?: string;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
const SAFETY_INSULIN_LIMIT = BolusCalculator.Constants.SAFETY_INSULIN_LIMIT;
|
|
30
|
+
|
|
29
31
|
export default class RecommendedInsulin extends React.Component<IProps, IState> {
|
|
30
|
-
public callbackInput
|
|
32
|
+
public callbackInput?: () => void;
|
|
31
33
|
|
|
32
34
|
constructor(props: IProps) {
|
|
33
35
|
super(props);
|
|
34
36
|
|
|
35
37
|
this.state = {
|
|
36
|
-
partialInput:
|
|
38
|
+
partialInput: undefined,
|
|
37
39
|
};
|
|
38
40
|
}
|
|
39
41
|
|
|
@@ -64,7 +66,7 @@ export default class RecommendedInsulin extends React.Component<IProps, IState>
|
|
|
64
66
|
const limited = (1 - (this.props.activityReduction ?? 0)) * SAFETY_INSULIN_LIMIT;
|
|
65
67
|
|
|
66
68
|
if (rounded > limited) {
|
|
67
|
-
this.setState({ partialInput: this.props.insulinRecommendation?.toString() });
|
|
69
|
+
this.setState({ partialInput: this.props.insulinRecommendation?.toString() ?? null });
|
|
68
70
|
this.props.updateRecommendedInsulin(this.props.insulinRecommendation);
|
|
69
71
|
return Alert.alert(i18n._(t`Attention`), Messages.InsulinInputWasLimited(this.props.activityReduction), [
|
|
70
72
|
{
|
|
@@ -81,7 +83,11 @@ export default class RecommendedInsulin extends React.Component<IProps, IState>
|
|
|
81
83
|
const shownInsulin = this.state.partialInput ?? this.props.insulinRecommendation ?? `0`;
|
|
82
84
|
return (
|
|
83
85
|
<React.Fragment>
|
|
84
|
-
<TouchableOpacity
|
|
86
|
+
<TouchableOpacity
|
|
87
|
+
accessibilityLabel="editRecommendedInsulin"
|
|
88
|
+
testID={RecommendedInsulinTestIds.EditRecommendedInsulin}
|
|
89
|
+
onPress={this.handleOnPress}
|
|
90
|
+
>
|
|
85
91
|
<LinearGradient
|
|
86
92
|
style={recommendedInsulinStyles.container}
|
|
87
93
|
colors={[`#a200ff`, `#578aff`]}
|
|
@@ -95,7 +101,12 @@ export default class RecommendedInsulin extends React.Component<IProps, IState>
|
|
|
95
101
|
</View>
|
|
96
102
|
<View style={[recommendedInsulinStyles.recommendedContainer, { paddingBottom }]}>
|
|
97
103
|
<View style={recommendedInsulinStyles.valueContainer}>
|
|
98
|
-
<Text
|
|
104
|
+
<Text
|
|
105
|
+
style={recommendedInsulinStyles.value}
|
|
106
|
+
testID={RecommendedInsulinTestIds.ShownInsulinText}
|
|
107
|
+
>
|
|
108
|
+
{shownInsulin}
|
|
109
|
+
</Text>
|
|
99
110
|
<Text style={recommendedInsulinStyles.units}>{i18n._(t`Units`)}</Text>
|
|
100
111
|
</View>
|
|
101
112
|
<Icon style={recommendedInsulinStyles.editIcon} iconIdentifier={`Feather/edit`} />
|
|
@@ -103,6 +114,7 @@ export default class RecommendedInsulin extends React.Component<IProps, IState>
|
|
|
103
114
|
</LinearGradient>
|
|
104
115
|
</TouchableOpacity>
|
|
105
116
|
<InvisibleNumberInput
|
|
117
|
+
testID={RecommendedInsulinTestIds.InvisibleInsulinInput}
|
|
106
118
|
decimalPlaces={3}
|
|
107
119
|
negativeAllowed={false}
|
|
108
120
|
cleanPartialInput={false}
|
|
@@ -3,8 +3,8 @@ interface IProps {
|
|
|
3
3
|
remeasureTime: number;
|
|
4
4
|
onSliderChange(value: number): void;
|
|
5
5
|
}
|
|
6
|
-
export default class Remeasure extends React.Component<IProps
|
|
7
|
-
private slider
|
|
6
|
+
export default class Remeasure extends React.Component<IProps> {
|
|
7
|
+
private slider?;
|
|
8
8
|
componentDidMount(): void;
|
|
9
9
|
handleSliderChange: (remeasureTime: number) => void;
|
|
10
10
|
limitTime: (remeasureTime: number) => number;
|
|
@@ -8,6 +8,7 @@ const slider_1 = __importDefault(require("@react-native-community/slider"));
|
|
|
8
8
|
const react_1 = __importDefault(require("react"));
|
|
9
9
|
const react_native_1 = require("react-native");
|
|
10
10
|
const i18nUtils_1 = require("../locale/i18nUtils");
|
|
11
|
+
const enum_1 = require("../types/enum");
|
|
11
12
|
const Constants_1 = require("../utils/Constants");
|
|
12
13
|
const InfoBars_1 = require("./InfoBars");
|
|
13
14
|
class Remeasure extends react_1.default.Component {
|
|
@@ -22,7 +23,7 @@ class Remeasure extends react_1.default.Component {
|
|
|
22
23
|
};
|
|
23
24
|
}
|
|
24
25
|
componentDidMount() {
|
|
25
|
-
this.slider
|
|
26
|
+
this.slider?.setNativeProps({
|
|
26
27
|
value: this.props.remeasureTime,
|
|
27
28
|
});
|
|
28
29
|
}
|
|
@@ -45,7 +46,11 @@ class Remeasure extends react_1.default.Component {
|
|
|
45
46
|
</react_native_1.View>) : null}
|
|
46
47
|
</react_native_1.View>
|
|
47
48
|
</react_native_1.View>
|
|
48
|
-
<slider_1.default ref={(slider) =>
|
|
49
|
+
<slider_1.default ref={(slider) => {
|
|
50
|
+
if (slider !== null) {
|
|
51
|
+
this.slider = slider;
|
|
52
|
+
}
|
|
53
|
+
}} testID={enum_1.RemeasureTestIds.RemeasureSlider} accessibilityLabel="remeasureSlider" maximumTrackTintColor={Constants_1.BORDER_COLOUR_GREY} minimumTrackTintColor={Constants_1.BORDER_COLOUR_TEAL} thumbTintColor={Constants_1.BORDER_COLOUR_TEAL} maximumValue={6} minimumValue={0} step={0.5} style={[remeasureStyles.sliderStyle, { marginHorizontal }]} onValueChange={this.handleSliderChange}/>
|
|
49
54
|
</react_native_1.View>);
|
|
50
55
|
}
|
|
51
56
|
}
|
|
@@ -3,6 +3,7 @@ import Slider from "@react-native-community/slider";
|
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { Dimensions, Platform, StyleSheet, Text, View } from "react-native";
|
|
5
5
|
import { i18n } from "../locale/i18nUtils";
|
|
6
|
+
import { RemeasureTestIds } from "../types/enum";
|
|
6
7
|
import { BORDER_COLOUR_GREY, BORDER_COLOUR_TEAL } from "../utils/Constants";
|
|
7
8
|
import { infoStyles } from "./InfoBars";
|
|
8
9
|
|
|
@@ -11,11 +12,11 @@ interface IProps {
|
|
|
11
12
|
onSliderChange(value: number): void;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
export default class Remeasure extends React.Component<IProps
|
|
15
|
-
private slider
|
|
15
|
+
export default class Remeasure extends React.Component<IProps> {
|
|
16
|
+
private slider?: Slider;
|
|
16
17
|
|
|
17
18
|
public componentDidMount(): void {
|
|
18
|
-
this.slider
|
|
19
|
+
this.slider?.setNativeProps({
|
|
19
20
|
value: this.props.remeasureTime,
|
|
20
21
|
});
|
|
21
22
|
}
|
|
@@ -52,7 +53,12 @@ export default class Remeasure extends React.Component<IProps, null> {
|
|
|
52
53
|
</View>
|
|
53
54
|
</View>
|
|
54
55
|
<Slider
|
|
55
|
-
ref={(slider):
|
|
56
|
+
ref={(slider): void => {
|
|
57
|
+
if (slider !== null) {
|
|
58
|
+
this.slider = slider;
|
|
59
|
+
}
|
|
60
|
+
}}
|
|
61
|
+
testID={RemeasureTestIds.RemeasureSlider}
|
|
56
62
|
accessibilityLabel="remeasureSlider"
|
|
57
63
|
maximumTrackTintColor={BORDER_COLOUR_GREY}
|
|
58
64
|
minimumTrackTintColor={BORDER_COLOUR_TEAL}
|
|
File without changes
|
|
@@ -7,6 +7,7 @@ const react_1 = __importDefault(require("react"));
|
|
|
7
7
|
const react_native_1 = require("react-native");
|
|
8
8
|
const macro_1 = require("@lingui/macro");
|
|
9
9
|
const i18nUtils_1 = require("../locale/i18nUtils");
|
|
10
|
+
const enum_1 = require("../types/enum");
|
|
10
11
|
const Icon_1 = __importDefault(require("./Icon"));
|
|
11
12
|
class TransferToLogbook extends react_1.default.Component {
|
|
12
13
|
constructor() {
|
|
@@ -25,7 +26,7 @@ class TransferToLogbook extends react_1.default.Component {
|
|
|
25
26
|
if (!this.props.visible) {
|
|
26
27
|
return <react_native_1.View style={addToLogbookStyles.marginContainer}/>;
|
|
27
28
|
}
|
|
28
|
-
return (<react_native_1.TouchableOpacity onPress={this.handlePress} disabled={this.state.pressed} style={addToLogbookStyles.container} accessibilityLabel="transferToLogbook">
|
|
29
|
+
return (<react_native_1.TouchableOpacity testID={enum_1.TransferToLogbookTestIds.TransferButton} onPress={this.handlePress} disabled={this.state.pressed} style={addToLogbookStyles.container} accessibilityLabel="transferToLogbook">
|
|
29
30
|
{!this.state.pressed ? (<react_native_1.View style={addToLogbookStyles.textContainer}>
|
|
30
31
|
<react_native_1.Text style={addToLogbookStyles.transferText}>{i18nUtils_1.i18n._(macro_1.t `Transfer to logbook`)}</react_native_1.Text>
|
|
31
32
|
</react_native_1.View>) : (<react_native_1.View style={addToLogbookStyles.textContainerActive}>
|
|
@@ -3,6 +3,7 @@ import { Dimensions, StyleSheet, Text, TouchableOpacity, View } from "react-nati
|
|
|
3
3
|
|
|
4
4
|
import { t } from "@lingui/macro";
|
|
5
5
|
import { i18n } from "../locale/i18nUtils";
|
|
6
|
+
import { TransferToLogbookTestIds } from "../types/enum";
|
|
6
7
|
import Icon from "./Icon";
|
|
7
8
|
|
|
8
9
|
interface IProps {
|
|
@@ -33,6 +34,7 @@ export default class TransferToLogbook extends React.Component<IProps, IState> {
|
|
|
33
34
|
|
|
34
35
|
return (
|
|
35
36
|
<TouchableOpacity
|
|
37
|
+
testID={TransferToLogbookTestIds.TransferButton}
|
|
36
38
|
onPress={this.handlePress}
|
|
37
39
|
disabled={this.state.pressed}
|
|
38
40
|
style={addToLogbookStyles.container}
|
|
@@ -29,12 +29,14 @@ export declare const modalStyle: {
|
|
|
29
29
|
backgroundColor: string;
|
|
30
30
|
borderRadius: number;
|
|
31
31
|
};
|
|
32
|
+
iconWrapper: {
|
|
33
|
+
alignSelf: "flex-end";
|
|
34
|
+
marginRight: string;
|
|
35
|
+
marginTop: string;
|
|
36
|
+
};
|
|
32
37
|
icon: {
|
|
33
38
|
color: string;
|
|
34
39
|
fontSize: number;
|
|
35
|
-
textAlign: "right";
|
|
36
|
-
marginRight: string;
|
|
37
|
-
marginTop: string;
|
|
38
40
|
};
|
|
39
41
|
textContainer: {
|
|
40
42
|
marginHorizontal: string;
|
|
@@ -14,7 +14,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
14
14
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
15
|
if (mod && mod.__esModule) return mod;
|
|
16
16
|
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
@@ -25,6 +25,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
25
25
|
exports.modalStyle = void 0;
|
|
26
26
|
const React = __importStar(require("react"));
|
|
27
27
|
const react_native_1 = require("react-native");
|
|
28
|
+
const enum_1 = require("../types/enum");
|
|
28
29
|
const Constants_1 = require("../utils/Constants");
|
|
29
30
|
const Icon_1 = __importDefault(require("./Icon"));
|
|
30
31
|
const RecommendationModal_1 = require("./RecommendationModal");
|
|
@@ -37,7 +38,9 @@ class TwoOptionModal extends React.Component {
|
|
|
37
38
|
return (<react_native_1.View style={exports.modalStyle.container}>
|
|
38
39
|
<react_native_1.StatusBar backgroundColor={`rgba(0, 0, 0, 1)`}/>
|
|
39
40
|
<react_native_1.View style={exports.modalStyle.modalContainer}>
|
|
40
|
-
{isCancelable ? (<
|
|
41
|
+
{isCancelable ? (<react_native_1.TouchableOpacity onPress={this.props.onClose} testID={enum_1.TwoOptionModalTestIds.ExitButton} style={exports.modalStyle.iconWrapper}>
|
|
42
|
+
<Icon_1.default accessibilityLabel="ModalExitIcon" iconIdentifier={`Ionicons/ios-close-circle-outline`} style={exports.modalStyle.icon}/>
|
|
43
|
+
</react_native_1.TouchableOpacity>) : null}
|
|
41
44
|
|
|
42
45
|
<react_native_1.View style={isCancelable ? exports.modalStyle.textContainer : exports.modalStyle.textContainerNotCancelable}>
|
|
43
46
|
<react_native_1.Text style={rowAsButtonLayout ? exports.modalStyle.titleRowLayout : exports.modalStyle.titleColumnLayout}>
|
|
@@ -46,12 +49,12 @@ class TwoOptionModal extends React.Component {
|
|
|
46
49
|
<react_native_1.Text style={exports.modalStyle.message}>{this.props.message}</react_native_1.Text>
|
|
47
50
|
</react_native_1.View>
|
|
48
51
|
<react_native_1.View style={rowAsButtonLayout ? exports.modalStyle.buttonContainerRow : exports.modalStyle.buttonContainerColumn}>
|
|
49
|
-
<react_native_1.TouchableOpacity accessibilityLabel="firstOptionButton" onPress={this.props.firstOption} style={rowAsButtonLayout ? exports.modalStyle.buttonRow : exports.modalStyle.firstButtonColumn}>
|
|
52
|
+
<react_native_1.TouchableOpacity testID={enum_1.TwoOptionModalTestIds.FirstOption} accessibilityLabel="firstOptionButton" onPress={this.props.firstOption} style={rowAsButtonLayout ? exports.modalStyle.buttonRow : exports.modalStyle.firstButtonColumn}>
|
|
50
53
|
<react_native_1.Text style={rowAsButtonLayout ? exports.modalStyle.textButtonRow : exports.modalStyle.textFirstButtonColumn}>
|
|
51
54
|
{this.props.textFirstOption}
|
|
52
55
|
</react_native_1.Text>
|
|
53
56
|
</react_native_1.TouchableOpacity>
|
|
54
|
-
<react_native_1.TouchableOpacity accessibilityLabel="secondOptionButton" onPress={this.props.secondOption} style={rowAsButtonLayout ? exports.modalStyle.buttonRow : exports.modalStyle.secondButtonColumn}>
|
|
57
|
+
<react_native_1.TouchableOpacity testID={enum_1.TwoOptionModalTestIds.SecondOption} accessibilityLabel="secondOptionButton" onPress={this.props.secondOption} style={rowAsButtonLayout ? exports.modalStyle.buttonRow : exports.modalStyle.secondButtonColumn}>
|
|
55
58
|
<react_native_1.Text style={rowAsButtonLayout ? exports.modalStyle.textButtonRow : exports.modalStyle.textSecondButtonColumn}>
|
|
56
59
|
{this.props.textSecondOption}
|
|
57
60
|
</react_native_1.Text>
|
|
@@ -64,17 +67,36 @@ class TwoOptionModal extends React.Component {
|
|
|
64
67
|
exports.default = TwoOptionModal;
|
|
65
68
|
const { height, width } = react_native_1.Dimensions.get(`screen`);
|
|
66
69
|
exports.modalStyle = react_native_1.StyleSheet.create({
|
|
67
|
-
container: {
|
|
68
|
-
|
|
70
|
+
container: {
|
|
71
|
+
...react_native_1.StyleSheet.absoluteFillObject,
|
|
72
|
+
justifyContent: `center`,
|
|
73
|
+
backgroundColor: `rgba(0, 0, 0, 0.9)`,
|
|
74
|
+
},
|
|
75
|
+
modalContainer: {
|
|
76
|
+
margin: `4%`,
|
|
77
|
+
backgroundColor: Constants_1.BACKGROUND_COLOUR_PURPLE,
|
|
78
|
+
borderRadius: width / 25,
|
|
79
|
+
},
|
|
80
|
+
iconWrapper: {
|
|
81
|
+
alignSelf: `flex-end`,
|
|
82
|
+
marginRight: `4%`,
|
|
83
|
+
marginTop: `3%`,
|
|
84
|
+
},
|
|
69
85
|
icon: {
|
|
70
86
|
color: Constants_1.BORDER_COLOUR_GREY,
|
|
71
87
|
fontSize: width / 12,
|
|
72
|
-
textAlign: `right`,
|
|
73
|
-
marginRight: `4%`,
|
|
74
|
-
marginTop: `3%`,
|
|
75
88
|
},
|
|
76
|
-
textContainer: {
|
|
77
|
-
|
|
89
|
+
textContainer: {
|
|
90
|
+
marginHorizontal: `4%`,
|
|
91
|
+
marginBottom: `5%`,
|
|
92
|
+
marginTop: `2%`,
|
|
93
|
+
alignSelf: `flex-start`,
|
|
94
|
+
},
|
|
95
|
+
textContainerNotCancelable: {
|
|
96
|
+
marginHorizontal: `4%`,
|
|
97
|
+
marginVertical: `5%`,
|
|
98
|
+
alignSelf: `flex-start`,
|
|
99
|
+
},
|
|
78
100
|
titleRowLayout: {
|
|
79
101
|
fontFamily: `Roboto-Regular`,
|
|
80
102
|
color: `rgba(139, 144, 196, 1)`,
|
|
@@ -108,7 +130,11 @@ exports.modalStyle = react_native_1.StyleSheet.create({
|
|
|
108
130
|
justifyContent: `space-around`,
|
|
109
131
|
margin: `4%`,
|
|
110
132
|
},
|
|
111
|
-
buttonRow: {
|
|
133
|
+
buttonRow: {
|
|
134
|
+
...RecommendationModal_1.stylesModal.okButton,
|
|
135
|
+
height: height / 16,
|
|
136
|
+
marginTop: 0,
|
|
137
|
+
},
|
|
112
138
|
firstButtonColumn: {
|
|
113
139
|
...RecommendationModal_1.stylesModal.okButton,
|
|
114
140
|
height: height / 18,
|
|
@@ -123,7 +149,12 @@ exports.modalStyle = react_native_1.StyleSheet.create({
|
|
|
123
149
|
width: width / 1.5,
|
|
124
150
|
marginTop: `2%`,
|
|
125
151
|
},
|
|
126
|
-
textButtonRow: {
|
|
152
|
+
textButtonRow: {
|
|
153
|
+
fontFamily: `Roboto-Regular`,
|
|
154
|
+
textAlign: `center`,
|
|
155
|
+
fontSize: width / 24,
|
|
156
|
+
color: `white`,
|
|
157
|
+
},
|
|
127
158
|
textFirstButtonColumn: {
|
|
128
159
|
fontFamily: `Roboto-Regular`,
|
|
129
160
|
textAlign: `center`,
|