@hedia/recommendation-screen 2.1.48-alpha.1 → 2.1.48-alpha.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/dist/src/RecommendationScreen.d.ts +0 -8
- package/dist/src/RecommendationScreen.js +39 -42
- package/dist/src/components/Header.d.ts +5 -3
- package/dist/src/components/Header.js +59 -38
- package/dist/src/components/InfoBars.d.ts +2 -3
- package/dist/src/components/InfoBars.js +8 -10
- package/dist/src/components/RecentInsulin.d.ts +1 -1
- package/dist/src/components/RecentInsulin.js +54 -34
- package/dist/src/components/RecommendationModal.d.ts +2 -1
- package/dist/src/components/RecommendationModal.js +10 -15
- package/dist/src/components/RecommendedCarbs.js +25 -21
- package/dist/src/components/RecommendedInsulin.d.ts +0 -2
- package/dist/src/components/RecommendedInsulin.js +41 -51
- package/dist/src/components/Remeasure.js +3 -4
- package/dist/src/components/{SaveButton.d.ts → TransferToLogbook.d.ts} +1 -1
- package/dist/src/components/TransferToLogbook.js +92 -0
- package/dist/src/components/TwoOptionModal.d.ts +0 -1
- package/dist/src/components/TwoOptionModal.js +9 -10
- package/dist/src/components/mood/Emotion.js +1 -3
- package/dist/src/components/mood/MoodIcon.js +3 -3
- package/dist/src/locale/da/messages.js +1 -1
- package/dist/src/locale/da/messages.po +65 -81
- package/dist/src/locale/de/messages.js +1 -1
- package/dist/src/locale/de/messages.po +65 -81
- package/dist/src/locale/en/messages.js +1 -1
- package/dist/src/locale/en/messages.po +65 -81
- package/dist/src/locale/es/messages.js +1 -1
- package/dist/src/locale/es/messages.po +65 -81
- package/dist/src/locale/fr/messages.js +1 -1
- package/dist/src/locale/fr/messages.po +65 -81
- package/dist/src/locale/it/messages.js +1 -1
- package/dist/src/locale/it/messages.po +65 -81
- package/dist/src/types/enum.d.ts +3 -6
- package/dist/src/types/enum.js +0 -3
- package/dist/src/utils/Constants.d.ts +6 -12
- package/dist/src/utils/Constants.js +6 -12
- package/package.json +12 -14
- package/dist/src/assets/fonts/Poppins-Bold.ttf +0 -0
- package/dist/src/assets/fonts/Poppins-SemiBold.ttf +0 -0
- package/dist/src/assets/icons/Edit.d.ts +0 -4
- package/dist/src/assets/icons/Edit.js +0 -7
- package/dist/src/assets/icons/Edit.tsx +0 -22
- package/dist/src/assets/icons/X.d.ts +0 -4
- package/dist/src/assets/icons/X.js +0 -6
- package/dist/src/assets/icons/X.tsx +0 -14
- package/dist/src/components/ForecastInfoBar.d.ts +0 -117
- package/dist/src/components/ForecastInfoBar.js +0 -150
- package/dist/src/components/SaveButton.js +0 -71
|
@@ -29,14 +29,6 @@ export interface IRecommendationProps {
|
|
|
29
29
|
latestLogbookFrom6Hours: Logbook.Types.ILogbookEntry | null;
|
|
30
30
|
/** The properties of the entered activity that are not used for making the calculation itself, but will be used on the recommendation screen. */
|
|
31
31
|
activityDisplayProps: IActivityDisplayProps | null;
|
|
32
|
-
/** The forecasted glucose value to display. */
|
|
33
|
-
forecastedGlucose: number | null;
|
|
34
|
-
/** Forecasted time value to display. */
|
|
35
|
-
forecastTime: string | null;
|
|
36
|
-
/** Latest CGM value to display. */
|
|
37
|
-
latestCGMReading: number | null;
|
|
38
|
-
/** Check if the forecasted glucose value is in very low range. */
|
|
39
|
-
isForecastedGlucoseVeryLow: boolean;
|
|
40
32
|
/**
|
|
41
33
|
* Callback function taking a single boolean argument and returning nothing.
|
|
42
34
|
* To be called when the user decides on a presented carbohydrate recommendation.
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { AppState, BackHandler,
|
|
2
|
+
import { AppState, BackHandler, LogBox, StyleSheet, View } from "react-native";
|
|
3
3
|
import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
|
|
4
|
-
import {
|
|
5
|
-
import ForecastInfoBar from "./components/ForecastInfoBar";
|
|
4
|
+
import { BACKGROUND_COLOUR_PURPLE, BORDER_COLOUR_GREY, BORDER_COLOUR_TEAL } from "./utils/Constants";
|
|
6
5
|
import Header from "./components/Header";
|
|
7
6
|
import InfoBars, { infoStyles } from "./components/InfoBars";
|
|
8
7
|
import RecentInsulin from "./components/RecentInsulin";
|
|
@@ -13,7 +12,7 @@ import * as Calculator from "@hedia/recommendation-calculator";
|
|
|
13
12
|
import { Milliseconds, } from "@hedia/types";
|
|
14
13
|
import { I18nProvider } from "@lingui/react";
|
|
15
14
|
import Emotion from "./components/mood/Emotion";
|
|
16
|
-
import
|
|
15
|
+
import TransferToLogbook from "./components/TransferToLogbook";
|
|
17
16
|
import { t } from "@lingui/macro";
|
|
18
17
|
import Activity from "./components/activity/Activity";
|
|
19
18
|
import LimitationMessage from "./components/LimitationMessage";
|
|
@@ -285,7 +284,7 @@ export default class RecommendationScreen extends React.Component {
|
|
|
285
284
|
handleNoRecentInsulin = () => {
|
|
286
285
|
this.setState({ isRecommendationDisplayed: true }, () => {
|
|
287
286
|
setTimeout(() => {
|
|
288
|
-
this.scrollView?.scrollToEnd(
|
|
287
|
+
this.scrollView?.scrollToEnd(true);
|
|
289
288
|
}, 0);
|
|
290
289
|
});
|
|
291
290
|
};
|
|
@@ -454,58 +453,56 @@ export default class RecommendationScreen extends React.Component {
|
|
|
454
453
|
if (this.hasError) {
|
|
455
454
|
return <View style={containerStyles.container}/>;
|
|
456
455
|
}
|
|
457
|
-
const { activeInsulin,
|
|
458
|
-
const { BloodGlucose: BGValueTestID, BloodKetone: BKValueTestID, ActiveInsulin: ActiveInsulinValueTestID,
|
|
459
|
-
const { ActiveInsulin: ActiveInsulinUnitTestID, BloodGlucose: BGUnitTestID, BloodKetone: BKUnitTestID,
|
|
456
|
+
const { activeInsulin, recommendationModal, carbRecommendation: carbRecommendationProp, enteredCarbs, enteredInsulin, insulinRecommendation, activityReduction, isRecommendationDisplayed, } = this.state;
|
|
457
|
+
const { BloodGlucose: BGValueTestID, BloodKetone: BKValueTestID, ActiveInsulin: ActiveInsulinValueTestID, } = InfoBarTestIds.Value;
|
|
458
|
+
const { ActiveInsulin: ActiveInsulinUnitTestID, BloodGlucose: BGUnitTestID, BloodKetone: BKUnitTestID, } = InfoBarTestIds.Unit;
|
|
460
459
|
const carbRecommendation = carbRecommendationProp !== null ? Math.round(carbRecommendationProp) : null;
|
|
461
460
|
const recommendedCarbs = enteredCarbs ?? carbRecommendation;
|
|
462
|
-
const
|
|
463
|
-
const {
|
|
464
|
-
const { activity, currentBGL, carbohydrates: providedCarbs } = calculatorParams;
|
|
461
|
+
const { calculatorParams, bloodGlucoseUnit, currentBKL, bloodKetoneUnit } = this.props;
|
|
462
|
+
const { currentBGL, carbohydrates: providedCarbs } = calculatorParams;
|
|
465
463
|
const displayedBGL = currentBGL ? Utils.displayedBGLValue(currentBGL, bloodGlucoseUnit) : null;
|
|
466
464
|
const displayedBKL = currentBKL !== null && bloodKetoneUnit ? Utils.displayedBKLValue(currentBKL, bloodKetoneUnit) : null;
|
|
467
|
-
return (<I18nProvider language={language} i18n={i18n}>
|
|
468
|
-
<KeyboardAwareScrollView
|
|
469
|
-
<StatusBar backgroundColor={colors.darkBlue}/>
|
|
470
|
-
<ScrollView testID={RecommendationScreenTestIds.RecommendationScrollView} style={containerStyles.container} ref={(view) => {
|
|
465
|
+
return (<I18nProvider language={this.props.language} i18n={i18n}>
|
|
466
|
+
<KeyboardAwareScrollView testID={RecommendationScreenTestIds.RecommendationScrollView} enableResetScrollToCoords={false} style={containerStyles.container} ref={(view) => {
|
|
471
467
|
if (view !== null) {
|
|
472
468
|
this.scrollView = view;
|
|
473
469
|
}
|
|
474
470
|
}}>
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
471
|
+
<Header exitCallback={this.onExit}/>
|
|
472
|
+
<InfoBars label={i18n._(t `Active Insulin`)} value={activeInsulin ? `${activeInsulin.toFixed(1)}` : null} unit={i18n._(t `units`)} showNullAsDash={false} testID={{ unitID: ActiveInsulinUnitTestID, valueID: ActiveInsulinValueTestID }}/>
|
|
473
|
+
<InfoBars label={i18n._(t `Blood Glucose Level`)} value={displayedBGL} unit={this.props.bloodGlucoseUnit} showNullAsDash={true} testID={{ unitID: BGUnitTestID, valueID: BGValueTestID }}/>
|
|
474
|
+
<InfoBars label={i18n._(t `Blood Ketone Level`)} value={displayedBKL} unit={this.props.bloodKetoneUnit} showNullAsDash={true} testID={{ unitID: BKUnitTestID, valueID: BKValueTestID }}/>
|
|
475
|
+
<View style={containerStyles.calcContainer}>
|
|
476
|
+
<View style={containerStyles.calcMargin}>
|
|
477
|
+
<View style={[
|
|
478
|
+
containerStyles.calcBorder,
|
|
479
|
+
{
|
|
480
|
+
borderColor: recommendedCarbs ? BORDER_COLOUR_TEAL : BORDER_COLOUR_GREY,
|
|
481
|
+
},
|
|
482
|
+
]}>
|
|
483
|
+
<RecommendedCarbs enteredCarbs={`${providedCarbs}`} changedRecommendedCarbs={this.updateCarbRecommendation} recommendedCarbs={`${recommendedCarbs}`} removeRecommendedCarbs={this.removeCarbRecommendation}/>
|
|
484
484
|
</View>
|
|
485
485
|
</View>
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
{/* Modals */}
|
|
494
|
-
{showExitModal && (<TwoOptionModal title={i18n._(t `Save data before closing?`)} message={i18n._(t `Your saved data will be used for future calculations.`)} textFirstOption={i18n._(t `Save to logbook`)} textSecondOption={i18n._(t `Close calculation`)} isCancelable={true} rowAsButtonLayout={true} firstOption={this.handleTransfer} secondOption={this.closeCalculation} onClose={this.hideExitModal}/>)}
|
|
495
|
-
{showLimitationMessage && (<View style={modalStyle.container}>
|
|
496
|
-
<LimitationMessage limitationMessage={this.getLimitationAttentionMessage()} onPressNextButton={this.hideLimitationMessage}/>
|
|
497
|
-
</View>)}
|
|
498
|
-
{showTimeoutModal &&
|
|
499
|
-
(isRecommendationDisplayed ? (<TwoOptionModal title={Messages.TimeoutPrompTitle()} message={Messages.TimeoutRecommendationVisible(this.recommendationDate)} textFirstOption={i18n._(t `Yes, save to logbook`)} textSecondOption={i18n._(t `No, return to dashboard`)} rowAsButtonLayout={false} firstOption={this.handleTransfer} secondOption={this.closeCalculation}/>) : (<TwoOptionModal title={Messages.TimeoutPrompTitle()} message={Messages.TimeoutRecommendationNotVisible()} textFirstOption={i18n._(t `Start new calculation`)} textSecondOption={i18n._(t `Return to dashboard`)} rowAsButtonLayout={false} firstOption={this.restartCalculation} secondOption={this.closeCalculation}/>))}
|
|
486
|
+
</View>
|
|
487
|
+
{this.props.calculatorParams.activity && this.props.activityDisplayProps ? (<Activity activity={this.props.calculatorParams.activity} activityType={this.props.activityDisplayProps.activityType} activityTitle={this.props.activityDisplayProps.activityTitle} activityReduction={this.state.activityReduction}/>) : null}
|
|
488
|
+
<Remeasure onSliderChange={this.updateRemeasureTime} remeasureTime={this.state.remeasureTime}/>
|
|
489
|
+
{!this.state.isRecommendationDisplayed ? (<RecentInsulin onRecentInsulinYes={this.props.onRecentInsulinYes} onRecentInsulinNo={this.handleNoRecentInsulin}/>) : (<RecommendedInsulin injectionMethod={this.props.injectionMethod} insulinRecommendation={insulinRecommendation} enteredInsulin={enteredInsulin} activityReduction={activityReduction} updateRecommendedInsulin={this.updateInsulinRecommendation}/>)}
|
|
490
|
+
<Emotion moodSelected={this.handleMoodSelected} currentMood={this.state.selectedMood}/>
|
|
491
|
+
<TransferToLogbook visible={isRecommendationDisplayed} transfer={this.handleTransfer}/>
|
|
492
|
+
<RecommendationModal isVisible={recommendationModal} suggestedCarbohydrates={carbRecommendationProp} attentionMessage={this.getBGLevelAttentionMessage()} limitationMessage={this.getLimitationAttentionMessage()} onClickOkButton={this.hideAttentionModal} onAcceptCarbohydrates={this.acceptCarbRecommendation} onDeclineCarbohydrates={this.declineCarbRecommendation}/>
|
|
500
493
|
</KeyboardAwareScrollView>
|
|
494
|
+
{this.state.showExitModal ? (<TwoOptionModal title={i18n._(t `Save data before closing?`)} message={i18n._(t `Your saved data will be used for future calculations.`)} textFirstOption={i18n._(t `Save to logbook`)} textSecondOption={i18n._(t `Close calculation`)} isCancelable={true} rowAsButtonLayout={true} firstOption={this.handleTransfer} secondOption={this.closeCalculation} onClose={this.hideExitModal}/>) : null}
|
|
495
|
+
{this.state.showLimitationMessage ? (<View style={modalStyle.container}>
|
|
496
|
+
<LimitationMessage limitationMessage={this.getLimitationAttentionMessage()} onPressNextButton={this.hideLimitationMessage}/>
|
|
497
|
+
</View>) : null}
|
|
498
|
+
{this.state.showTimeoutModal ? (this.state.isRecommendationDisplayed ? (<TwoOptionModal title={Messages.TimeoutPrompTitle()} message={Messages.TimeoutRecommendationVisible(this.recommendationDate)} textFirstOption={i18n._(t `Yes, save to logbook`)} textSecondOption={i18n._(t `No, return to dashboard`)} rowAsButtonLayout={false} firstOption={this.handleTransfer} secondOption={this.closeCalculation}/>) : (<TwoOptionModal title={Messages.TimeoutPrompTitle()} message={Messages.TimeoutRecommendationNotVisible()} textFirstOption={i18n._(t `Start new calculation`)} textSecondOption={i18n._(t `Return to dashboard`)} rowAsButtonLayout={false} firstOption={this.restartCalculation} secondOption={this.closeCalculation}/>)) : null}
|
|
501
499
|
</I18nProvider>);
|
|
502
500
|
}
|
|
503
501
|
}
|
|
504
|
-
const { width } = Dimensions.get(`screen`);
|
|
505
502
|
const containerStyles = StyleSheet.create({
|
|
506
503
|
container: {
|
|
507
504
|
flex: 1,
|
|
508
|
-
backgroundColor:
|
|
505
|
+
backgroundColor: BACKGROUND_COLOUR_PURPLE,
|
|
509
506
|
},
|
|
510
507
|
calcContainer: {
|
|
511
508
|
flex: 1,
|
|
@@ -513,10 +510,10 @@ const containerStyles = StyleSheet.create({
|
|
|
513
510
|
calcMargin: {
|
|
514
511
|
flex: 1,
|
|
515
512
|
marginBottom: 0,
|
|
516
|
-
|
|
517
|
-
marginVertical: `3%`,
|
|
513
|
+
margin: `3%`,
|
|
518
514
|
},
|
|
519
515
|
calcBorder: {
|
|
520
516
|
...infoStyles.border,
|
|
517
|
+
borderColor: BORDER_COLOUR_TEAL,
|
|
521
518
|
},
|
|
522
519
|
});
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
2
|
export interface IProps {
|
|
3
3
|
/** A callback that doesn’t take any arguments and doesn’t return a value to be called when the cancel-button is pressed. */
|
|
4
4
|
exitCallback(): void;
|
|
5
5
|
}
|
|
6
6
|
/** Component to display a header text along with a cancel-button that triggers a callback function. */
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
export default class Header extends React.Component<IProps> {
|
|
8
|
+
/** JSX element to display the cancel button and header. When the cancel button in the header is tabbed, the exitCallback prop callback function should be called. */
|
|
9
|
+
render(): JSX.Element;
|
|
10
|
+
}
|
|
@@ -1,54 +1,75 @@
|
|
|
1
1
|
import { t } from "@lingui/macro";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Dimensions, SafeAreaView, StyleSheet, TouchableOpacity, View } from "react-native";
|
|
4
|
-
import XIcon from "../assets/icons/X";
|
|
5
4
|
import { i18n } from "../locale/i18nUtils";
|
|
6
5
|
import { Testing } from "../types/enum";
|
|
6
|
+
import { BACKGROUND_COLOUR_PURPLE, BORDER_COLOUR_GREY } from "../utils/Constants";
|
|
7
|
+
import Icon from "./Icon";
|
|
7
8
|
import TextBold from "./text/TextBold";
|
|
8
9
|
/** Component to display a header text along with a cancel-button that triggers a callback function. */
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
10
|
+
export default class Header extends React.Component {
|
|
11
|
+
/** JSX element to display the cancel button and header. When the cancel button in the header is tabbed, the exitCallback prop callback function should be called. */
|
|
12
|
+
render() {
|
|
13
|
+
return (<React.Fragment>
|
|
14
|
+
<SafeAreaView style={headerStyles.backgroundColour}/>
|
|
15
|
+
<View style={headerStyles.headerContainer}>
|
|
16
|
+
<View style={headerStyles.margin}>
|
|
17
|
+
<View style={headerStyles.exitButtonContainer}>
|
|
18
|
+
<View style={headerStyles.exitButton}>
|
|
19
|
+
<TouchableOpacity testID={Testing.Id.HeaderTestIds.ExitCalculation} style={headerStyles.exitButton} onPress={this.props.exitCallback}>
|
|
20
|
+
<Icon iconIdentifier={`Ionicons/ios-close-circle-outline`} style={headerStyles.iconStyle}/>
|
|
21
|
+
</TouchableOpacity>
|
|
22
|
+
<View style={headerStyles.headerFiller}/>
|
|
23
|
+
</View>
|
|
24
|
+
</View>
|
|
25
|
+
<View style={headerStyles.headerTextContainer}>
|
|
26
|
+
<TextBold style={headerStyles.headerText} testID={Testing.Id.HeaderTestIds.HeaderText}>
|
|
27
|
+
{i18n._(t `INSULIN${`\n`}RECOMMENDATION`)}
|
|
28
|
+
</TextBold>
|
|
29
|
+
</View>
|
|
30
|
+
<View style={headerStyles.headerFiller}/>
|
|
31
|
+
</View>
|
|
32
|
+
</View>
|
|
33
|
+
</React.Fragment>);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
27
36
|
const headerStyles = StyleSheet.create({
|
|
28
|
-
|
|
37
|
+
backgroundColour: {
|
|
38
|
+
backgroundColor: BACKGROUND_COLOUR_PURPLE,
|
|
39
|
+
},
|
|
40
|
+
margin: {
|
|
41
|
+
margin: `1%`,
|
|
42
|
+
marginBottom: `3%`,
|
|
43
|
+
flexDirection: `row`,
|
|
44
|
+
flex: 1,
|
|
45
|
+
},
|
|
46
|
+
headerContainer: {
|
|
29
47
|
flexDirection: `row`,
|
|
30
48
|
flex: 1,
|
|
31
|
-
|
|
32
|
-
|
|
49
|
+
},
|
|
50
|
+
exitButtonContainer: {
|
|
33
51
|
alignItems: `center`,
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
52
|
+
flex: 1,
|
|
53
|
+
},
|
|
54
|
+
exitButton: {
|
|
55
|
+
flex: 1,
|
|
56
|
+
},
|
|
57
|
+
iconStyle: {
|
|
58
|
+
fontSize: Dimensions.get(`screen`).width / 12,
|
|
59
|
+
color: BORDER_COLOUR_GREY,
|
|
60
|
+
},
|
|
61
|
+
headerTextContainer: {
|
|
62
|
+
flex: 6,
|
|
63
|
+
justifyContent: `center`,
|
|
64
|
+
alignItems: `center`,
|
|
65
|
+
marginTop: `5%`,
|
|
66
|
+
},
|
|
67
|
+
headerText: {
|
|
68
|
+
fontSize: Dimensions.get(`screen`).width / 18,
|
|
46
69
|
textAlign: `center`,
|
|
47
70
|
color: `white`,
|
|
48
71
|
},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
height: width / 11,
|
|
72
|
+
headerFiller: {
|
|
73
|
+
flex: 1,
|
|
52
74
|
},
|
|
53
75
|
});
|
|
54
|
-
export default Header;
|
|
@@ -50,8 +50,7 @@ export declare const infoStyles: {
|
|
|
50
50
|
};
|
|
51
51
|
margin: {
|
|
52
52
|
flex: number;
|
|
53
|
-
|
|
54
|
-
marginHorizontal: number;
|
|
53
|
+
margin: string;
|
|
55
54
|
marginBottom: number;
|
|
56
55
|
};
|
|
57
56
|
border: {
|
|
@@ -91,12 +90,12 @@ export declare const infoStyles: {
|
|
|
91
90
|
unitContainer: {
|
|
92
91
|
flex: number;
|
|
93
92
|
justifyContent: "flex-end";
|
|
93
|
+
paddingBottom: string;
|
|
94
94
|
};
|
|
95
95
|
units: {
|
|
96
96
|
color: string;
|
|
97
97
|
fontSize: number;
|
|
98
98
|
textAlign: "left";
|
|
99
99
|
paddingLeft: string;
|
|
100
|
-
marginBottom: number;
|
|
101
100
|
};
|
|
102
101
|
};
|
|
@@ -3,7 +3,7 @@ import { t } from "@lingui/macro";
|
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { Dimensions, StyleSheet, View } from "react-native";
|
|
5
5
|
import { i18n } from "../locale/i18nUtils";
|
|
6
|
-
import {
|
|
6
|
+
import { BORDER_COLOUR_GREY } from "../utils/Constants";
|
|
7
7
|
import { Utils } from "../utils/Utils";
|
|
8
8
|
import TextBold from "./text/TextBold";
|
|
9
9
|
import TextRegular from "./text/TextRegular";
|
|
@@ -70,19 +70,17 @@ export default class InfoBars extends React.Component {
|
|
|
70
70
|
</View>);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
const { width } = Dimensions.get(`screen`);
|
|
74
73
|
/** @internal */
|
|
75
74
|
export const infoStyles = StyleSheet.create({
|
|
76
75
|
container: { flex: 1 },
|
|
77
76
|
margin: {
|
|
78
77
|
flex: 1,
|
|
79
|
-
|
|
80
|
-
marginHorizontal: width / 17,
|
|
78
|
+
margin: `3%`,
|
|
81
79
|
marginBottom: 0,
|
|
82
80
|
},
|
|
83
81
|
border: {
|
|
84
82
|
borderWidth: 2,
|
|
85
|
-
borderColor:
|
|
83
|
+
borderColor: BORDER_COLOUR_GREY,
|
|
86
84
|
borderRadius: 5,
|
|
87
85
|
paddingVertical: `1%`,
|
|
88
86
|
},
|
|
@@ -98,7 +96,7 @@ export const infoStyles = StyleSheet.create({
|
|
|
98
96
|
},
|
|
99
97
|
label: {
|
|
100
98
|
color: `white`,
|
|
101
|
-
fontSize: width / 22,
|
|
99
|
+
fontSize: Dimensions.get(`screen`).width / 22,
|
|
102
100
|
},
|
|
103
101
|
valueUnitContainer: {
|
|
104
102
|
flex: 6.5,
|
|
@@ -111,18 +109,18 @@ export const infoStyles = StyleSheet.create({
|
|
|
111
109
|
},
|
|
112
110
|
value: {
|
|
113
111
|
color: `white`,
|
|
114
|
-
fontSize: width /
|
|
112
|
+
fontSize: Dimensions.get(`screen`).width / 15,
|
|
115
113
|
textAlign: `right`,
|
|
116
114
|
},
|
|
117
115
|
unitContainer: {
|
|
118
116
|
flex: 3,
|
|
119
117
|
justifyContent: `flex-end`,
|
|
118
|
+
paddingBottom: `3%`,
|
|
120
119
|
},
|
|
121
120
|
units: {
|
|
122
121
|
color: `white`,
|
|
123
|
-
fontSize: width / 30,
|
|
122
|
+
fontSize: Dimensions.get(`screen`).width / 30,
|
|
124
123
|
textAlign: `left`,
|
|
125
|
-
paddingLeft: `
|
|
126
|
-
marginBottom: 4,
|
|
124
|
+
paddingLeft: `5%`,
|
|
127
125
|
},
|
|
128
126
|
});
|
|
@@ -9,7 +9,7 @@ export interface IProps {
|
|
|
9
9
|
export default class RecentInsulin extends React.Component<IProps> {
|
|
10
10
|
/**
|
|
11
11
|
*
|
|
12
|
-
* @returns JSX element that displays a card with the question “Have you taken
|
|
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
13
|
* If the user taps the “Yes” button, the onRecentInsulinYes prop callback function should be called.
|
|
14
14
|
* If the user taps the “No” button, the onRecentInsulinNo prop callback function should be called.
|
|
15
15
|
*/
|
|
@@ -1,73 +1,93 @@
|
|
|
1
1
|
import { t } from "@lingui/macro";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Dimensions, StyleSheet, TouchableOpacity, View } from "react-native";
|
|
4
|
-
import LinearGradient from "react-native-linear-gradient";
|
|
5
4
|
import { i18n } from "../locale/i18nUtils";
|
|
6
5
|
import { Testing } from "../types/enum";
|
|
7
|
-
import { colors } from "../utils/Constants";
|
|
8
6
|
import { infoStyles } from "./InfoBars";
|
|
9
7
|
import TextBold from "./text/TextBold";
|
|
10
8
|
/** Display a card that prompts the user to recall if they injected insulin recently. */
|
|
11
9
|
export default class RecentInsulin extends React.Component {
|
|
12
10
|
/**
|
|
13
11
|
*
|
|
14
|
-
* @returns JSX element that displays a card with the question “Have you taken
|
|
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.
|
|
15
13
|
* If the user taps the “Yes” button, the onRecentInsulinYes prop callback function should be called.
|
|
16
14
|
* If the user taps the “No” button, the onRecentInsulinNo prop callback function should be called.
|
|
17
15
|
*/
|
|
18
16
|
render = () => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
<View style={
|
|
26
|
-
<
|
|
27
|
-
|
|
17
|
+
return (<View style={recentInsulinStyles.container}>
|
|
18
|
+
<View style={recentInsulinStyles.titleContainer}>
|
|
19
|
+
<TextBold style={recentInsulinStyles.recommended}>
|
|
20
|
+
{i18n._(t `Recommended amount of insulin`)}
|
|
21
|
+
</TextBold>
|
|
22
|
+
</View>
|
|
23
|
+
<View style={recentInsulinStyles.takenInsulinContainer}>
|
|
24
|
+
<TextBold style={recentInsulinStyles.takenInsulin}>
|
|
25
|
+
{i18n._(t `Have you taken insulin within the last 4 hours?`)}
|
|
26
|
+
</TextBold>
|
|
27
|
+
</View>
|
|
28
|
+
<View style={recentInsulinStyles.buttonContainer}>
|
|
29
|
+
<View style={recentInsulinStyles.filler}/>
|
|
30
|
+
<TouchableOpacity testID={Testing.Id.RecentInsulinTestIds.Yes} onPress={this.props.onRecentInsulinYes} style={[recentInsulinStyles.yesNoContainer, { marginRight: `2%` }]}>
|
|
31
|
+
<TextBold style={recentInsulinStyles.yesNoText}>{i18n._(t `Yes`)}</TextBold>
|
|
28
32
|
</TouchableOpacity>
|
|
29
|
-
<TouchableOpacity testID={Testing.Id.RecentInsulinTestIds.No} onPress={this.props.onRecentInsulinNo} style={[yesNoContainer, { marginLeft: `2%` }]}>
|
|
30
|
-
<TextBold style={yesNoText}>{i18n._(t `No`)}</TextBold>
|
|
33
|
+
<TouchableOpacity testID={Testing.Id.RecentInsulinTestIds.No} onPress={this.props.onRecentInsulinNo} style={[recentInsulinStyles.yesNoContainer, { marginLeft: `2%` }]}>
|
|
34
|
+
<TextBold style={recentInsulinStyles.yesNoText}>{i18n._(t `No`)}</TextBold>
|
|
31
35
|
</TouchableOpacity>
|
|
36
|
+
<View style={recentInsulinStyles.filler}/>
|
|
32
37
|
</View>
|
|
33
|
-
</
|
|
38
|
+
</View>);
|
|
34
39
|
};
|
|
35
40
|
}
|
|
36
|
-
const
|
|
37
|
-
const styles = StyleSheet.create({
|
|
41
|
+
const recentInsulinStyles = StyleSheet.create({
|
|
38
42
|
container: {
|
|
39
43
|
...infoStyles.margin,
|
|
44
|
+
backgroundColor: `rgba(118, 82, 255, 0.5)`,
|
|
40
45
|
borderRadius: 5,
|
|
41
46
|
},
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
titleContainer: {
|
|
48
|
+
flex: 1,
|
|
49
|
+
justifyContent: `center`,
|
|
50
|
+
alignItems: `center`,
|
|
51
|
+
marginTop: `4%`,
|
|
52
|
+
marginBottom: `4%`,
|
|
53
|
+
},
|
|
54
|
+
recommended: {
|
|
44
55
|
...infoStyles.label,
|
|
45
|
-
|
|
46
|
-
|
|
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,
|
|
47
66
|
textAlign: `center`,
|
|
48
|
-
paddingHorizontal: width / 13,
|
|
49
|
-
marginTop: width / 32,
|
|
50
67
|
},
|
|
51
68
|
buttonContainer: {
|
|
52
69
|
flex: 1,
|
|
53
70
|
flexDirection: `row`,
|
|
54
|
-
justifyContent: `
|
|
55
|
-
|
|
71
|
+
justifyContent: `space-evenly`,
|
|
72
|
+
marginTop: `4%`,
|
|
73
|
+
marginBottom: `5%`,
|
|
56
74
|
},
|
|
57
75
|
yesNoContainer: {
|
|
58
76
|
flex: 1,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
borderColor: colors.teal,
|
|
62
|
-
borderRadius: 50,
|
|
77
|
+
borderColor: `white`,
|
|
78
|
+
borderRadius: 100,
|
|
63
79
|
borderWidth: 2,
|
|
80
|
+
paddingHorizontal: `2%`,
|
|
81
|
+
paddingVertical: `1%`,
|
|
64
82
|
},
|
|
65
83
|
yesNoText: {
|
|
66
84
|
textAlign: `center`,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
85
|
+
paddingTop: `1%`,
|
|
86
|
+
paddingBottom: `1%`,
|
|
87
|
+
color: `white`,
|
|
88
|
+
fontSize: Dimensions.get(`screen`).width / 25,
|
|
89
|
+
},
|
|
90
|
+
filler: {
|
|
91
|
+
flex: 1,
|
|
72
92
|
},
|
|
73
93
|
});
|
|
@@ -82,15 +82,16 @@ export default class RecommendationModal extends React.Component<IModalProps, IM
|
|
|
82
82
|
export declare const stylesModal: {
|
|
83
83
|
modalStyle: {
|
|
84
84
|
margin: number;
|
|
85
|
-
backgroundColor: string;
|
|
86
85
|
};
|
|
87
86
|
container: {
|
|
88
87
|
flex: number;
|
|
88
|
+
backgroundColor: string;
|
|
89
89
|
justifyContent: "center";
|
|
90
90
|
paddingHorizontal: string;
|
|
91
91
|
};
|
|
92
92
|
containerAcceptButton: {
|
|
93
93
|
flex: number;
|
|
94
|
+
backgroundColor: string;
|
|
94
95
|
justifyContent: "flex-start";
|
|
95
96
|
};
|
|
96
97
|
titleContainer: {
|
|
@@ -4,7 +4,7 @@ import { Dimensions, StyleSheet, TouchableOpacity, View } from "react-native";
|
|
|
4
4
|
import ReactNativeModal from "react-native-modal";
|
|
5
5
|
import { i18n } from "../locale/i18nUtils";
|
|
6
6
|
import { Testing } from "../types/enum";
|
|
7
|
-
import {
|
|
7
|
+
import { BORDER_COLOUR_TEAL } from "../utils/Constants";
|
|
8
8
|
import LimitationMessage from "./LimitationMessage";
|
|
9
9
|
import TextBold from "./text/TextBold";
|
|
10
10
|
import TextRegular from "./text/TextRegular";
|
|
@@ -150,24 +150,23 @@ const textFontSize = width / 20;
|
|
|
150
150
|
const titleFontSize = width / 13;
|
|
151
151
|
/** @internal */
|
|
152
152
|
export const stylesModal = StyleSheet.create({
|
|
153
|
-
modalStyle: {
|
|
154
|
-
margin: 0,
|
|
155
|
-
backgroundColor: colors.darkBlue,
|
|
156
|
-
},
|
|
153
|
+
modalStyle: { margin: 0 },
|
|
157
154
|
container: {
|
|
158
155
|
flex: 4,
|
|
156
|
+
backgroundColor: `rgba(30, 35, 87, 0.9)`,
|
|
159
157
|
justifyContent: `center`,
|
|
160
158
|
paddingHorizontal: `4%`,
|
|
161
159
|
},
|
|
162
160
|
containerAcceptButton: {
|
|
163
161
|
flex: 1,
|
|
162
|
+
backgroundColor: `rgba(30, 35, 87, 0.9)`,
|
|
164
163
|
justifyContent: `flex-start`,
|
|
165
164
|
},
|
|
166
165
|
titleContainer: { marginBottom: `5%` },
|
|
167
166
|
recommendationRow: { justifyContent: `center`, alignContent: `center`, marginBottom: `3%` },
|
|
168
167
|
textTittleMessage: { color: `white`, fontSize: titleFontSize, textAlign: `center` },
|
|
169
168
|
textMessage: { color: `white`, fontSize: textFontSize, textAlign: `center` },
|
|
170
|
-
buttonText: { color:
|
|
169
|
+
buttonText: { color: BORDER_COLOUR_TEAL, fontSize: buttonFontSize, textAlign: `center` },
|
|
171
170
|
addToCalculationContainer: { justifyContent: `flex-start`, marginVertical: `5%` },
|
|
172
171
|
innerView: {
|
|
173
172
|
alignContent: `center`,
|
|
@@ -176,26 +175,22 @@ export const stylesModal = StyleSheet.create({
|
|
|
176
175
|
marginTop: `5%`,
|
|
177
176
|
borderRadius: height / 80,
|
|
178
177
|
borderWidth: height / 300,
|
|
179
|
-
borderColor:
|
|
178
|
+
borderColor: BORDER_COLOUR_TEAL,
|
|
180
179
|
},
|
|
181
180
|
suggestedContainer: { justifyContent: `center`, flexDirection: `row`, marginBottom: `3%` },
|
|
182
181
|
suggestedCarbs: { color: `white`, fontSize: sugestionFontSize },
|
|
183
182
|
textCenter: { textAlign: `center` },
|
|
184
|
-
recommendEatingText: {
|
|
185
|
-
color: colors.dustyBlue,
|
|
186
|
-
fontSize: recommendEatingFontSize,
|
|
187
|
-
textAlign: `center`,
|
|
188
|
-
},
|
|
183
|
+
recommendEatingText: { color: `#C5D0E7`, fontSize: recommendEatingFontSize, textAlign: `center` },
|
|
189
184
|
carbohydrateText: { color: `white`, fontSize: sugestionFontSize },
|
|
190
185
|
addToCalculation: { color: `white`, fontSize: textFontSize, textAlign: `center` },
|
|
191
186
|
recommendationButtonsContainer: { justifyContent: `center`, flexDirection: `row`, margin: `3%` },
|
|
192
|
-
affirmativeCarbsText: { color:
|
|
187
|
+
affirmativeCarbsText: { color: BORDER_COLOUR_TEAL, fontSize: buttonFontSize, textAlign: `center` },
|
|
193
188
|
negativeCarbsText: { color: `white`, fontSize: buttonFontSize, textAlign: `center` },
|
|
194
189
|
affirmativeCarbsButton: {
|
|
195
190
|
marginTop: `2%`,
|
|
196
191
|
borderRadius: buttonBorderRadius,
|
|
197
192
|
borderWidth: buttonBorderWidth,
|
|
198
|
-
borderColor:
|
|
193
|
+
borderColor: BORDER_COLOUR_TEAL,
|
|
199
194
|
width: buttonWidth,
|
|
200
195
|
height: buttonHeight,
|
|
201
196
|
alignSelf: `center`,
|
|
@@ -217,7 +212,7 @@ export const stylesModal = StyleSheet.create({
|
|
|
217
212
|
marginTop: `6%`,
|
|
218
213
|
borderRadius: buttonBorderRadius,
|
|
219
214
|
borderWidth: buttonBorderWidth,
|
|
220
|
-
borderColor:
|
|
215
|
+
borderColor: BORDER_COLOUR_TEAL,
|
|
221
216
|
width: buttonWidth,
|
|
222
217
|
height: buttonHeight,
|
|
223
218
|
alignSelf: `center`,
|