From 5924182b618db7508ac6a87e5748d7fd34c67a0b Mon Sep 17 00:00:00 2001 From: Alberto Date: Wed, 25 May 2022 15:20:17 +0200 Subject: [PATCH 1/7] Create style --- src/styles/styles.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/styles/styles.js b/src/styles/styles.js index dbce0a6b052d..54729c21abdd 100644 --- a/src/styles/styles.js +++ b/src/styles/styles.js @@ -2525,6 +2525,13 @@ const styles = { marginBottom: 40, padding: 16, }, + + inlineSystemMessage: { + color: themeColors.textSupporting, + fontSize: variables.fontSizeLabel, + fontFamily: fontFamily.GTA, + marginLeft: 4, + }, }; export default styles; From 4b10ec04a6109e4b69af3073979ba0ca7711b1ae Mon Sep 17 00:00:00 2001 From: Alberto Date: Thu, 26 May 2022 10:06:51 +0200 Subject: [PATCH 2/7] Actually add the file --- src/components/IOUConfirmationList.js | 4 +-- src/components/InlineSystemMessage.js | 26 +++++++++++++++++++ .../home/report/ReportActionItemMessage.js | 6 +++++ 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 src/components/InlineSystemMessage.js diff --git a/src/components/IOUConfirmationList.js b/src/components/IOUConfirmationList.js index 7468e2138ca4..d789fea4020c 100755 --- a/src/components/IOUConfirmationList.js +++ b/src/components/IOUConfirmationList.js @@ -346,9 +346,9 @@ class IOUConfirmationList extends Component { render() { const hoverStyle = this.props.hasMultipleParticipants ? styles.hoveredComponentBG : {}; const toggleOption = this.props.hasMultipleParticipants ? this.toggleOption : undefined; - const selectedParticipants = this.getSelectedParticipants(); + //const selectedParticipants = this.getSelectedParticipants(); const shouldShowSettlementButton = this.props.iouType === CONST.IOU.IOU_TYPE.SEND; - const shouldDisableButton = selectedParticipants.length === 0 || this.props.network.isOffline; + const shouldDisableButton = this.props.network.isOffline; const isLoading = this.props.iou.loading && !this.props.network.isOffline; const recipient = this.state.participants[0]; const canModifyParticipants = this.props.isIOUAttachedToExistingChatReport && this.props.hasMultipleParticipants; diff --git a/src/components/InlineSystemMessage.js b/src/components/InlineSystemMessage.js new file mode 100644 index 000000000000..a755c6ec5a26 --- /dev/null +++ b/src/components/InlineSystemMessage.js @@ -0,0 +1,26 @@ +import React from 'react'; +import {View} from 'react-native'; +import PropTypes from 'prop-types'; +import styles from '../styles/styles'; +import Text from './Text'; +import * as Expensicons from './Icon/Expensicons'; +import colors from '../styles/colors'; +import Icon from './Icon'; + +const propTypes = { + /** Error to display */ + message: PropTypes.string.isRequired, +}; + +const InlineSystemMessage = (props) => { + return ( + + + {props.message} + + ); +}; + +InlineSystemMessage.propTypes = propTypes; +InlineSystemMessage.displayName = 'InlineErrorText'; +export default InlineSystemMessage; diff --git a/src/pages/home/report/ReportActionItemMessage.js b/src/pages/home/report/ReportActionItemMessage.js index c1eb02a8326d..0670c9bb7104 100644 --- a/src/pages/home/report/ReportActionItemMessage.js +++ b/src/pages/home/report/ReportActionItemMessage.js @@ -9,6 +9,7 @@ import {withNetwork} from '../../../components/OnyxProvider'; import withLocalize, {withLocalizePropTypes} from '../../../components/withLocalize'; import compose from '../../../libs/compose'; import networkPropTypes from '../../../components/networkPropTypes'; +import InlineSystemMessage from "../../../components/InlineSystemMessage"; const propTypes = { /** The report action */ @@ -27,6 +28,7 @@ const ReportActionItemMessage = (props) => { return ( {_.map(_.compact(props.action.message), (fragment, index) => ( + <> { attachmentInfo={props.action.attachmentInfo} loading={props.action.loading} /> + + ))} ); From 87e5cc72cdd2ac2fb3d68e9426fbee36df7073c6 Mon Sep 17 00:00:00 2001 From: Alberto Date: Thu, 26 May 2022 10:13:45 +0200 Subject: [PATCH 3/7] remove testing changes --- src/components/IOUConfirmationList.js | 4 ++-- src/pages/home/report/ReportActionItemMessage.js | 6 ------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/components/IOUConfirmationList.js b/src/components/IOUConfirmationList.js index d789fea4020c..7468e2138ca4 100755 --- a/src/components/IOUConfirmationList.js +++ b/src/components/IOUConfirmationList.js @@ -346,9 +346,9 @@ class IOUConfirmationList extends Component { render() { const hoverStyle = this.props.hasMultipleParticipants ? styles.hoveredComponentBG : {}; const toggleOption = this.props.hasMultipleParticipants ? this.toggleOption : undefined; - //const selectedParticipants = this.getSelectedParticipants(); + const selectedParticipants = this.getSelectedParticipants(); const shouldShowSettlementButton = this.props.iouType === CONST.IOU.IOU_TYPE.SEND; - const shouldDisableButton = this.props.network.isOffline; + const shouldDisableButton = selectedParticipants.length === 0 || this.props.network.isOffline; const isLoading = this.props.iou.loading && !this.props.network.isOffline; const recipient = this.state.participants[0]; const canModifyParticipants = this.props.isIOUAttachedToExistingChatReport && this.props.hasMultipleParticipants; diff --git a/src/pages/home/report/ReportActionItemMessage.js b/src/pages/home/report/ReportActionItemMessage.js index 0670c9bb7104..c1eb02a8326d 100644 --- a/src/pages/home/report/ReportActionItemMessage.js +++ b/src/pages/home/report/ReportActionItemMessage.js @@ -9,7 +9,6 @@ import {withNetwork} from '../../../components/OnyxProvider'; import withLocalize, {withLocalizePropTypes} from '../../../components/withLocalize'; import compose from '../../../libs/compose'; import networkPropTypes from '../../../components/networkPropTypes'; -import InlineSystemMessage from "../../../components/InlineSystemMessage"; const propTypes = { /** The report action */ @@ -28,7 +27,6 @@ const ReportActionItemMessage = (props) => { return ( {_.map(_.compact(props.action.message), (fragment, index) => ( - <> { attachmentInfo={props.action.attachmentInfo} loading={props.action.loading} /> - - ))} ); From 1a8f9f0a407e76b1e6e6072a160989ce3fb7edf3 Mon Sep 17 00:00:00 2001 From: Alberto Date: Thu, 26 May 2022 10:32:11 +0200 Subject: [PATCH 4/7] check message length --- src/components/InlineSystemMessage.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/InlineSystemMessage.js b/src/components/InlineSystemMessage.js index a755c6ec5a26..ebefb8493dba 100644 --- a/src/components/InlineSystemMessage.js +++ b/src/components/InlineSystemMessage.js @@ -13,6 +13,9 @@ const propTypes = { }; const InlineSystemMessage = (props) => { + if (props.message.length() === 0) { + return; + } return ( From 37735dc797853c1cc9577a1b0834b6107fd38dd6 Mon Sep 17 00:00:00 2001 From: Alberto Date: Thu, 26 May 2022 10:41:47 +0200 Subject: [PATCH 5/7] lint --- src/components/InlineSystemMessage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/InlineSystemMessage.js b/src/components/InlineSystemMessage.js index ebefb8493dba..9cde367d44fd 100644 --- a/src/components/InlineSystemMessage.js +++ b/src/components/InlineSystemMessage.js @@ -18,8 +18,8 @@ const InlineSystemMessage = (props) => { } return ( - - {props.message} + + {props.message} ); }; From 59815457e183013f368a4747b4cda4b0ab625403 Mon Sep 17 00:00:00 2001 From: Alberto Date: Thu, 26 May 2022 12:24:31 +0200 Subject: [PATCH 6/7] change export name --- src/components/InlineSystemMessage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/InlineSystemMessage.js b/src/components/InlineSystemMessage.js index 9cde367d44fd..8b40909770c5 100644 --- a/src/components/InlineSystemMessage.js +++ b/src/components/InlineSystemMessage.js @@ -13,7 +13,7 @@ const propTypes = { }; const InlineSystemMessage = (props) => { - if (props.message.length() === 0) { + if (props.message.length === 0) { return; } return ( @@ -25,5 +25,5 @@ const InlineSystemMessage = (props) => { }; InlineSystemMessage.propTypes = propTypes; -InlineSystemMessage.displayName = 'InlineErrorText'; +InlineSystemMessage.displayName = 'InlineSystemMessage'; export default InlineSystemMessage; From 78576a817d9588eea6a461d782321334f92fe6dd Mon Sep 17 00:00:00 2001 From: Alberto Date: Thu, 26 May 2022 12:32:01 +0200 Subject: [PATCH 7/7] return null --- src/components/InlineSystemMessage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/InlineSystemMessage.js b/src/components/InlineSystemMessage.js index 8b40909770c5..4ecd6d201c0d 100644 --- a/src/components/InlineSystemMessage.js +++ b/src/components/InlineSystemMessage.js @@ -14,7 +14,7 @@ const propTypes = { const InlineSystemMessage = (props) => { if (props.message.length === 0) { - return; + return null; } return (