@hedia/recommendation-screen 2.1.48 → 2.1.49-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5,29 +5,14 @@ export interface IProps {
|
|
|
5
5
|
/** To be called when the button is pressed. */
|
|
6
6
|
transfer(): void;
|
|
7
7
|
}
|
|
8
|
-
export interface IState {
|
|
9
|
-
/** Keeps track of whether the button was already pressed and thus should be displayed in the inactive visually distinct pressed state. */
|
|
10
|
-
pressed: boolean;
|
|
11
|
-
}
|
|
12
8
|
/**
|
|
13
9
|
* Render a button for transferring the recommendation to a logbook entry.
|
|
14
|
-
* The button has a visually distinct pressed state to signal to the user that the button was actually activated before returning to the dashboard screen.
|
|
15
10
|
*/
|
|
16
|
-
export default class TransferToLogbook extends React.Component<IProps
|
|
17
|
-
/** Initialise the state pressed variable with false */
|
|
18
|
-
state: IState;
|
|
19
|
-
/**
|
|
20
|
-
* Handle what happens when the button is pressed.
|
|
21
|
-
*
|
|
22
|
-
* Steps:
|
|
23
|
-
* 1. Toggle the pressed state to the opposite of its current value.
|
|
24
|
-
* 2. Call the transfer prop callback function.
|
|
25
|
-
*/
|
|
26
|
-
handlePress: () => void;
|
|
11
|
+
export default class TransferToLogbook extends React.Component<IProps> {
|
|
27
12
|
/**
|
|
28
13
|
* Steps:
|
|
29
14
|
* 1. If the visible prop is false, display an empty space to keep the correct margins in the screen.
|
|
30
|
-
* 2. Return a JSX element to display a touchable button
|
|
15
|
+
* 2. Return a JSX element to display a touchable button
|
|
31
16
|
* @returns JSX element for displaying the transfer button
|
|
32
17
|
*/
|
|
33
18
|
render(): JSX.Element;
|
|
@@ -3,49 +3,25 @@ import { Dimensions, StyleSheet, TouchableOpacity, View } from "react-native";
|
|
|
3
3
|
import { t } from "@lingui/macro";
|
|
4
4
|
import { i18n } from "../locale/i18nUtils";
|
|
5
5
|
import { Testing } from "../types/enum";
|
|
6
|
-
import Icon from "./Icon";
|
|
7
6
|
import TextBold from "./text/TextBold";
|
|
8
7
|
/**
|
|
9
8
|
* Render a button for transferring the recommendation to a logbook entry.
|
|
10
|
-
* The button has a visually distinct pressed state to signal to the user that the button was actually activated before returning to the dashboard screen.
|
|
11
9
|
*/
|
|
12
10
|
export default class TransferToLogbook extends React.Component {
|
|
13
|
-
/** Initialise the state pressed variable with false */
|
|
14
|
-
state = {
|
|
15
|
-
pressed: false,
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Handle what happens when the button is pressed.
|
|
19
|
-
*
|
|
20
|
-
* Steps:
|
|
21
|
-
* 1. Toggle the pressed state to the opposite of its current value.
|
|
22
|
-
* 2. Call the transfer prop callback function.
|
|
23
|
-
*/
|
|
24
|
-
handlePress = () => {
|
|
25
|
-
this.setState({
|
|
26
|
-
pressed: !this.state.pressed,
|
|
27
|
-
});
|
|
28
|
-
this.props.transfer();
|
|
29
|
-
};
|
|
30
11
|
/**
|
|
31
12
|
* Steps:
|
|
32
13
|
* 1. If the visible prop is false, display an empty space to keep the correct margins in the screen.
|
|
33
|
-
* 2. Return a JSX element to display a touchable button
|
|
14
|
+
* 2. Return a JSX element to display a touchable button
|
|
34
15
|
* @returns JSX element for displaying the transfer button
|
|
35
16
|
*/
|
|
36
17
|
render() {
|
|
37
18
|
if (!this.props.visible) {
|
|
38
19
|
return <View style={addToLogbookStyles.marginContainer}/>;
|
|
39
20
|
}
|
|
40
|
-
return (<TouchableOpacity testID={Testing.Id.TransferToLogbookTestIds.TransferButton} onPress={this.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
<Icon style={addToLogbookStyles.icon} iconIdentifier={`Feather/check`}/>
|
|
45
|
-
<TextBold style={addToLogbookStyles.transferTextActive}>
|
|
46
|
-
{i18n._(t `Transferred to logbook`)}
|
|
47
|
-
</TextBold>
|
|
48
|
-
</View>)}
|
|
21
|
+
return (<TouchableOpacity testID={Testing.Id.TransferToLogbookTestIds.TransferButton} onPress={this.props.transfer} style={addToLogbookStyles.container}>
|
|
22
|
+
<View style={addToLogbookStyles.textContainer}>
|
|
23
|
+
<TextBold style={addToLogbookStyles.transferText}>{i18n._(t `Transfer to logbook`)}</TextBold>
|
|
24
|
+
</View>
|
|
49
25
|
</TouchableOpacity>);
|
|
50
26
|
}
|
|
51
27
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hedia/recommendation-screen",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.49-alpha.0",
|
|
4
4
|
"description": "Hedia Recommendation Screen for Bolus and Carbohydrates",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
"build": "tsc --build && chmod +x copy-files.sh && ./copy-files.sh",
|
|
13
13
|
"clean": "tsc --build --clean && rm -rf dist/",
|
|
14
14
|
"build-guards": "ts-auto-guard src/**/[!index]*.ts",
|
|
15
|
-
"
|
|
16
|
-
"
|
|
15
|
+
"eslint": "tslint --project .",
|
|
16
|
+
"eslint-fix": "tslint --fix --project .",
|
|
17
17
|
"prettier": "prettier --check \"**/*.{ts,tsx}\"",
|
|
18
18
|
"prettier-fix": "prettier --write \"**/*.{ts,tsx}\"",
|
|
19
19
|
"pkg-json-lint": "npmPkgJsonLint .",
|
|
20
20
|
"package-audit": "npm-audit --critical --warn",
|
|
21
|
-
"pipeline": "npm run tsc && npm run
|
|
21
|
+
"pipeline": "npm run tsc && npm run eslint && npm run pkg-json-lint && npm run prettier && npm run package-audit",
|
|
22
22
|
"prepublishOnly": "npm ci --ignore-scripts --legacy-peer-deps && npm run build",
|
|
23
23
|
"postpublish": "npm run clean",
|
|
24
24
|
"a": "index-git.sh && cd android && gradlew clean && cd .. && react-native run-android",
|