@hedia/recommendation-screen 2.1.52 → 2.1.53-alpha.1

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 (86) hide show
  1. package/dist/src/RecommendationScreen.d.ts +3 -0
  2. package/dist/src/RecommendationScreen.js +39 -33
  3. package/dist/src/assets/IconsSVG/Close.d.ts +4 -0
  4. package/dist/src/assets/IconsSVG/Close.js +6 -0
  5. package/dist/src/assets/IconsSVG/Edit.d.ts +4 -0
  6. package/dist/src/assets/IconsSVG/Edit.js +7 -0
  7. package/dist/src/assets/IconsSVG/activity/Cycling.d.ts +4 -0
  8. package/dist/src/assets/IconsSVG/activity/Cycling.js +11 -0
  9. package/dist/src/assets/IconsSVG/activity/Running.d.ts +4 -0
  10. package/dist/src/assets/IconsSVG/activity/Running.js +9 -0
  11. package/dist/src/assets/IconsSVG/activity/Stretching.d.ts +4 -0
  12. package/dist/src/assets/IconsSVG/activity/Stretching.js +9 -0
  13. package/dist/src/assets/IconsSVG/activity/Swimming.d.ts +4 -0
  14. package/dist/src/assets/IconsSVG/activity/Swimming.js +12 -0
  15. package/dist/src/assets/IconsSVG/activity/Walking.d.ts +4 -0
  16. package/dist/src/assets/IconsSVG/activity/Walking.js +10 -0
  17. package/dist/src/assets/assets/IconsSVG/Close.tsx +13 -0
  18. package/dist/src/assets/assets/IconsSVG/Edit.tsx +16 -0
  19. package/dist/src/assets/assets/IconsSVG/activity/Cycling.tsx +40 -0
  20. package/dist/src/assets/assets/IconsSVG/activity/Running.tsx +28 -0
  21. package/dist/src/assets/assets/IconsSVG/activity/Stretching.tsx +28 -0
  22. package/dist/src/assets/assets/IconsSVG/activity/Swimming.tsx +46 -0
  23. package/dist/src/assets/assets/IconsSVG/activity/Walking.tsx +34 -0
  24. package/dist/src/components/ExitModal.d.ts +22 -0
  25. package/dist/src/components/ExitModal.js +89 -0
  26. package/dist/src/components/InfoBars.d.ts +4 -26
  27. package/dist/src/components/InfoBars.js +23 -53
  28. package/dist/src/components/LimitationMessage.js +6 -12
  29. package/dist/src/components/LineSeparator.d.ts +5 -1
  30. package/dist/src/components/LineSeparator.js +1 -3
  31. package/dist/src/components/RecentInsulin.d.ts +2 -1
  32. package/dist/src/components/RecentInsulin.js +38 -38
  33. package/dist/src/components/RecommendationModal.d.ts +24 -59
  34. package/dist/src/components/RecommendationModal.js +58 -95
  35. package/dist/src/components/RecommendedCarbs.js +67 -78
  36. package/dist/src/components/RecommendedInsulin.js +37 -59
  37. package/dist/src/components/Remeasure.js +28 -46
  38. package/dist/src/components/TimeoutModal.d.ts +20 -0
  39. package/dist/src/components/TimeoutModal.js +82 -0
  40. package/dist/src/components/TransferToLogbook.js +13 -12
  41. package/dist/src/components/activity/Activity.js +36 -40
  42. package/dist/src/components/activity/ActivityIcon.d.ts +7 -7
  43. package/dist/src/components/activity/ActivityIcon.js +30 -22
  44. package/dist/src/components/activity/ActivityIntensity.js +10 -17
  45. package/dist/src/components/mood/Emotion.js +6 -8
  46. package/dist/src/components/mood/MoodIcon.js +3 -9
  47. package/dist/src/components/styles/fonts.d.ts +9 -1
  48. package/dist/src/components/styles/fonts.js +8 -0
  49. package/dist/src/locale/da/messages.js +1 -1
  50. package/dist/src/locale/da/messages.po +2 -2
  51. package/dist/src/locale/de/messages.js +1 -1
  52. package/dist/src/locale/de/messages.po +2 -2
  53. package/dist/src/locale/en/messages.js +1 -1
  54. package/dist/src/locale/en/messages.po +2 -2
  55. package/dist/src/locale/es/messages.js +1 -1
  56. package/dist/src/locale/es/messages.po +2 -2
  57. package/dist/src/locale/fr/messages.js +1 -1
  58. package/dist/src/locale/fr/messages.po +2 -2
  59. package/dist/src/locale/it/messages.js +1 -1
  60. package/dist/src/locale/it/messages.po +2 -2
  61. package/dist/src/types/enum.d.ts +7 -2
  62. package/dist/src/types/enum.js +12 -6
  63. package/dist/src/utils/Constants.d.ts +1 -0
  64. package/dist/src/utils/Constants.js +1 -0
  65. package/package.json +2 -2
  66. package/dist/src/assets/activity/Cyclist.png +0 -0
  67. package/dist/src/assets/activity/Other.png +0 -0
  68. package/dist/src/assets/activity/Runner.png +0 -0
  69. package/dist/src/assets/activity/Swimmer.png +0 -0
  70. package/dist/src/assets/activity/Walk.png +0 -0
  71. package/dist/src/components/Header.d.ts +0 -10
  72. package/dist/src/components/Header.js +0 -76
  73. package/dist/src/components/Icon.d.ts +0 -20
  74. package/dist/src/components/Icon.js +0 -43
  75. package/dist/src/components/TwoOptionModal.d.ts +0 -147
  76. package/dist/src/components/TwoOptionModal.js +0 -140
  77. /package/dist/src/assets/{mood → assets/mood}/happy.png +0 -0
  78. /package/dist/src/assets/{mood → assets/mood}/happy_active.png +0 -0
  79. /package/dist/src/assets/{mood → assets/mood}/neutral.png +0 -0
  80. /package/dist/src/assets/{mood → assets/mood}/neutral_active.png +0 -0
  81. /package/dist/src/assets/{mood → assets/mood}/sad.png +0 -0
  82. /package/dist/src/assets/{mood → assets/mood}/sad_active.png +0 -0
  83. /package/dist/src/assets/{mood → assets/mood}/semi_happy.png +0 -0
  84. /package/dist/src/assets/{mood → assets/mood}/semi_happy_active.png +0 -0
  85. /package/dist/src/assets/{mood → assets/mood}/semi_sad.png +0 -0
  86. /package/dist/src/assets/{mood → assets/mood}/semi_sad_active.png +0 -0
