From b82ea55cd1bcb0b0188dd136d72064a740d1bc3b Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Tue, 25 Mar 2025 00:23:45 +0300 Subject: [PATCH 1/3] applied shouldCallAfterModalHide on FAB menu-items --- .../AttachmentPickerWithMenuItems.tsx | 6 ++++++ .../home/sidebar/FloatingActionButtonAndPopover.tsx | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.tsx b/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.tsx index 3b2500c04cbd8..1ed9e470718f4 100644 --- a/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.tsx +++ b/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.tsx @@ -142,16 +142,19 @@ function AttachmentPickerWithMenuItems({ [CONST.IOU.TYPE.SPLIT]: { icon: Expensicons.Transfer, text: translate('iou.splitExpense'), + shouldCallAfterModalHide: true, onSelected: () => selectOption(() => startMoneyRequest(CONST.IOU.TYPE.SPLIT, report?.reportID ?? String(CONST.DEFAULT_NUMBER_ID)), true), }, [CONST.IOU.TYPE.SUBMIT]: { icon: getIconForAction(CONST.IOU.TYPE.CREATE), text: translate('iou.createExpense'), + shouldCallAfterModalHide: true, onSelected: () => selectOption(() => startMoneyRequest(CONST.IOU.TYPE.SUBMIT, report?.reportID ?? String(CONST.DEFAULT_NUMBER_ID)), true), }, [CONST.IOU.TYPE.PAY]: { icon: getIconForAction(CONST.IOU.TYPE.SEND), text: translate('iou.paySomeone', {name: getPayeeName(report)}), + shouldCallAfterModalHide: true, onSelected: () => { if (isDelegateAccessRestricted) { close(() => { @@ -165,11 +168,13 @@ function AttachmentPickerWithMenuItems({ [CONST.IOU.TYPE.TRACK]: { icon: getIconForAction(CONST.IOU.TYPE.CREATE), text: translate('iou.createExpense'), + shouldCallAfterModalHide: true, onSelected: () => selectOption(() => startMoneyRequest(CONST.IOU.TYPE.TRACK, report?.reportID ?? String(CONST.DEFAULT_NUMBER_ID)), true), }, [CONST.IOU.TYPE.INVOICE]: { icon: Expensicons.InvoiceGeneric, text: translate('workspace.invoices.sendInvoice'), + shouldCallAfterModalHide: true, onSelected: () => selectOption(() => startMoneyRequest(CONST.IOU.TYPE.INVOICE, report?.reportID ?? String(CONST.DEFAULT_NUMBER_ID)), false), }, }; @@ -193,6 +198,7 @@ function AttachmentPickerWithMenuItems({ { icon: Expensicons.Task, text: translate('newTaskPage.assignTask'), + shouldCallAfterModalHide: true, onSelected: () => clearOutTaskInfoAndNavigate(reportID, report), }, ]; diff --git a/src/pages/home/sidebar/FloatingActionButtonAndPopover.tsx b/src/pages/home/sidebar/FloatingActionButtonAndPopover.tsx index b7e70e5dd812f..3175b9d2f2328 100644 --- a/src/pages/home/sidebar/FloatingActionButtonAndPopover.tsx +++ b/src/pages/home/sidebar/FloatingActionButtonAndPopover.tsx @@ -349,7 +349,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT { icon: getIconForAction(CONST.IOU.TYPE.CREATE), text: translate('iou.createExpense'), - shouldCallAfterModalHide: shouldRedirectToExpensifyClassic, + shouldCallAfterModalHide: true, onSelected: () => interceptAnonymousUser(() => { if (shouldRedirectToExpensifyClassic) { @@ -403,6 +403,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT text: quickActionTitle, description: !hideQABSubtitle ? getReportName(quickActionReport) ?? translate('quickAction.updateDestination') : '', onSelected, + shouldCallAfterModalHide: true, shouldShowSubscriptRightAvatar: isPolicyExpenseChat(quickActionReport), }, ]; @@ -426,6 +427,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT icon: Expensicons.ReceiptScan, text: translate('quickAction.scanReceipt'), description: getReportName(policyChatForActivePolicy), + shouldCallAfterModalHide: true, onSelected, shouldShowSubscriptRightAvatar: true, }, @@ -483,6 +485,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT { icon: Expensicons.Document, text: translate('report.newReport.createReport'), + shouldCallAfterModalHide: true, onSelected: () => { interceptAnonymousUser(() => { if (groupPoliciesWithChatEnabled.length === 0) { @@ -513,6 +516,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT { icon: Expensicons.ChatBubble, text: translate('sidebarScreen.fabNewChat'), + shouldCallAfterModalHide: true, onSelected: () => interceptAnonymousUser(startNewChat), }, ...(canSendInvoice @@ -520,7 +524,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT { icon: Expensicons.InvoiceGeneric, text: translate('workspace.invoices.sendInvoice'), - shouldCallAfterModalHide: shouldRedirectToExpensifyClassic, + shouldCallAfterModalHide: true, onSelected: () => interceptAnonymousUser(() => { if (shouldRedirectToExpensifyClassic) { @@ -576,6 +580,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT iconHeight: variables.h40, text: translate('workspace.new.newWorkspace'), description: translate('workspace.new.getTheExpensifyCardAndMore'), + shouldCallAfterModalHide: true, onSelected: () => interceptAnonymousUser(() => Navigation.navigate(ROUTES.WORKSPACE_CONFIRMATION.getRoute(Navigation.getActiveRoute()))), }, ] From e049c65ae96010e57a9e75b1a9bd642ba50f9941 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Thu, 27 Mar 2025 00:22:14 +0300 Subject: [PATCH 2/3] only apply for narrow layout --- .../sidebar/FloatingActionButtonAndPopover.tsx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/pages/home/sidebar/FloatingActionButtonAndPopover.tsx b/src/pages/home/sidebar/FloatingActionButtonAndPopover.tsx index 3175b9d2f2328..1c09ecaab2a06 100644 --- a/src/pages/home/sidebar/FloatingActionButtonAndPopover.tsx +++ b/src/pages/home/sidebar/FloatingActionButtonAndPopover.tsx @@ -349,7 +349,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT { icon: getIconForAction(CONST.IOU.TYPE.CREATE), text: translate('iou.createExpense'), - shouldCallAfterModalHide: true, + shouldCallAfterModalHide: shouldRedirectToExpensifyClassic || shouldUseNarrowLayout, onSelected: () => interceptAnonymousUser(() => { if (shouldRedirectToExpensifyClassic) { @@ -365,7 +365,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT }), }, ]; - }, [translate, shouldRedirectToExpensifyClassic]); + }, [translate, shouldRedirectToExpensifyClassic, shouldUseNarrowLayout]); const quickActionMenuItems = useMemo(() => { // Define common properties in baseQuickAction @@ -403,7 +403,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT text: quickActionTitle, description: !hideQABSubtitle ? getReportName(quickActionReport) ?? translate('quickAction.updateDestination') : '', onSelected, - shouldCallAfterModalHide: true, + shouldCallAfterModalHide: shouldUseNarrowLayout, shouldShowSubscriptRightAvatar: isPolicyExpenseChat(quickActionReport), }, ]; @@ -427,7 +427,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT icon: Expensicons.ReceiptScan, text: translate('quickAction.scanReceipt'), description: getReportName(policyChatForActivePolicy), - shouldCallAfterModalHide: true, + shouldCallAfterModalHide: shouldUseNarrowLayout, onSelected, shouldShowSubscriptRightAvatar: true, }, @@ -448,6 +448,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT hideQABSubtitle, isValidReport, selectOption, + shouldUseNarrowLayout, ]); const viewTourTaskReportID = introSelected?.viewTour; @@ -485,7 +486,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT { icon: Expensicons.Document, text: translate('report.newReport.createReport'), - shouldCallAfterModalHide: true, + shouldCallAfterModalHide: shouldUseNarrowLayout, onSelected: () => { interceptAnonymousUser(() => { if (groupPoliciesWithChatEnabled.length === 0) { @@ -516,7 +517,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT { icon: Expensicons.ChatBubble, text: translate('sidebarScreen.fabNewChat'), - shouldCallAfterModalHide: true, + shouldCallAfterModalHide: shouldUseNarrowLayout, onSelected: () => interceptAnonymousUser(startNewChat), }, ...(canSendInvoice @@ -524,7 +525,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT { icon: Expensicons.InvoiceGeneric, text: translate('workspace.invoices.sendInvoice'), - shouldCallAfterModalHide: true, + shouldCallAfterModalHide: shouldRedirectToExpensifyClassic || shouldUseNarrowLayout, onSelected: () => interceptAnonymousUser(() => { if (shouldRedirectToExpensifyClassic) { @@ -580,7 +581,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT iconHeight: variables.h40, text: translate('workspace.new.newWorkspace'), description: translate('workspace.new.getTheExpensifyCardAndMore'), - shouldCallAfterModalHide: true, + shouldCallAfterModalHide: shouldUseNarrowLayout, onSelected: () => interceptAnonymousUser(() => Navigation.navigate(ROUTES.WORKSPACE_CONFIRMATION.getRoute(Navigation.getActiveRoute()))), }, ] From 232dd965e17c0d32dcd77578ff5f87c7fd9d8ad0 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Fri, 28 Mar 2025 19:17:43 +0300 Subject: [PATCH 3/3] updated attachment picker --- .../AttachmentPickerWithMenuItems.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.tsx b/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.tsx index 1ed9e470718f4..b1c42a29216c5 100644 --- a/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.tsx +++ b/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.tsx @@ -142,19 +142,19 @@ function AttachmentPickerWithMenuItems({ [CONST.IOU.TYPE.SPLIT]: { icon: Expensicons.Transfer, text: translate('iou.splitExpense'), - shouldCallAfterModalHide: true, + shouldCallAfterModalHide: shouldUseNarrowLayout, onSelected: () => selectOption(() => startMoneyRequest(CONST.IOU.TYPE.SPLIT, report?.reportID ?? String(CONST.DEFAULT_NUMBER_ID)), true), }, [CONST.IOU.TYPE.SUBMIT]: { icon: getIconForAction(CONST.IOU.TYPE.CREATE), text: translate('iou.createExpense'), - shouldCallAfterModalHide: true, + shouldCallAfterModalHide: shouldUseNarrowLayout, onSelected: () => selectOption(() => startMoneyRequest(CONST.IOU.TYPE.SUBMIT, report?.reportID ?? String(CONST.DEFAULT_NUMBER_ID)), true), }, [CONST.IOU.TYPE.PAY]: { icon: getIconForAction(CONST.IOU.TYPE.SEND), text: translate('iou.paySomeone', {name: getPayeeName(report)}), - shouldCallAfterModalHide: true, + shouldCallAfterModalHide: shouldUseNarrowLayout, onSelected: () => { if (isDelegateAccessRestricted) { close(() => { @@ -168,13 +168,13 @@ function AttachmentPickerWithMenuItems({ [CONST.IOU.TYPE.TRACK]: { icon: getIconForAction(CONST.IOU.TYPE.CREATE), text: translate('iou.createExpense'), - shouldCallAfterModalHide: true, + shouldCallAfterModalHide: shouldUseNarrowLayout, onSelected: () => selectOption(() => startMoneyRequest(CONST.IOU.TYPE.TRACK, report?.reportID ?? String(CONST.DEFAULT_NUMBER_ID)), true), }, [CONST.IOU.TYPE.INVOICE]: { icon: Expensicons.InvoiceGeneric, text: translate('workspace.invoices.sendInvoice'), - shouldCallAfterModalHide: true, + shouldCallAfterModalHide: shouldUseNarrowLayout, onSelected: () => selectOption(() => startMoneyRequest(CONST.IOU.TYPE.INVOICE, report?.reportID ?? String(CONST.DEFAULT_NUMBER_ID)), false), }, }; @@ -184,7 +184,7 @@ function AttachmentPickerWithMenuItems({ })); return moneyRequestOptionsList.filter((item, index, self) => index === self.findIndex((t) => t.text === item.text)); - }, [translate, report, policy, reportParticipantIDs, isDelegateAccessRestricted]); + }, [translate, report, policy, reportParticipantIDs, isDelegateAccessRestricted, shouldUseNarrowLayout]); /** * Determines if we can show the task option @@ -198,11 +198,11 @@ function AttachmentPickerWithMenuItems({ { icon: Expensicons.Task, text: translate('newTaskPage.assignTask'), - shouldCallAfterModalHide: true, + shouldCallAfterModalHide: shouldUseNarrowLayout, onSelected: () => clearOutTaskInfoAndNavigate(reportID, report), }, ]; - }, [report, reportID, translate]); + }, [report, reportID, translate, shouldUseNarrowLayout]); const onPopoverMenuClose = () => { setMenuVisibility(false);