@hedia/recommendation-screen 2.2.0-alpha.40 → 2.2.0-alpha.42

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 (108) hide show
  1. package/dist/index.js +0 -1
  2. package/dist/src/RecommendationScreen.d.ts +3 -3
  3. package/dist/src/RecommendationScreen.js +23 -23
  4. package/dist/src/components/Header.js +14 -13
  5. package/dist/src/components/Icon.js +2 -1
  6. package/dist/src/components/InfoBars.d.ts +9 -3
  7. package/dist/src/components/InfoBars.js +19 -18
  8. package/dist/src/components/InvisibleNumberInput.js +2 -3
  9. package/dist/src/components/LimitationMessage.js +6 -7
  10. package/dist/src/components/LineSeparator.js +0 -1
  11. package/dist/src/components/RecentInsulin.js +15 -15
  12. package/dist/src/components/RecommendationModal.d.ts +25 -4
  13. package/dist/src/components/RecommendationModal.js +83 -48
  14. package/dist/src/components/RecommendedCarbs.d.ts +0 -2
  15. package/dist/src/components/RecommendedCarbs.js +36 -38
  16. package/dist/src/components/RecommendedInsulin.d.ts +1 -1
  17. package/dist/src/components/RecommendedInsulin.js +22 -18
  18. package/dist/src/components/Remeasure.d.ts +15 -5
  19. package/dist/src/components/Remeasure.js +35 -20
  20. package/dist/src/components/Text.d.ts +13 -0
  21. package/dist/src/components/Text.js +12 -0
  22. package/dist/src/components/TransferToLogbook.js +12 -35
  23. package/dist/src/components/TwoOptionModal.d.ts +18 -6
  24. package/dist/src/components/TwoOptionModal.js +29 -30
  25. package/dist/src/components/activity/Activity.d.ts +1 -1
  26. package/dist/src/components/activity/Activity.js +19 -19
  27. package/dist/src/components/activity/ActivityIcon.d.ts +1 -1
  28. package/dist/src/components/activity/ActivityIcon.js +9 -9
  29. package/dist/src/components/activity/ActivityIntensity.d.ts +1 -1
  30. package/dist/src/components/activity/ActivityIntensity.js +11 -10
  31. package/dist/src/components/mood/Emotion.d.ts +1 -1
  32. package/dist/src/components/mood/Emotion.js +10 -8
  33. package/dist/src/components/mood/MoodIcon.d.ts +1 -1
  34. package/dist/src/components/mood/MoodIcon.js +1 -2
  35. package/dist/src/components/styles/fonts.d.ts +130 -0
  36. package/dist/src/components/styles/fonts.js +131 -0
  37. package/dist/src/locale/da/messages.js +1 -0
  38. package/dist/src/locale/da/messages.po +349 -0
  39. package/dist/src/locale/de/messages.js +1 -0
  40. package/dist/src/locale/de/messages.po +349 -0
  41. package/dist/src/locale/en/messages.js +1 -0
  42. package/dist/src/locale/en/messages.po +349 -0
  43. package/dist/src/locale/es/messages.js +1 -0
  44. package/dist/src/locale/es/messages.po +349 -0
  45. package/dist/src/locale/fr/messages.js +1 -0
  46. package/dist/src/locale/fr/messages.po +349 -0
  47. package/dist/src/locale/i18nUtils.d.ts +18 -0
  48. package/dist/src/locale/i18nUtils.js +39 -0
  49. package/dist/src/locale/it/messages.js +1 -0
  50. package/dist/src/locale/it/messages.po +349 -0
  51. package/dist/src/types/enum.js +0 -2
  52. package/dist/src/types/types.js +0 -1
  53. package/dist/src/utils/AttentionMessages.js +24 -29
  54. package/dist/src/utils/Constants.d.ts +27 -8
  55. package/dist/src/utils/Constants.js +25 -7
  56. package/dist/src/utils/RecommendationError.js +24 -24
  57. package/dist/src/utils/RecommendationUtils.js +2 -5
  58. package/dist/src/utils/Translations.js +5 -5
  59. package/dist/src/utils/Utils.d.ts +1 -1
  60. package/dist/src/utils/Utils.js +0 -1
  61. package/dist/src/utils/Validations.d.ts +1 -1
  62. package/dist/src/utils/Validations.js +2 -3
  63. package/package.json +102 -85
  64. package/dist/index.js.map +0 -1
  65. package/dist/src/RecommendationScreen.js.map +0 -1
  66. package/dist/src/components/Header.js.map +0 -1
  67. package/dist/src/components/Icon.js.map +0 -1
  68. package/dist/src/components/InfoBars.js.map +0 -1
  69. package/dist/src/components/InvisibleNumberInput.js.map +0 -1
  70. package/dist/src/components/LimitationMessage.js.map +0 -1
  71. package/dist/src/components/LineSeparator.js.map +0 -1
  72. package/dist/src/components/RecentInsulin.js.map +0 -1
  73. package/dist/src/components/RecommendationModal.js.map +0 -1
  74. package/dist/src/components/RecommendedCarbs.js.map +0 -1
  75. package/dist/src/components/RecommendedInsulin.js.map +0 -1
  76. package/dist/src/components/Remeasure.js.map +0 -1
  77. package/dist/src/components/TransferToLogbook.js.map +0 -1
  78. package/dist/src/components/TwoOptionModal.js.map +0 -1
  79. package/dist/src/components/activity/Activity.js.map +0 -1
  80. package/dist/src/components/activity/ActivityIcon.js.map +0 -1
  81. package/dist/src/components/activity/ActivityIntensity.js.map +0 -1
  82. package/dist/src/components/mood/Emotion.js.map +0 -1
  83. package/dist/src/components/mood/MoodIcon.js.map +0 -1
  84. package/dist/src/components/text/TextBold.d.ts +0 -8
  85. package/dist/src/components/text/TextBold.js +0 -13
  86. package/dist/src/components/text/TextBold.js.map +0 -1
  87. package/dist/src/components/text/TextRegular.d.ts +0 -8
  88. package/dist/src/components/text/TextRegular.js +0 -13
  89. package/dist/src/components/text/TextRegular.js.map +0 -1
  90. package/dist/src/locales/da/messages.json +0 -80
  91. package/dist/src/locales/de/messages.json +0 -80
  92. package/dist/src/locales/en/messages.json +0 -83
  93. package/dist/src/locales/es/messages.json +0 -80
  94. package/dist/src/locales/fr/messages.json +0 -80
  95. package/dist/src/locales/it/messages.json +0 -80
  96. package/dist/src/locales/translate.d.ts +0 -18
  97. package/dist/src/locales/translate.js +0 -51
  98. package/dist/src/locales/translate.js.map +0 -1
  99. package/dist/src/types/enum.js.map +0 -1
  100. package/dist/src/types/types.js.map +0 -1
  101. package/dist/src/utils/AttentionMessages.js.map +0 -1
  102. package/dist/src/utils/Constants.js.map +0 -1
  103. package/dist/src/utils/RecommendationError.js.map +0 -1
  104. package/dist/src/utils/RecommendationUtils.js.map +0 -1
  105. package/dist/src/utils/Translations.js.map +0 -1
  106. package/dist/src/utils/Utils.js.map +0 -1
  107. package/dist/src/utils/Validations.js.map +0 -1
  108. package/dist/tsconfig.tsbuildinfo +0 -1
