Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand All @@ -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),
},
};
Expand All @@ -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
Expand All @@ -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);
Expand Down
12 changes: 9 additions & 3 deletions src/pages/home/sidebar/FloatingActionButtonAndPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -365,7 +365,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT
}),
},
];
}, [translate, shouldRedirectToExpensifyClassic]);
}, [translate, shouldRedirectToExpensifyClassic, shouldUseNarrowLayout]);

const quickActionMenuItems = useMemo(() => {
// Define common properties in baseQuickAction
Expand Down Expand Up @@ -403,6 +403,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT
text: quickActionTitle,
description: !hideQABSubtitle ? getReportName(quickActionReport) ?? translate('quickAction.updateDestination') : '',
onSelected,
shouldCallAfterModalHide: shouldUseNarrowLayout,
shouldShowSubscriptRightAvatar: isPolicyExpenseChat(quickActionReport),
},
];
Expand All @@ -426,6 +427,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT
icon: Expensicons.ReceiptScan,
text: translate('quickAction.scanReceipt'),
description: getReportName(policyChatForActivePolicy),
shouldCallAfterModalHide: shouldUseNarrowLayout,
onSelected,
shouldShowSubscriptRightAvatar: true,
},
Expand All @@ -446,6 +448,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT
hideQABSubtitle,
isValidReport,
selectOption,
shouldUseNarrowLayout,
]);

const viewTourTaskReportID = introSelected?.viewTour;
Expand Down Expand Up @@ -483,6 +486,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT
{
icon: Expensicons.Document,
text: translate('report.newReport.createReport'),
shouldCallAfterModalHide: shouldUseNarrowLayout,
onSelected: () => {
interceptAnonymousUser(() => {
if (shouldRedirectToExpensifyClassic) {
Expand Down Expand Up @@ -517,14 +521,15 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT
{
icon: Expensicons.ChatBubble,
text: translate('sidebarScreen.fabNewChat'),
shouldCallAfterModalHide: shouldUseNarrowLayout,
onSelected: () => interceptAnonymousUser(startNewChat),
},
...(canSendInvoice
? [
{
icon: Expensicons.InvoiceGeneric,
text: translate('workspace.invoices.sendInvoice'),
shouldCallAfterModalHide: shouldRedirectToExpensifyClassic,
shouldCallAfterModalHide: shouldRedirectToExpensifyClassic || shouldUseNarrowLayout,
onSelected: () =>
interceptAnonymousUser(() => {
if (shouldRedirectToExpensifyClassic) {
Expand Down Expand Up @@ -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()))),
},
]
Expand Down