@@ -1,11 +1,10 @@
1
1
  import { t } from "@lingui/macro";
2
2
  import Slider from "@react-native-community/slider";
3
3
  import React from "react";
4
- import { Platform, StyleSheet, View } from "react-native";
4
+ import { StyleSheet, View } from "react-native";
5
5
  import { i18n } from "../locale/i18nUtils";
6
6
  import { Testing } from "../types/enum";
7
7
  import { colors } from "../utils/Constants";
8
- import { infoStyles } from "./InfoBars";
9
8
  import { FONTS } from "./styles/fonts";
10
9
  import Text from "./Text";
11
10
  /**
@@ -57,71 +56,54 @@ export default class Remeasure extends React.Component {
57
56
  render() {
58
57
  const measure = this.props.remeasureTime > 0;
59
58
  const limited = this.limitTime(this.props.remeasureTime);
60
- const marginHorizontal = Platform.OS === `ios` ? `3%` : `0%`;
61
- const valueContainer = measure ? remeasureStyles.valueContainer : variantStyles.centeredValueContainer;
62
- return (<View style={remeasureStyles.container}>
63
- <View style={remeasureStyles.borderContainer}>
64
- <View style={remeasureStyles.remeasureContainer}>
65
- <Text style={remeasureStyles.remeasureLabel}>{i18n._(t `Remind me to remeasure in`)}</Text>
66
- </View>
67
- <View style={remeasureStyles.valueUnitContainer}>
68
- <View style={valueContainer}>
69
- <Text style={remeasureStyles.value} testID={Testing.Id.RemeasureTestIds.RemeasureHours}>
70
- {measure ? limited : i18n._(t `OFF`)}
71
- </Text>
72
- </View>
73
- {measure ? (<View style={remeasureStyles.unitContainer}>
74
- <Text style={remeasureStyles.units}>{i18n._(t `hours`)}</Text>
75
- </View>) : null}
59
+ return (<View style={styles.container}>
60
+ <View style={styles.textContainer}>
61
+ <Text style={styles.remeasureLabel}>{i18n._(t `Remind me to remeasure in`)}</Text>
62
+ <View style={styles.valueUnitContainer}>
63
+ <Text style={styles.value} testID={Testing.Id.RemeasureTestIds.RemeasureHours}>
64
+ {measure ? limited : i18n._(t `OFF`)}
65
+ </Text>
66
+ {measure && <Text style={styles.units}>{i18n._(t `hours`)}</Text>}
76
67
  </View>
77
68
  </View>
69
+
78
70
  <Slider ref={(slider) => {
79
71
  if (slider !== null) {
80
72
  this.slider = slider;
81
73
  }
82
- }} testID={Testing.Id.RemeasureTestIds.RemeasureSlider} maximumTrackTintColor={colors.mistBlue} minimumTrackTintColor={colors.teal} thumbTintColor={colors.teal} maximumValue={6} minimumValue={0} step={0.5} style={[remeasureStyles.sliderStyle, { marginHorizontal }]} onValueChange={this.handleSliderChange}/>
74
+ }} testID={Testing.Id.RemeasureTestIds.RemeasureSlider} maximumTrackTintColor={colors.mistBlue} minimumTrackTintColor={colors.blue} thumbTintColor={colors.white} maximumValue={6} minimumValue={0} step={0.5} onValueChange={this.handleSliderChange}/>
83
75
  </View>);
84
76
  }
85
77
  }
86
- const remeasureStyles = StyleSheet.create({
78
+ const styles = StyleSheet.create({
87
79
  container: {
88
80
  flexDirection: `column`,
89
- padding: `3%`,
90
- },
91
- borderContainer: {
92
- ...infoStyles.borderContainer,
93
- alignItems: `center`,
81
+ marginBottom: 32,
94
82
  },
95
- remeasureContainer: {
96
- flex: 7,
83
+ textContainer: {
84
+ flexDirection: `row`,
85
+ marginBottom: 18,
97
86
  },
98
87
  remeasureLabel: {
99
88
  ...FONTS.Poppins.regular_Base,
100
89
  color: colors.white,
90
+ flex: 7,
101
91
  },
102
92
  valueUnitContainer: {
103
- ...infoStyles.valueUnitContainer,
104
- },
105
- valueContainer: {
106
- ...infoStyles.valueContainer,
93
+ flex: 3,
94
+ justifyContent: `flex-end`,
95
+ alignItems: `center`,
96
+ flexDirection: `row`,
107
97
  },
108
98
  value: {
109
- ...infoStyles.value,
110
- },
111
- unitContainer: {
112
- ...infoStyles.unitContainer,
99
+ ...FONTS.Poppins.regular_LG,
100
+ textAlign: `right`,
101
+ color: colors.white,
113
102
  },
114
103
  units: {
115
- ...infoStyles.units,
116
- },
117
- sliderStyle: {
118
- marginTop: `3%`,
119
- marginBottom: `2%`,
120
- },
121
- });
122
- const variantStyles = StyleSheet.create({
123
- centeredValueContainer: {
124
- ...remeasureStyles.valueContainer,
125
- alignItems: `center`,
104
+ ...FONTS.Poppins.regular_XS,
105
+ textAlign: `left`,
106
+ paddingLeft: 4,
107
+ color: colors.white,
126
108
  },
127
109
  });
@@ -0,0 +1,20 @@
1
+ import * as React from "react";
2
+ export interface ITimeoutModalProps {
3
+ /** The title of the modal. */
4
+ title: string;
5
+ /** The message to show in the modal. */
6
+ message: string;
7
+ /** The label of the first option. */
8
+ textFirstOption: string;
9
+ /** The label of the second option. */
10
+ textSecondOption: string;
11
+ /** To be called if the user taps the first option button. */
12
+ firstOption(): void;
13
+ /** To be called if the user taps the second option button. */
14
+ secondOption(): void;
15
+ }
16
+ /** Display a modal with two buttons for the user to choose between. */
17
+ export default class TimeoutModal extends React.Component<ITimeoutModalProps> {
18
+ /** Compose a JSX element for displaying the modal. */
19
+ render(): JSX.Element;
20
+ }
@@ -0,0 +1,82 @@
1
+ import * as React from "react";
2
+ import { StatusBar, StyleSheet, TouchableOpacity, View } from "react-native";
3
+ import { Testing } from "../types/enum";
4
+ import { colors } from "../utils/Constants";
5
+ import { FONTS } from "./styles/fonts";
6
+ import Text from "./Text";
7
+ const { ExitModalTestIds: TwoOptionModalTestIds } = Testing.Id;
8
+ /** Display a modal with two buttons for the user to choose between. */
9
+ export default class TimeoutModal extends React.Component {
10
+ /** Compose a JSX element for displaying the modal. */
11
+ render() {
12
+ return (<View style={style.container}>
13
+ <StatusBar backgroundColor={colors.transparentLightBlue}/>
14
+ <View style={style.modalContainer}>
15
+ <View style={style.textContainer}>
16
+ <Text style={style.title}>{this.props.title}</Text>
17
+ <Text style={style.message}>{this.props.message}</Text>
18
+ </View>
19
+ <View style={style.buttonContainer}>
20
+ <TouchableOpacity testID={TwoOptionModalTestIds.FirstOption} onPress={this.props.firstOption} style={[style.button, { backgroundColor: colors.teal, marginBottom: 16 }]}>
21
+ <Text style={style.textFirstButton}>{this.props.textFirstOption}</Text>
22
+ </TouchableOpacity>
23
+ <TouchableOpacity testID={TwoOptionModalTestIds.SecondOption} onPress={this.props.secondOption} style={style.button}>
24
+ <Text style={style.textSecondButton}>{this.props.textSecondOption}</Text>
25
+ </TouchableOpacity>
26
+ </View>
27
+ </View>
28
+ </View>);
29
+ }
30
+ }
31
+ /** @internal */
32
+ const style = StyleSheet.create({
33
+ container: {
34
+ ...StyleSheet.absoluteFillObject,
35
+ justifyContent: `center`,
36
+ backgroundColor: colors.transparentBlack,
37
+ },
38
+ modalContainer: {
39
+ margin: 16,
40
+ padding: 24,
41
+ backgroundColor: colors.semiDarkBlue,
42
+ borderRadius: 24,
43
+ },
44
+ textContainer: {
45
+ alignSelf: `flex-start`,
46
+ marginBottom: 24,
47
+ },
48
+ title: {
49
+ ...FONTS.Poppins.bold_XL,
50
+ color: colors.white,
51
+ textAlign: `center`,
52
+ marginBottom: 24,
53
+ },
54
+ message: {
55
+ ...FONTS.Poppins.regular_Base,
56
+ color: colors.lightBlue,
57
+ textAlign: `center`,
58
+ },
59
+ buttonContainer: {
60
+ flexDirection: `column`,
61
+ justifyContent: `space-around`,
62
+ },
63
+ button: {
64
+ borderRadius: 50,
65
+ borderWidth: 1,
66
+ borderColor: colors.teal,
67
+ },
68
+ textFirstButton: {
69
+ ...FONTS.Poppins.bold_LG,
70
+ textAlign: `center`,
71
+ color: colors.black,
72
+ paddingHorizontal: 16,
73
+ paddingVertical: 12,
74
+ },
75
+ textSecondButton: {
76
+ ...FONTS.Poppins.bold_LG,
77
+ textAlign: `center`,
78
+ color: colors.teal,
79
+ paddingHorizontal: 16,
80
+ paddingVertical: 12,
81
+ },
82
+ });
@@ -36,7 +36,7 @@ export default class TransferToLogbook extends React.Component {
36
36
  */
37
37
  render() {
38
38
  if (!this.props.visible) {
39
- return <View style={addToLogbookStyles.marginContainer}/>;
39
+ return <View style={addToLogbookStyles.emptyContainer}/>;
40
40
  }
41
41
  return (<TouchableOpacity testID={Testing.Id.TransferToLogbookTestIds.TransferButton} onPress={this.handlePress} disabled={this.state.pressed} style={addToLogbookStyles.container}>
42
42
  <View style={addToLogbookStyles.textContainer}>
@@ -46,24 +46,25 @@ export default class TransferToLogbook extends React.Component {
46
46
  }
47
47
  }
48
48
  const addToLogbookStyles = StyleSheet.create({
49
- marginContainer: {
50
- marginVertical: `3%`,
49
+ emptyContainer: {
50
+ marginBottom: 32,
51
51
  },
52
52
  container: {
53
- flex: 1,
54
- margin: `5%`,
53
+ borderRadius: 50,
54
+ backgroundColor: colors.teal,
55
+ marginBottom: 32,
56
+ justifyContent: `center`,
57
+ alignSelf: `center`,
55
58
  },
56
59
  textContainer: {
57
60
  flexDirection: `row`,
58
61
  justifyContent: `center`,
59
- borderWidth: 1,
60
- borderRadius: 100,
61
- marginHorizontal: `4%`,
62
- paddingVertical: `4%`,
63
- borderColor: colors.teal,
64
62
  },
65
63
  transferText: {
66
- ...FONTS.Poppins.bold_LG,
67
- color: colors.teal,
64
+ ...FONTS.Poppins.bold_Base,
65
+ color: colors.black,
66
+ paddingVertical: 12,
67
+ paddingHorizontal: 16,
68
+ textAlign: `center`,
68
69
  },
69
70
  });
@@ -27,58 +27,54 @@ export default class Activity extends React.Component {
27
27
  render() {
28
28
  const { activity, activityType, activityReduction, activityTitle } = this.props;
29
29
  const reductionPercentage = ((activityReduction ?? 0) * 100).toFixed(0);
30
- return (<View style={[infoStyles.container, activityStyles.botMargin]}>
31
- <View style={infoStyles.margin}>
32
- <View style={infoStyles.border}>
33
- <View style={infoStyles.borderContainer}>
34
- <View style={infoStyles.labelContainer}>
35
- <Text style={infoStyles.label}>{i18n._(t `Activity`)}</Text>
36
- </View>
37
- <View style={infoStyles.valueUnitContainer}>
38
- <View style={infoStyles.valueContainer}>
39
- <Text style={infoStyles.value} testID={Testing.Id.ActivityTestIds.ActivityDuration}>
40
- {activity.activityDuration}
41
- </Text>
42
- </View>
43
- <View style={infoStyles.unitContainer}>
44
- <Text style={infoStyles.units}>{i18n._(t `min`)}</Text>
45
- </View>
46
- </View>
47
- </View>
48
- <ActivityIcon activityType={activityType} activityTitle={activityTitle}/>
49
- <ActivityIntensity activityIntensity={activity.activityIntensity}/>
50
- <View style={[infoStyles.borderContainer, activityStyles.topMargin]}>
51
- <Text style={activityStyles.infoText}>
52
- {i18n._(t `Based on the selected activity your insulin recommendation is reduced by:`)}
53
- </Text>
54
- </View>
55
- <View style={[infoStyles.borderContainer, activityStyles.verticalMargin]}>
56
- <Text style={activityStyles.reductionPercentage} testID={Testing.Id.ActivityTestIds.ActivityReduction}>
57
- {reductionPercentage}%
58
- </Text>
59
- </View>
30
+ return (<View style={styles.container}>
31
+ <View style={styles.activityTextContainer}>
32
+ <View style={infoStyles.labelContainer}>
33
+ <Text style={styles.label}>{i18n._(t `Activity`)}</Text>
34
+ </View>
35
+ <View style={infoStyles.valueUnitContainer}>
36
+ <Text style={infoStyles.value} testID={Testing.Id.ActivityTestIds.ActivityDuration}>
37
+ {activity.activityDuration}
38
+ </Text>
39
+ <Text style={infoStyles.units}>{i18n._(t `min`)}</Text>
60
40
  </View>
61
41
  </View>
42
+ <ActivityIcon activityType={activityType} activityTitle={activityTitle}/>
43
+ <ActivityIntensity activityIntensity={activity.activityIntensity}/>
44
+ <Text style={styles.infoText}>
45
+ {i18n._(t `Based on the selected activity your insulin recommendation is reduced by:`)}
46
+ </Text>
47
+ <Text style={styles.reductionPercentage} testID={Testing.Id.ActivityTestIds.ActivityReduction}>
48
+ {reductionPercentage}%
49
+ </Text>
62
50
  </View>);
63
51
  }
64
52
  }
65
- const activityStyles = StyleSheet.create({
66
- topMargin: {
67
- marginTop: `2%`,
68
- },
69
- botMargin: {
70
- marginBottom: `2%`,
53
+ const styles = StyleSheet.create({
54
+ container: {
55
+ flex: 1,
56
+ marginBottom: 32,
57
+ padding: 16,
58
+ borderWidth: 1,
59
+ borderColor: colors.dustyDarkBlue,
60
+ borderRadius: 5,
71
61
  },
72
- verticalMargin: {
73
- marginBottom: `2%`,
62
+ activityTextContainer: {
63
+ flex: 1,
64
+ flexDirection: `row`,
65
+ marginBottom: 6,
74
66
  },
75
67
  infoText: {
76
68
  ...FONTS.Poppins.regular_Base,
77
69
  color: colors.lightBlue,
70
+ marginBottom: 4,
78
71
  },
79
72
  reductionPercentage: {
80
- ...FONTS.Poppins.bold_XL,
73
+ ...FONTS.Poppins.medium_Base,
74
+ color: colors.fadeBlue,
75
+ },
76
+ label: {
77
+ ...FONTS.Poppins.regular_Base,
81
78
  color: colors.white,
82
- marginTop: `2%`,
83
79
  },
84
80
  });
@@ -1,21 +1,21 @@
1
- import { Activity } from "@hedia/types";
2
1
  import React from "react";
3
- import { ImageURISource } from "react-native";
2
+ import { SvgProps } from "react-native-svg";
4
3
  import { IActivityDisplayProps } from "../../types/types";
5
- /** Mapping from ActivityEnums to corresponding image resource. */
6
- export declare const ACTIVITY_ICONS: Record<Activity.Enums.ActivityEnum, ImageURISource>;
7
- /** Component used to displat the user's physical activity type icon */
4
+ /**
5
+ Component used to displat the user's physical activity type icon
6
+ Mapping from ActivityEnums to corresponding image resource.
7
+ */
8
8
  export default class ActivityIcon extends React.Component<IActivityDisplayProps> {
9
9
  /**
10
10
  * @returns The value from the ACTIVITY_ICONS constant that corresponds to the value of the activityType prop.
11
11
  */
12
- getActivityIcon: () => ImageURISource;
12
+ getActivityIcon: (props?: SvgProps | undefined) => JSX.Element;
13
13
  /**
14
14
  * Steps:
15
15
  * 1. Unpack activityType and activityTitle from props.
16
16
  * 2. Create a testID string by appending ‘_activity’ to the enum label corresponding to the activityType prop.
17
17
  * @returns A JSX element including the following:
18
- * 1. An image component with the generated testID displaying the icon from getActivityIcon().
18
+ * 1. An svg component with the generated testID displaying the icon from getActivityIcon().
19
19
  * 2. The activityTitle if it is truthy or the string “Untitled Activity” otherwise
20
20
  */
21
21
  render(): JSX.Element | null;
@@ -1,26 +1,33 @@
1
1
  import { Activity } from "@hedia/types";
2
2
  import { t } from "@lingui/macro";
3
3
  import React from "react";
4
- import { Dimensions, Image, StyleSheet, View } from "react-native";
4
+ import { StyleSheet, View } from "react-native";
5
+ import Cycling from "../../assets/IconsSVG/activity/Cycling";
6
+ import Running from "../../assets/IconsSVG/activity/Running";
7
+ import Stretching from "../../assets/IconsSVG/activity/Stretching";
8
+ import Swimming from "../../assets/IconsSVG/activity/Swimming";
9
+ import Walking from "../../assets/IconsSVG/activity/Walking";
5
10
  import { i18n } from "../../locale/i18nUtils";
6
11
  import { colors } from "../../utils/Constants";
7
12
  import { FONTS } from "../styles/fonts";
8
13
  import Text from "../Text";
9
14
  const { Other } = Activity.Enums.ActivityEnum;
10
- /** Mapping from ActivityEnums to corresponding image resource. */
11
- export const ACTIVITY_ICONS = {
12
- Run: require(`../../assets/activity/Runner.png`),
13
- Walk: require(`../../assets/activity/Walk.png`),
14
- Cycling: require(`../../assets/activity/Cyclist.png`),
15
- Swim: require(`../../assets/activity/Swimmer.png`),
16
- Other: require(`../../assets/activity/Other.png`),
17
- };
18
- /** Component used to displat the user's physical activity type icon */
15
+ /**
16
+ Component used to displat the user's physical activity type icon
17
+ Mapping from ActivityEnums to corresponding image resource.
18
+ */
19
19
  export default class ActivityIcon extends React.Component {
20
20
  /**
21
21
  * @returns The value from the ACTIVITY_ICONS constant that corresponds to the value of the activityType prop.
22
22
  */
23
- getActivityIcon = () => {
23
+ getActivityIcon = (props) => {
24
+ const ACTIVITY_ICONS = {
25
+ Run: Running(props),
26
+ Walk: Walking(props),
27
+ Cycling: Cycling(props),
28
+ Swim: Swimming(props),
29
+ Other: Stretching(props),
30
+ };
24
31
  return ACTIVITY_ICONS[this.props.activityType ?? Other];
25
32
  };
26
33
  /**
@@ -28,31 +35,32 @@ export default class ActivityIcon extends React.Component {
28
35
  * 1. Unpack activityType and activityTitle from props.
29
36
  * 2. Create a testID string by appending ‘_activity’ to the enum label corresponding to the activityType prop.
30
37
  * @returns A JSX element including the following:
31
- * 1. An image component with the generated testID displaying the icon from getActivityIcon().
38
+ * 1. An svg component with the generated testID displaying the icon from getActivityIcon().
32
39
  * 2. The activityTitle if it is truthy or the string “Untitled Activity” otherwise
33
40
  */
34
41
  render() {
35
42
  const { activityType, activityTitle } = this.props;
36
43
  const testID = `${Activity.Enums.ActivityEnum[activityType ?? Other]}-icon`.toLowerCase();
37
- return (<View style={activityIconStyles.container}>
38
- <Image style={activityIconStyles.activityIcon} source={this.getActivityIcon()} testID={testID}/>
39
- <Text style={activityIconStyles.activityTitle}>{activityTitle || i18n._(t `Untitled Activity`)}</Text>
44
+ return (<View style={styles.container}>
45
+ {this.getActivityIcon({ testID, style: styles.icon })}
46
+ <Text style={styles.activityTitle}>{activityTitle || i18n._(t `Untitled Activity`)}</Text>
40
47
  </View>);
41
48
  }
42
49
  }
43
- const activityIconStyles = StyleSheet.create({
50
+ const styles = StyleSheet.create({
44
51
  container: {
45
52
  flex: 1,
46
53
  flexDirection: `row`,
47
54
  alignItems: `center`,
48
- marginTop: `1%`,
49
- },
50
- activityIcon: {
51
- resizeMode: `contain`,
52
- height: Dimensions.get(`screen`).width / 16,
55
+ marginBottom: 6,
53
56
  },
54
57
  activityTitle: {
55
- ...FONTS.Poppins.regular_Base,
58
+ ...FONTS.Poppins.regular_SM,
56
59
  color: colors.white,
60
+ marginLeft: 4,
61
+ },
62
+ icon: {
63
+ width: 20,
64
+ height: 20,
57
65
  },
58
66
  });
@@ -3,7 +3,6 @@ import React from "react";
3
3
  import { StyleSheet, View } from "react-native";
4
4
  import { colors } from "../../utils/Constants";
5
5
  import { ActivityIntensityTranslations } from "../../utils/Translations";
6
- import { infoStyles } from "../InfoBars";
7
6
  import { FONTS } from "../styles/fonts";
8
7
  import Text from "../Text";
9
8
  /** Component used to display the users's physical activity intensity on its corresponding background color */
@@ -17,27 +16,27 @@ export default class ActivityIntensity extends React.Component {
17
16
  render = () => {
18
17
  const intensity = this.props.activityIntensity;
19
18
  const style = activityIntensityStyles[intensity];
20
- return (<View style={[infoStyles.margin, activityIntensityStyles.row]}>
21
- <View style={activityIntensityStyles.intensityContainer}>
22
- <View style={[activityIntensityStyles.intensityTextContainer, style]}>
23
- <Text style={activityIntensityStyles.text} testID={`intensity-${intensity}`}>
24
- {ActivityIntensityTranslations[intensity]()}
25
- </Text>
26
- </View>
19
+ return (<View style={activityIntensityStyles.row}>
20
+ <View style={[activityIntensityStyles.intensityTextContainer, style]}>
21
+ <Text style={activityIntensityStyles.text} testID={`intensity-${intensity}`}>
22
+ {ActivityIntensityTranslations[intensity]()}
23
+ </Text>
27
24
  </View>
28
- <View style={activityIntensityStyles.intensityContainerOffset}/>
29
25
  </View>);
30
26
  };
31
27
  }
32
28
  const activityIntensityStyles = StyleSheet.create({
33
29
  row: {
34
30
  flexDirection: `row`,
31
+ marginBottom: 6,
32
+ minHeight: 24,
35
33
  },
36
34
  intensityTextContainer: {
37
35
  alignItems: `center`,
38
36
  justifyContent: `center`,
39
- padding: `5%`,
40
37
  borderRadius: 5,
38
+ paddingVertical: 4,
39
+ paddingHorizontal: 17.5,
41
40
  },
42
41
  [Activity.Enums.ActivityIntensity.light]: {
43
42
  backgroundColor: colors.activityGreen,
@@ -48,14 +47,8 @@ const activityIntensityStyles = StyleSheet.create({
48
47
  [Activity.Enums.ActivityIntensity.hard]: {
49
48
  backgroundColor: colors.activityRed,
50
49
  },
51
- intensityContainer: {
52
- flex: 5,
53
- },
54
- intensityContainerOffset: {
55
- flex: 16,
56
- },
57
50
  text: {
58
- ...FONTS.Poppins.bold_SM,
51
+ ...FONTS.Poppins.medium_XS,
59
52
  color: colors.black,
60
53
  },
61
54
  });
@@ -41,9 +41,7 @@ export default class Emotion extends React.Component {
41
41
  */
42
42
  render() {
43
43
  return (<View style={emotionStyles.container}>
44
- <View style={emotionStyles.feelingContainer}>
45
- <Text style={emotionStyles.feelingText}>{i18n._(t `How are you feeling?`)}</Text>
46
- </View>
44
+ <Text style={emotionStyles.feelingText}>{i18n._(t `How are you feeling?`)}</Text>
47
45
  <View style={emotionStyles.moodIconContainer}>{this.mappedMoods()}</View>
48
46
  </View>);
49
47
  }
@@ -51,14 +49,14 @@ export default class Emotion extends React.Component {
51
49
  const emotionStyles = StyleSheet.create({
52
50
  container: {
53
51
  flex: 1,
54
- },
55
- feelingContainer: {
56
- marginVertical: `3%`,
52
+ paddingHorizontal: 40,
53
+ marginBottom: 28,
57
54
  },
58
55
  feelingText: {
59
- ...FONTS.Poppins.bold_Base,
56
+ ...FONTS.Poppins.regular_Base,
60
57
  textAlign: `center`,
61
58
  color: colors.white,
59
+ marginBottom: 6,
62
60
  },
63
- moodIconContainer: { flex: 1, flexDirection: `row`, justifyContent: `center` },
61
+ moodIconContainer: { flex: 1, flexDirection: `row`, justifyContent: `space-between` },
64
62
  });
@@ -1,6 +1,6 @@
1
1
  import { Logbook } from "@hedia/types";
2
2
  import React from "react";
3
- import { Dimensions, Image, StyleSheet, TouchableOpacity } from "react-native";
3
+ import { Image, StyleSheet, TouchableOpacity } from "react-native";
4
4
  const MoodEnum = Logbook.Enums.MoodEnum;
5
5
  /** Mapping from {@link Logbook.Enums.MoodEnum} to corresponding image resources */
6
6
  export const MOODS_INACTIVE = {
@@ -47,17 +47,11 @@ export default class MoodIcon extends React.Component {
47
47
  render() {
48
48
  const { mood, active } = this.props;
49
49
  const testID = `${MoodEnum[mood]}-${active}`;
50
- return (<TouchableOpacity style={moodIconStyles.container} onPress={this.handleOnPress} testID={testID}>
50
+ return (<TouchableOpacity onPress={this.handleOnPress} testID={testID}>
51
51
  <Image style={moodIconStyles.icon} source={this.getMoodIcon()}/>
52
52
  </TouchableOpacity>);
53
53
  }
54
54
  }
55
55
  const moodIconStyles = StyleSheet.create({
56
- container: {
57
- marginHorizontal: `1%`,
58
- },
59
- icon: {
60
- width: Dimensions.get(`screen`).width / 8,
61
- height: Dimensions.get(`screen`).width / 8,
62
- },
56
+ icon: { flex: 1, width: 40, height: 40 },
63
57
  });
@@ -1,9 +1,17 @@
1
1
  export declare enum FontFamily {
2
2
  PoppinsBold = "Poppins-Bold",
3
3
  PoppinsMedium = "Poppins-Medium",
4
- PoppinsRegular = "Poppins-Regular"
4
+ PoppinsRegular = "Poppins-Regular",
5
+ OswaldMedium = "Oswald-Medium"
5
6
  }
6
7
  export declare const FONTS: {
8
+ Oswald: {
9
+ bold_7XL: {
10
+ fontFamily: FontFamily;
11
+ fontSize: number;
12
+ lineHeight: number;
13
+ };
14
+ };
7
15
  Poppins: {
8
16
  bold_4XL: {
9
17
  fontFamily: FontFamily;
@@ -3,8 +3,16 @@ export var FontFamily;
3
3
  FontFamily["PoppinsBold"] = "Poppins-Bold";
4
4
  FontFamily["PoppinsMedium"] = "Poppins-Medium";
5
5
  FontFamily["PoppinsRegular"] = "Poppins-Regular";
6
+ FontFamily["OswaldMedium"] = "Oswald-Medium";
6
7
  })(FontFamily || (FontFamily = {}));
7
8
  export const FONTS = {
9
+ Oswald: {
10
+ bold_7XL: {
11
+ fontFamily: FontFamily.OswaldMedium,
12
+ fontSize: 80,
13
+ lineHeight: 120,
14
+ },
15
+ },
8
16
  Poppins: {
9
17
  bold_4XL: {
10
18
  fontFamily: FontFamily.PoppinsBold,