package/dist/index.js CHANGED
@@ -3,4 +3,3 @@ import * as Errors from "./src/utils/RecommendationError";
3
3
  export default RecommendationScreen;
4
4
  export { Errors };
5
5
  export * from "./src/types/enum";
6
- //# sourceMappingURL=index.js.map
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
2
  import { AppStateStatus } from "react-native";
3
3
  import { BloodGlucoseUnit, BloodKetonesUnit, BolusCalculator, Languages, Logbook, UserSettings } from "@hedia/types";
4
- import { IActivityDisplayProps } from "./types/types";
5
4
  import { RecommendationError } from "./utils/RecommendationError";
5
+ import { IActivityDisplayProps } from "./types/types";
6
6
  /** Represents both a suggestion by HDA and an actual amount of either insulin or carbohydrates. */
7
7
  export interface IResult {
8
8
  /** The suggested amount (of insulin in units or carbohydrates in grams) */
@@ -14,7 +14,7 @@ export interface IRecommendationProps {
14
14
  /** The blood glucose measurement unit that the user prefers. */
15
15
  bloodGlucoseUnit: BloodGlucoseUnit;
16
16
  /** The user’s preferred language. */
17
- language: keyof typeof Languages;
17
+ language: Languages;
18
18
  /** The user’s preferred default reminder time in hours when they enter carbohydrates or an activity. */
19
19
  userReminder: number;
20
20
  /** The values needed to make an insulin recommendation calculation. */
@@ -66,7 +66,7 @@ export interface IRecommendationProps {
66
66
  * To be called in case a serious issue with the validity of input data is detected.
67
67
  * @param error The detected error.
68
68
  */
69
- onError(error: RecommendationError | Error): void;
69
+ onError(error: RecommendationError): void;
70
70
  /**
71
71
  * Callback function taking a single argument of type boolean.
72
72
  * To be called to hide the bottom navigation bar while displaying modal dialogs.
@@ -1,24 +1,26 @@
1
1
  import React from "react";
2
2
  import { AppState, BackHandler, LogBox, StyleSheet, View } from "react-native";
3
3
  import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
4
- import * as Calculator from "@hedia/recommendation-calculator";
5
- import { Milliseconds, } from "@hedia/types";
6
- import Activity from "./components/activity/Activity";
7
4
  import Header from "./components/Header";
8
5
  import InfoBars, { infoStyles } from "./components/InfoBars";
9
- import LimitationMessage from "./components/LimitationMessage";
10
- import Emotion from "./components/mood/Emotion";
11
6
  import RecentInsulin from "./components/RecentInsulin";
12
- import RecommendationModal from "./components/RecommendationModal";
13
7
  import RecommendedCarbs from "./components/RecommendedCarbs";
14
8
  import RecommendedInsulin from "./components/RecommendedInsulin";
15
9
  import Remeasure from "./components/Remeasure";
10
+ import * as Calculator from "@hedia/recommendation-calculator";
11
+ import { Milliseconds, } from "@hedia/types";
12
+ import { I18nProvider } from "@lingui/react";
13
+ import Emotion from "./components/mood/Emotion";
16
14
  import TransferToLogbook from "./components/TransferToLogbook";
15
+ import { colors } from "./utils/Constants";
16
+ import { t } from "@lingui/macro";
17
+ import Activity from "./components/activity/Activity";
18
+ import LimitationMessage from "./components/LimitationMessage";
19
+ import RecommendationModal from "./components/RecommendationModal";
17
20
  import TwoOptionModal, { modalStyle } from "./components/TwoOptionModal";
18
- import { changeLocale, translate } from "./locales/translate";
21
+ import { changeLanguage, i18n } from "./locale/i18nUtils";
19
22
  import { Testing } from "./types/enum";
20
23
  import { Messages } from "./utils/AttentionMessages";
21
- import { BACKGROUND_COLOUR_PURPLE, BORDER_COLOUR_GREY, BORDER_COLOUR_TEAL } from "./utils/Constants";
22
24
  import { getAttentionMessage, getBGLevel, getLimitationMessage, getReminder } from "./utils/RecommendationUtils";
23
25
  import { Utils } from "./utils/Utils";
24
26
  import { validateParams } from "./utils/Validations";
@@ -91,8 +93,8 @@ export default class RecommendationScreen extends React.Component {
91
93
  super(props);
92
94
  try {
93
95
  validateParams(props);
94
- changeLocale(props.language);
95
96
  this.recommendationDate = new Date(global.Date.now());
97
+ changeLanguage(props.language);
96
98
  const { recentBoluses } = props.calculatorParams;
97
99
  const { bolus, carbRecommendation, activityReduction, wasLimited, activeInsulin } = Calculator.calculateRecommendation(props.calculatorParams);
98
100
  this.suggestedCarbs = carbRecommendation;
@@ -460,22 +462,22 @@ export default class RecommendationScreen extends React.Component {
460
462
  const { currentBGL, carbohydrates: providedCarbs } = calculatorParams;
461
463
  const displayedBGL = currentBGL ? Utils.displayedBGLValue(currentBGL, bloodGlucoseUnit) : null;
462
464
  const displayedBKL = currentBKL !== null && bloodKetoneUnit ? Utils.displayedBKLValue(currentBKL, bloodKetoneUnit) : null;
463
- return (<>
465
+ return (<I18nProvider language={this.props.language} i18n={i18n}>
464
466
  <KeyboardAwareScrollView testID={RecommendationScreenTestIds.RecommendationScrollView} enableResetScrollToCoords={false} style={containerStyles.container} ref={(view) => {
465
467
  if (view !== null) {
466
468
  this.scrollView = view;
467
469
  }
468
470
  }}>
469
471
  <Header exitCallback={this.onExit}/>
470
- <InfoBars label={translate(`Active Insulin`)} value={activeInsulin ? `${activeInsulin.toFixed(1)}` : null} unit={translate(`units`)} showNullAsDash={false} testID={{ unitID: ActiveInsulinUnitTestID, valueID: ActiveInsulinValueTestID }}/>
471
- <InfoBars label={translate(`Blood Glucose Level`)} value={displayedBGL} unit={this.props.bloodGlucoseUnit} showNullAsDash={true} testID={{ unitID: BGUnitTestID, valueID: BGValueTestID }}/>
472
- <InfoBars label={translate(`Blood Ketone Level`)} value={displayedBKL} unit={this.props.bloodKetoneUnit} showNullAsDash={true} testID={{ unitID: BKUnitTestID, valueID: BKValueTestID }}/>
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 }}/>
473
475
  <View style={containerStyles.calcContainer}>
474
476
  <View style={containerStyles.calcMargin}>
475
477
  <View style={[
476
478
  containerStyles.calcBorder,
477
479
  {
478
- borderColor: recommendedCarbs ? BORDER_COLOUR_TEAL : BORDER_COLOUR_GREY,
480
+ borderColor: recommendedCarbs ? colors.teal : colors.mistBlue,
479
481
  },
480
482
  ]}>
481
483
  <RecommendedCarbs enteredCarbs={`${providedCarbs}`} changedRecommendedCarbs={this.updateCarbRecommendation} recommendedCarbs={`${recommendedCarbs}`} removeRecommendedCarbs={this.removeCarbRecommendation}/>
@@ -489,19 +491,18 @@ export default class RecommendationScreen extends React.Component {
489
491
  <TransferToLogbook visible={isRecommendationDisplayed} transfer={this.handleTransfer}/>
490
492
  <RecommendationModal isVisible={recommendationModal} suggestedCarbohydrates={carbRecommendationProp} attentionMessage={this.getBGLevelAttentionMessage()} limitationMessage={this.getLimitationAttentionMessage()} onClickOkButton={this.hideAttentionModal} onAcceptCarbohydrates={this.acceptCarbRecommendation} onDeclineCarbohydrates={this.declineCarbRecommendation}/>
491
493
  </KeyboardAwareScrollView>
492
- {this.state.showExitModal && (<TwoOptionModal title={translate(`Save data before closing?`)} message={translate(`Your saved data will be used for future calculations.`)} textFirstOption={translate(`Save to logbook`)} textSecondOption={translate(`Close calculation`)} isCancelable={true} rowAsButtonLayout={true} firstOption={this.handleTransfer} secondOption={this.closeCalculation} onClose={this.hideExitModal}/>)}
493
- {this.state.showLimitationMessage && (<View style={modalStyle.container}>
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}>
494
496
  <LimitationMessage limitationMessage={this.getLimitationAttentionMessage()} onPressNextButton={this.hideLimitationMessage}/>
495
- </View>)}
496
- {this.state.showTimeoutModal &&
497
- (this.state.isRecommendationDisplayed ? (<TwoOptionModal title={Messages.TimeoutPrompTitle()} message={Messages.TimeoutRecommendationVisible(this.recommendationDate)} textFirstOption={translate(`Yes, save to logbook`)} textSecondOption={translate(`No, return to dashboard`)} rowAsButtonLayout={false} firstOption={this.handleTransfer} secondOption={this.closeCalculation}/>) : (<TwoOptionModal title={Messages.TimeoutPrompTitle()} message={Messages.TimeoutRecommendationNotVisible()} textFirstOption={translate(`Start new calculation`)} textSecondOption={translate(`Return to dashboard`)} rowAsButtonLayout={false} firstOption={this.restartCalculation} secondOption={this.closeCalculation}/>))}
498
- </>);
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}
499
+ </I18nProvider>);
499
500
  }
500
501
  }
501
502
  const containerStyles = StyleSheet.create({
502
503
  container: {
503
504
  flex: 1,
504
- backgroundColor: BACKGROUND_COLOUR_PURPLE,
505
+ backgroundColor: colors.darkBlue,
505
506
  },
506
507
  calcContainer: {
507
508
  flex: 1,
@@ -513,7 +514,6 @@ const containerStyles = StyleSheet.create({
513
514
  },
514
515
  calcBorder: {
515
516
  ...infoStyles.border,
516
- borderColor: BORDER_COLOUR_TEAL,
517
+ borderColor: colors.teal,
517
518
  },
518
519
  });
519
- //# sourceMappingURL=RecommendationScreen.js.map
@@ -1,10 +1,12 @@
1
+ import { t } from "@lingui/macro";
1
2
  import React from "react";
2
- import { Dimensions, SafeAreaView, StyleSheet, TouchableOpacity, View } from "react-native";
3
- import { translate } from "../locales/translate";
3
+ import { SafeAreaView, StyleSheet, TouchableOpacity, View } from "react-native";
4
+ import { i18n } from "../locale/i18nUtils";
4
5
  import { Testing } from "../types/enum";
5
- import { BACKGROUND_COLOUR_PURPLE, BORDER_COLOUR_GREY } from "../utils/Constants";
6
+ import { colors } from "../utils/Constants";
6
7
  import Icon from "./Icon";
7
- import TextBold from "./text/TextBold";
8
+ import { FONTS, ICONS } from "./styles/fonts";
9
+ import Text from "./Text";
8
10
  /** Component to display a header text along with a cancel-button that triggers a callback function. */
9
11
  export default class Header extends React.Component {
10
12
  /** 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. */
@@ -22,9 +24,9 @@ export default class Header extends React.Component {
22
24
  </View>
23
25
  </View>
24
26
  <View style={headerStyles.headerTextContainer}>
25
- <TextBold style={headerStyles.headerText} testID={Testing.Id.HeaderTestIds.HeaderText}>
26
- {translate(`INSULIN{0}RECOMMENDATION`, { 0: `\n` })}
27
- </TextBold>
27
+ <Text style={headerStyles.headerText} testID={Testing.Id.HeaderTestIds.HeaderText}>
28
+ {i18n._(t `INSULIN${`\n`}RECOMMENDATION`)}
29
+ </Text>
28
30
  </View>
29
31
  <View style={headerStyles.headerFiller}/>
30
32
  </View>
@@ -34,7 +36,7 @@ export default class Header extends React.Component {
34
36
  }
35
37
  const headerStyles = StyleSheet.create({
36
38
  backgroundColour: {
37
- backgroundColor: BACKGROUND_COLOUR_PURPLE,
39
+ backgroundColor: colors.darkBlue,
38
40
  },
39
41
  margin: {
40
42
  margin: `1%`,
@@ -54,8 +56,8 @@ const headerStyles = StyleSheet.create({
54
56
  flex: 1,
55
57
  },
56
58
  iconStyle: {
57
- fontSize: Dimensions.get(`screen`).width / 12,
58
- color: BORDER_COLOUR_GREY,
59
+ ...ICONS.XXXL,
60
+ color: colors.mistBlue,
59
61
  },
60
62
  headerTextContainer: {
61
63
  flex: 6,
@@ -64,12 +66,11 @@ const headerStyles = StyleSheet.create({
64
66
  marginTop: `5%`,
65
67
  },
66
68
  headerText: {
67
- fontSize: Dimensions.get(`screen`).width / 18,
69
+ ...FONTS.Poppins.bold_XL,
68
70
  textAlign: `center`,
69
- color: `white`,
71
+ color: colors.white,
70
72
  },
71
73
  headerFiller: {
72
74
  flex: 1,
73
75
  },
74
76
  });
75
- //# sourceMappingURL=Header.js.map
@@ -1,3 +1,5 @@
1
+ // @ts-nocheck
2
+ /* tslint:disable */
1
3
  import React from "react";
2
4
  /** Mapping from react-native-vector-icons identifier to corresponding icon resource. */
3
5
  export const IconSets = {
@@ -39,4 +41,3 @@ export default class Icon extends React.Component {
39
41
  Icon.defaultProps = {
40
42
  iconIdentifier: `FontAwesome/question`,
41
43
  };
42
- //# sourceMappingURL=Icon.js.map
@@ -1,5 +1,5 @@
1
- import React from "react";
2
1
  import { BloodGlucoseUnit, BloodKetonesUnit } from "@hedia/types";
2
+ import React from "react";
3
3
  import { Testing } from "../types/enum";
4
4
  export interface IProps {
5
5
  /** The display label that describes the value to the user. */
@@ -72,6 +72,8 @@ export declare const infoStyles: {
72
72
  label: {
73
73
  color: string;
74
74
  fontSize: number;
75
+ fontFamily: import("./styles/fonts").FontFamily;
76
+ lineHeight: number;
75
77
  };
76
78
  valueUnitContainer: {
77
79
  flex: number;
@@ -84,8 +86,10 @@ export declare const infoStyles: {
84
86
  };
85
87
  value: {
86
88
  color: string;
87
- fontSize: number;
88
89
  textAlign: "right";
90
+ fontFamily: import("./styles/fonts").FontFamily;
91
+ fontSize: number;
92
+ lineHeight: number;
89
93
  };
90
94
  unitContainer: {
91
95
  flex: number;
@@ -94,8 +98,10 @@ export declare const infoStyles: {
94
98
  };
95
99
  units: {
96
100
  color: string;
97
- fontSize: number;
98
101
  textAlign: "left";
99
102
  paddingLeft: string;
103
+ fontFamily: import("./styles/fonts").FontFamily;
104
+ fontSize: number;
105
+ lineHeight: number;
100
106
  };
101
107
  };
@@ -1,11 +1,12 @@
1
+ import { BloodGlucoseUnit, BloodKetonesUnit } from "@hedia/types";
2
+ import { t } from "@lingui/macro";
1
3
  import React from "react";
2
4
  import { Dimensions, StyleSheet, View } from "react-native";
3
- import { BloodGlucoseUnit, BloodKetonesUnit } from "@hedia/types";
4
- import { translate } from "../locales/translate";
5
- import { BORDER_COLOUR_GREY } from "../utils/Constants";
5
+ import { i18n } from "../locale/i18nUtils";
6
+ import { colors } from "../utils/Constants";
6
7
  import { Utils } from "../utils/Utils";
7
- import TextBold from "./text/TextBold";
8
- import TextRegular from "./text/TextRegular";
8
+ import { FONTS } from "./styles/fonts";
9
+ import Text from "./Text";
9
10
  /** A standard panel to display some data that the user entered. */
10
11
  export default class InfoBars extends React.Component {
11
12
  /**
@@ -37,7 +38,7 @@ export default class InfoBars extends React.Component {
37
38
  if (!unit) {
38
39
  return null;
39
40
  }
40
- return unit === translate(`units`) ? unit : Utils.formatUnit(unit);
41
+ return unit === i18n._(t `units`) ? unit : Utils.formatUnit(unit);
41
42
  };
42
43
  /**
43
44
  * @returns JSX element to display a card with the entered value.
@@ -49,18 +50,18 @@ export default class InfoBars extends React.Component {
49
50
  <View style={infoStyles.border}>
50
51
  <View style={infoStyles.borderContainer}>
51
52
  <View style={infoStyles.labelContainer}>
52
- <TextBold style={infoStyles.label}>{this.props.label}</TextBold>
53
+ <Text style={infoStyles.label}>{this.props.label}</Text>
53
54
  </View>
54
55
  <View style={infoStyles.valueUnitContainer}>
55
56
  <View style={infoStyles.valueContainer}>
56
- <TextBold style={infoStyles.value} testID={testID?.valueID}>
57
+ <Text style={infoStyles.value} testID={testID?.valueID}>
57
58
  {this.displayValue()}
58
- </TextBold>
59
+ </Text>
59
60
  </View>
60
61
  <View style={infoStyles.unitContainer}>
61
- <TextRegular style={infoStyles.units} testID={testID?.unitID}>
62
+ <Text style={infoStyles.units} testID={testID?.unitID}>
62
63
  {this.displayUnit()}
63
- </TextRegular>
64
+ </Text>
64
65
  </View>
65
66
  </View>
66
67
  </View>
@@ -79,7 +80,7 @@ export const infoStyles = StyleSheet.create({
79
80
  },
80
81
  border: {
81
82
  borderWidth: 2,
82
- borderColor: BORDER_COLOUR_GREY,
83
+ borderColor: colors.mistBlue,
83
84
  borderRadius: 5,
84
85
  paddingVertical: `1%`,
85
86
  },
@@ -94,7 +95,8 @@ export const infoStyles = StyleSheet.create({
94
95
  justifyContent: `center`,
95
96
  },
96
97
  label: {
97
- color: `white`,
98
+ ...FONTS.Poppins.bold_LG,
99
+ color: colors.white,
98
100
  fontSize: Dimensions.get(`screen`).width / 22,
99
101
  },
100
102
  valueUnitContainer: {
@@ -107,8 +109,8 @@ export const infoStyles = StyleSheet.create({
107
109
  justifyContent: `flex-end`,
108
110
  },
109
111
  value: {
110
- color: `white`,
111
- fontSize: Dimensions.get(`screen`).width / 15,
112
+ ...FONTS.Poppins.bold_2XL,
113
+ color: colors.white,
112
114
  textAlign: `right`,
113
115
  },
114
116
  unitContainer: {
@@ -117,10 +119,9 @@ export const infoStyles = StyleSheet.create({
117
119
  paddingBottom: `3%`,
118
120
  },
119
121
  units: {
120
- color: `white`,
121
- fontSize: Dimensions.get(`screen`).width / 30,
122
+ ...FONTS.Poppins.regular_SM,
123
+ color: colors.white,
122
124
  textAlign: `left`,
123
125
  paddingLeft: `5%`,
124
126
  },
125
127
  });
126
- //# sourceMappingURL=InfoBars.js.map
@@ -48,7 +48,7 @@ export default class InvisibleNumberInput extends React.Component {
48
48
  * @returns A string with the cleaned text.
49
49
  */
50
50
  cleanInput = (text) => {
51
- const replaced = text.replace(/,/g, `.`).replace(/(\d*\.\d*).*/, `$1`);
51
+ const replaced = text.replace(/\,/g, `.`).replace(/(\d*\.\d*).*/, `$1`);
52
52
  const round = (value) => {
53
53
  const temp = Number(value) * Math.pow(10, this.props.decimalPlaces);
54
54
  const rounded = Math.round(temp) / Math.pow(10, this.props.decimalPlaces);
@@ -72,7 +72,7 @@ export default class InvisibleNumberInput extends React.Component {
72
72
  * @param text The updated text in the input field
73
73
  */
74
74
  handleOnChangeText = (text) => {
75
- const cleaned = this.props.cleanPartialInput ? this.cleanInput(text) : text.replace(/,/g, `.`);
75
+ const cleaned = this.props.cleanPartialInput ? this.cleanInput(text) : text.replace(/\,/g, `.`);
76
76
  let replacedSeparator = cleaned.replace(/\.+/g, `.`).replace(/(\d*\.\d*).*/, `$1`);
77
77
  if (!this.props.negativeAllowed) {
78
78
  replacedSeparator = replacedSeparator.replace(/[^0-9.]/g, ``);
@@ -119,4 +119,3 @@ const inputStyles = StyleSheet.create({
119
119
  }),
120
120
  },
121
121
  });
122
- //# sourceMappingURL=InvisibleNumberInput.js.map
@@ -1,10 +1,10 @@
1
+ import { t } from "@lingui/macro";
1
2
  import * as React from "react";
2
3
  import { TouchableOpacity, View } from "react-native";
3
- import { translate } from "../locales/translate";
4
+ import { i18n } from "../locale/i18nUtils";
4
5
  import { Testing } from "../types/enum";
5
6
  import { stylesModal } from "./RecommendationModal";
6
- import TextBold from "./text/TextBold";
7
- import TextRegular from "./text/TextRegular";
7
+ import Text from "./Text";
8
8
  /** Display a message on the screen to inform the user that their insulin recommendation was limited. */
9
9
  export default class LimitationMessage extends React.Component {
10
10
  /**
@@ -15,16 +15,15 @@ export default class LimitationMessage extends React.Component {
15
15
  return (<React.Fragment>
16
16
  <View style={stylesModal.container}>
17
17
  <View style={stylesModal.titleContainer}>
18
- <TextBold style={stylesModal.textTittleMessage}>{translate(`Attention`)}</TextBold>
18
+ <Text style={stylesModal.textTittleMessage}>{i18n._(t `Attention`)}</Text>
19
19
  </View>
20
- <TextRegular style={stylesModal.textMessage}>{limitationMessage}</TextRegular>
20
+ <Text style={stylesModal.textMessage}>{limitationMessage}</Text>
21
21
  </View>
22
22
  <View style={stylesModal.containerAcceptButton}>
23
23
  <TouchableOpacity testID={Testing.Id.LimitationMessageTestIds.OkButton} style={stylesModal.okButton} onPress={this.props.onPressNextButton}>
24
- <TextRegular style={stylesModal.buttonText}>{translate(`OK`)}</TextRegular>
24
+ <Text style={stylesModal.buttonText}>{i18n._(t `OK`)}</Text>
25
25
  </TouchableOpacity>
26
26
  </View>
27
27
  </React.Fragment>);
28
28
  };
29
29
  }
30
- //# sourceMappingURL=LimitationMessage.js.map
@@ -16,4 +16,3 @@ const lineSeparatorStyles = StyleSheet.create({
16
16
  borderBottomWidth: 1,
17
17
  },
18
18
  });
19
- //# sourceMappingURL=LineSeparator.js.map
@@ -1,9 +1,12 @@
1
+ import { t } from "@lingui/macro";
1
2
  import React from "react";
2
3
  import { Dimensions, StyleSheet, TouchableOpacity, View } from "react-native";
3
- import { translate } from "../locales/translate";
4
+ import { i18n } from "../locale/i18nUtils";
4
5
  import { Testing } from "../types/enum";
6
+ import { colors } from "../utils/Constants";
5
7
  import { infoStyles } from "./InfoBars";
6
- import TextBold from "./text/TextBold";
8
+ import { FONTS } from "./styles/fonts";
9
+ import Text from "./Text";
7
10
  /** Display a card that prompts the user to recall if they injected insulin recently. */
8
11
  export default class RecentInsulin extends React.Component {
9
12
  /**
@@ -15,22 +18,20 @@ export default class RecentInsulin extends React.Component {
15
18
  render = () => {
16
19
  return (<View style={recentInsulinStyles.container}>
17
20
  <View style={recentInsulinStyles.titleContainer}>
18
- <TextBold style={recentInsulinStyles.recommended}>
19
- {translate(`Recommended amount of insulin`)}
20
- </TextBold>
21
+ <Text style={recentInsulinStyles.recommended}>{i18n._(t `Recommended amount of insulin`)}</Text>
21
22
  </View>
22
23
  <View style={recentInsulinStyles.takenInsulinContainer}>
23
- <TextBold style={recentInsulinStyles.takenInsulin}>
24
- {translate(`Have you taken insulin within the last 4 hours?`)}
25
- </TextBold>
24
+ <Text style={recentInsulinStyles.takenInsulin}>
25
+ {i18n._(t `Have you taken insulin within the last 4 hours?`)}
26
+ </Text>
26
27
  </View>
27
28
  <View style={recentInsulinStyles.buttonContainer}>
28
29
  <View style={recentInsulinStyles.filler}/>
29
30
  <TouchableOpacity testID={Testing.Id.RecentInsulinTestIds.Yes} onPress={this.props.onRecentInsulinYes} style={[recentInsulinStyles.yesNoContainer, { marginRight: `2%` }]}>
30
- <TextBold style={recentInsulinStyles.yesNoText}>{translate(`Yes`)}</TextBold>
31
+ <Text style={recentInsulinStyles.yesNoText}>{i18n._(t `Yes`)}</Text>
31
32
  </TouchableOpacity>
32
33
  <TouchableOpacity testID={Testing.Id.RecentInsulinTestIds.No} onPress={this.props.onRecentInsulinNo} style={[recentInsulinStyles.yesNoContainer, { marginLeft: `2%` }]}>
33
- <TextBold style={recentInsulinStyles.yesNoText}>{translate(`No`)}</TextBold>
34
+ <Text style={recentInsulinStyles.yesNoText}>{i18n._(t `No`)}</Text>
34
35
  </TouchableOpacity>
35
36
  <View style={recentInsulinStyles.filler}/>
36
37
  </View>
@@ -40,7 +41,7 @@ export default class RecentInsulin extends React.Component {
40
41
  const recentInsulinStyles = StyleSheet.create({
41
42
  container: {
42
43
  ...infoStyles.margin,
43
- backgroundColor: `rgba(118, 82, 255, 0.5)`,
44
+ backgroundColor: colors.deepPurple,
44
45
  borderRadius: 5,
45
46
  },
46
47
  titleContainer: {
@@ -73,21 +74,20 @@ const recentInsulinStyles = StyleSheet.create({
73
74
  },
74
75
  yesNoContainer: {
75
76
  flex: 1,
76
- borderColor: `white`,
77
+ borderColor: colors.white,
77
78
  borderRadius: 100,
78
79
  borderWidth: 2,
79
80
  paddingHorizontal: `2%`,
80
81
  paddingVertical: `1%`,
81
82
  },
82
83
  yesNoText: {
84
+ ...FONTS.Poppins.bold_Base,
83
85
  textAlign: `center`,
84
86
  paddingTop: `1%`,
85
87
  paddingBottom: `1%`,
86
- color: `white`,
87
- fontSize: Dimensions.get(`screen`).width / 25,
88
+ color: colors.white,
88
89
  },
89
90
  filler: {
90
91
  flex: 1,
91
92
  },
92
93
  });
93
- //# sourceMappingURL=RecentInsulin.js.map
@@ -104,18 +104,24 @@ export declare const stylesModal: {
104
104
  };
105
105
  textTittleMessage: {
106
106
  color: string;
107
- fontSize: number;
108
107
  textAlign: "center";
108
+ fontFamily: import("./styles/fonts").FontFamily;
109
+ fontSize: number;
110
+ lineHeight: number;
109
111
  };
110
112
  textMessage: {
111
113
  color: string;
112
- fontSize: number;
113
114
  textAlign: "center";
115
+ fontFamily: import("./styles/fonts").FontFamily;
116
+ fontSize: number;
117
+ lineHeight: number;
114
118
  };
115
119
  buttonText: {
116
120
  color: string;
117
- fontSize: number;
118
121
  textAlign: "center";
122
+ fontFamily: import("./styles/fonts").FontFamily;
123
+ fontSize: number;
124
+ lineHeight: number;
119
125
  };
120
126
  addToCalculationContainer: {
121
127
  justifyContent: "flex-start";
@@ -137,24 +143,35 @@ export declare const stylesModal: {
137
143
  };
138
144
  suggestedCarbs: {
139
145
  color: string;
146
+ fontFamily: import("./styles/fonts").FontFamily;
140
147
  fontSize: number;
148
+ lineHeight: number;
141
149
  };
142
150
  textCenter: {
143
151
  textAlign: "center";
152
+ fontFamily: import("./styles/fonts").FontFamily;
153
+ fontSize: number;
154
+ lineHeight: number;
144
155
  };
145
156
  recommendEatingText: {
146
157
  color: string;
147
158
  fontSize: number;
148
159
  textAlign: "center";
160
+ fontFamily: import("./styles/fonts").FontFamily;
161
+ lineHeight: number;
149
162
  };
150
163
  carbohydrateText: {
151
164
  color: string;
165
+ fontFamily: import("./styles/fonts").FontFamily;
152
166
  fontSize: number;
167
+ lineHeight: number;
153
168
  };
154
169
  addToCalculation: {
155
170
  color: string;
156
171
  fontSize: number;
157
172
  textAlign: "center";
173
+ fontFamily: import("./styles/fonts").FontFamily;
174
+ lineHeight: number;
158
175
  };
159
176
  recommendationButtonsContainer: {
160
177
  justifyContent: "center";
@@ -165,11 +182,15 @@ export declare const stylesModal: {
165
182
  color: string;
166
183
  fontSize: number;
167
184
  textAlign: "center";
185
+ fontFamily: import("./styles/fonts").FontFamily;
186
+ lineHeight: number;
168
187
  };
169
188
  negativeCarbsText: {
170
189
  color: string;
171
- fontSize: number;
172
190
  textAlign: "center";
191
+ fontFamily: import("./styles/fonts").FontFamily;
192
+ fontSize: number;
193
+ lineHeight: number;
173
194
  };
174
195
  affirmativeCarbsButton: {
175
196
  marginTop: string;