From be6aba72a0615b4738cebf6f8cf6e36c31d41ca7 Mon Sep 17 00:00:00 2001 From: Abdelrahman Khattab Date: Tue, 9 Jan 2024 01:00:00 +0200 Subject: [PATCH] Hide download receipt button when offline --- src/components/AttachmentModal.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/AttachmentModal.js b/src/components/AttachmentModal.js index 1b4d350f7d4f..1e8921a40131 100755 --- a/src/components/AttachmentModal.js +++ b/src/components/AttachmentModal.js @@ -387,11 +387,13 @@ function AttachmentModal(props) { }, }); } - menuItems.push({ - icon: Expensicons.Download, - text: props.translate('common.download'), - onSelected: () => downloadAttachment(source), - }); + if (!isOffline) { + menuItems.push({ + icon: Expensicons.Download, + text: props.translate('common.download'), + onSelected: () => downloadAttachment(source), + }); + } if (TransactionUtils.hasReceipt(props.transaction) && !TransactionUtils.isReceiptBeingScanned(props.transaction) && props.canEditReceipt) { menuItems.push({ icon: Expensicons.Trashcan, @@ -413,7 +415,7 @@ function AttachmentModal(props) { if (!_.isEmpty(props.report)) { headerTitle = translate(props.isReceiptAttachment ? 'common.receipt' : 'common.attachment'); shouldShowDownloadButton = props.allowDownload && isDownloadButtonReadyToBeShown && !props.isReceiptAttachment && !isOffline; - shouldShowThreeDotsButton = props.isReceiptAttachment && isModalOpen; + shouldShowThreeDotsButton = props.isReceiptAttachment && isModalOpen && threeDotsMenuItems.length !== 0; } return (