From 53a9399d6289bf426711db65e922e15a06f6bdfb Mon Sep 17 00:00:00 2001 From: cdOut <88325488+cdOut@users.noreply.github.com> Date: Wed, 19 Jun 2024 20:08:55 +0200 Subject: [PATCH 01/21] remove three dot menu from affected pages --- src/components/MoneyReportHeader.tsx | 21 --------------- src/components/MoneyRequestHeader.tsx | 33 ------------------------ src/pages/home/HeaderView.tsx | 37 --------------------------- 3 files changed, 91 deletions(-) diff --git a/src/components/MoneyReportHeader.tsx b/src/components/MoneyReportHeader.tsx index 90952157f179..10765fcf9d83 100644 --- a/src/components/MoneyReportHeader.tsx +++ b/src/components/MoneyReportHeader.tsx @@ -178,24 +178,6 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea [chatReport?.isOwnPolicyExpenseChat, policy?.harvesting?.enabled], ); - const threeDotsMenuItems = [HeaderUtils.getPinMenuItem(moneyRequestReport)]; - if (isPayer && isSettled && ReportUtils.isExpenseReport(moneyRequestReport)) { - threeDotsMenuItems.push({ - icon: Expensicons.Trashcan, - text: translate('iou.cancelPayment'), - onSelected: () => setIsConfirmModalVisible(true), - }); - } - - // If the report supports adding transactions to it, then it also supports deleting transactions from it. - if (canDeleteRequest && !isEmptyObject(transactionThreadReport)) { - threeDotsMenuItems.push({ - icon: Expensicons.Trashcan, - text: translate('reportActionContextMenu.deleteAction', {action: requestParentReportAction}), - onSelected: () => setIsDeleteRequestModalVisible(true), - }); - } - useEffect(() => { if (canDeleteRequest) { return; @@ -216,9 +198,6 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea onBackButtonPress={onBackButtonPress} // Shows border if no buttons or next steps are showing below the header shouldShowBorderBottom={!isMoreContentShown && !allHavePendingRTERViolation} - shouldShowThreeDotsButton - threeDotsMenuItems={threeDotsMenuItems} - threeDotsAnchorPosition={styles.threeDotsPopoverOffsetNoCloseButton(windowWidth)} > {shouldShowSettlementButton && !shouldUseNarrowLayout && ( diff --git a/src/components/MoneyRequestHeader.tsx b/src/components/MoneyRequestHeader.tsx index f14fe11f5d74..a32e11e92ff5 100644 --- a/src/components/MoneyRequestHeader.tsx +++ b/src/components/MoneyRequestHeader.tsx @@ -153,28 +153,6 @@ function MoneyRequestHeader({report, parentReportAction, policy, shouldUseNarrow setIsDeleteModalVisible(false); }, [canDeleteRequest]); - const threeDotsMenuItems = [HeaderUtils.getPinMenuItem(report)]; - if (canHoldOrUnholdRequest) { - const isRequestIOU = parentReport?.type === 'iou'; - const isHoldCreator = ReportUtils.isHoldCreator(transaction, report?.reportID) && isRequestIOU; - const isTrackExpenseReport = ReportUtils.isTrackExpenseReport(report); - const canModifyStatus = !isTrackExpenseReport && (isPolicyAdmin || isActionOwner || isApprover); - if (isOnHold && !isDuplicate && (isHoldCreator || (!isRequestIOU && canModifyStatus))) { - threeDotsMenuItems.push({ - icon: Expensicons.Stopwatch, - text: translate('iou.unholdExpense'), - onSelected: () => changeMoneyRequestStatus(), - }); - } - if (!isOnHold && (isRequestIOU || canModifyStatus) && !isScanning) { - threeDotsMenuItems.push({ - icon: Expensicons.Stopwatch, - text: translate('iou.hold'), - onSelected: () => changeMoneyRequestStatus(), - }); - } - } - useEffect(() => { if (isLoadingHoldUseExplained) { return; @@ -200,14 +178,6 @@ function MoneyRequestHeader({report, parentReportAction, policy, shouldUseNarrow IOU.dismissHoldUseExplanation(); }; - if (canDeleteRequest) { - threeDotsMenuItems.push({ - icon: Expensicons.Trashcan, - text: translate('reportActionContextMenu.deleteAction', {action: parentReportAction}), - onSelected: () => setIsDeleteModalVisible(true), - }); - } - return ( <> @@ -216,9 +186,6 @@ function MoneyRequestHeader({report, parentReportAction, policy, shouldUseNarrow shouldShowReportAvatarWithDisplay shouldEnableDetailPageNavigation shouldShowPinButton={false} - shouldShowThreeDotsButton - threeDotsMenuItems={threeDotsMenuItems} - threeDotsAnchorPosition={styles.threeDotsPopoverOffsetNoCloseButton(windowWidth)} report={{ ...report, ownerAccountID: parentReport?.ownerAccountID, diff --git a/src/pages/home/HeaderView.tsx b/src/pages/home/HeaderView.tsx index 699fbab345cb..ff6a7263f206 100644 --- a/src/pages/home/HeaderView.tsx +++ b/src/pages/home/HeaderView.tsx @@ -129,45 +129,10 @@ function HeaderView({ // We hide the button when we are chatting with an automated Expensify account since it's not possible to contact // these users via alternative means. It is possible to request a call with Concierge so we leave the option for them. const threeDotMenuItems: ThreeDotsMenuItem[] = []; - if (isTaskReport && !isCanceledTaskReport) { - const canModifyTask = Task.canModifyTask(report, session?.accountID ?? -1); - - // Task is marked as completed - if (ReportUtils.isCompletedTaskReport(report) && canModifyTask) { - threeDotMenuItems.push({ - icon: Expensicons.Checkmark, - text: translate('task.markAsIncomplete'), - onSelected: Session.checkIfActionIsAllowed(() => Task.reopenTask(report)), - }); - } - - // Task is not closed - if (ReportUtils.canWriteInReport(report) && report.stateNum !== CONST.REPORT.STATE_NUM.APPROVED && !ReportUtils.isClosedReport(report) && canModifyTask) { - threeDotMenuItems.push({ - icon: Expensicons.Trashcan, - text: translate('common.delete'), - onSelected: Session.checkIfActionIsAllowed(() => setIsDeleteTaskConfirmModalVisible(true)), - }); - } - } const join = Session.checkIfActionIsAllowed(() => Report.joinRoom(report)); const canJoin = ReportUtils.canJoinChat(report, parentReportAction, policy); - if (canJoin) { - threeDotMenuItems.push({ - icon: Expensicons.ChatBubbles, - text: translate('common.join'), - onSelected: join, - }); - } else if (ReportUtils.canLeaveChat(report, policy)) { - const isWorkspaceMemberLeavingWorkspaceRoom = !isChatThread && (report.visibility === CONST.REPORT.VISIBILITY.RESTRICTED || isPolicyExpenseChat) && isPolicyEmployee; - threeDotMenuItems.push({ - icon: Expensicons.ChatBubbles, - text: translate('common.leave'), - onSelected: Session.checkIfActionIsAllowed(() => Report.leaveRoom(reportID, isWorkspaceMemberLeavingWorkspaceRoom)), - }); - } const joinButton = (