diff --git a/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.tsx b/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.tsx index 3b2500c04cbd8..b1c42a29216c5 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: 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: 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: shouldUseNarrowLayout, 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: 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: shouldUseNarrowLayout, onSelected: () => selectOption(() => startMoneyRequest(CONST.IOU.TYPE.INVOICE, report?.reportID ?? String(CONST.DEFAULT_NUMBER_ID)), false), }, }; @@ -179,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 @@ -193,10 +198,11 @@ function AttachmentPickerWithMenuItems({ { icon: Expensicons.Task, text: translate('newTaskPage.assignTask'), + shouldCallAfterModalHide: shouldUseNarrowLayout, onSelected: () => clearOutTaskInfoAndNavigate(reportID, report), }, ]; - }, [report, reportID, translate]); + }, [report, reportID, translate, shouldUseNarrowLayout]); const onPopoverMenuClose = () => { setMenuVisibility(false); diff --git a/src/pages/home/sidebar/FloatingActionButtonAndPopover.tsx b/src/pages/home/sidebar/FloatingActionButtonAndPopover.tsx index b51b935190630..268e1882f419f 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: 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,6 +403,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT text: quickActionTitle, description: !hideQABSubtitle ? getReportName(quickActionReport) ?? translate('quickAction.updateDestination') : '', onSelected, + shouldCallAfterModalHide: shouldUseNarrowLayout, shouldShowSubscriptRightAvatar: isPolicyExpenseChat(quickActionReport), }, ]; @@ -426,6 +427,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT icon: Expensicons.ReceiptScan, text: translate('quickAction.scanReceipt'), description: getReportName(policyChatForActivePolicy), + shouldCallAfterModalHide: shouldUseNarrowLayout, onSelected, shouldShowSubscriptRightAvatar: true, }, @@ -446,6 +448,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT hideQABSubtitle, isValidReport, selectOption, + shouldUseNarrowLayout, ]); const viewTourTaskReportID = introSelected?.viewTour; @@ -483,6 +486,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT { icon: Expensicons.Document, text: translate('report.newReport.createReport'), + shouldCallAfterModalHide: shouldUseNarrowLayout, onSelected: () => { interceptAnonymousUser(() => { if (shouldRedirectToExpensifyClassic) { @@ -517,6 +521,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT { icon: Expensicons.ChatBubble, text: translate('sidebarScreen.fabNewChat'), + shouldCallAfterModalHide: shouldUseNarrowLayout, onSelected: () => interceptAnonymousUser(startNewChat), }, ...(canSendInvoice @@ -524,7 +529,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT { icon: Expensicons.InvoiceGeneric, text: translate('workspace.invoices.sendInvoice'), - shouldCallAfterModalHide: shouldRedirectToExpensifyClassic, + shouldCallAfterModalHide: shouldRedirectToExpensifyClassic || shouldUseNarrowLayout, onSelected: () => interceptAnonymousUser(() => { if (shouldRedirectToExpensifyClassic) { @@ -580,6 +585,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT iconHeight: variables.h40, text: translate('workspace.new.newWorkspace'), description: translate('workspace.new.getTheExpensifyCardAndMore'), + shouldCallAfterModalHide: shouldUseNarrowLayout, onSelected: () => interceptAnonymousUser(() => Navigation.navigate(ROUTES.WORKSPACE_CONFIRMATION.getRoute(Navigation.getActiveRoute()))), }, ]