Skip to content

Commit

Permalink
review comment changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ishpaul777 committed Nov 11, 2024
1 parent 1aae872 commit 539de6e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ const translations = {
listOfChats: 'List of chats',
saveTheWorld: 'Save the world',
tooltip: 'Get started here!',
redirectToOldDotModal: {
redirectToExpensifyClassicModal: {
title: 'Coming soon',
description: "We're fine-tuning a few more bits and pieces of New Expensify to accommodate your specific setup. In the meantime, head over to Expensify Classic.",
},
Expand Down
2 changes: 1 addition & 1 deletion src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ const translations = {
listOfChats: 'lista de chats',
saveTheWorld: 'Salvar el mundo',
tooltip: '¡Comienza aquí!',
redirectToOldDotModal: {
redirectToExpensifyClassicModal: {
title: 'Próximamente',
description: 'Estamos ajustando algunos detalles de New Expensify para adaptarla a tu configuración específica. Mientras tanto, dirígete a Expensify Classic.',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,12 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu}: Fl
const [hasSeenTour = false] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {
selector: hasSeenTourSelector,
});

const shouldRedirectToOD = useMemo(() => {
/**
* There are scenarios where users who have not yet had their group workspace-chats in NewDot (isPolicyExpenseChatEnabled). In those scenarios, things can get confusing if they try to submit/track expenses. To address this, we block them from Creating, Tracking, Submitting expenses from NewDot if they are:
* 1. on at least one group policy
* 2. none of the group policies they are a member of have isPolicyExpenseChatEnabled=true
*/
const shouldRedirectToExpensifyClassic = useMemo(() => {
const groupPolicies = Object.values(allPolicies ?? {}).filter((policy) => ReportUtils.isGroupPolicy(policy?.type ?? ''));
if (groupPolicies.length === 0) {
return false;
Expand Down Expand Up @@ -368,10 +372,10 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu}: Fl
{
icon: getIconForAction(CONST.IOU.TYPE.CREATE),
text: translate('iou.createExpense'),
shouldCallAfterModalHide: shouldRedirectToOD,
shouldCallAfterModalHide: shouldRedirectToExpensifyClassic,
onSelected: () =>
interceptAnonymousUser(() => {
if (shouldRedirectToOD) {
if (shouldRedirectToExpensifyClassic) {
setModalVisible(true);
return;
}
Expand All @@ -392,9 +396,9 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu}: Fl
{
icon: getIconForAction(CONST.IOU.TYPE.TRACK),
text: translate('iou.trackExpense'),
shouldCallAfterModalHide: shouldRedirectToOD,
shouldCallAfterModalHide: shouldRedirectToExpensifyClassic,
onSelected: () => {
if (shouldRedirectToOD) {
if (shouldRedirectToExpensifyClassic) {
setModalVisible(true);
return;
}
Expand All @@ -419,10 +423,10 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu}: Fl
{
icon: getIconForAction(CONST.IOU.TYPE.REQUEST),
text: translate('iou.submitExpense'),
shouldCallAfterModalHide: shouldRedirectToOD,
shouldCallAfterModalHide: shouldRedirectToExpensifyClassic,
onSelected: () =>
interceptAnonymousUser(() => {
if (shouldRedirectToOD) {
if (shouldRedirectToExpensifyClassic) {
setModalVisible(true);
return;
}
Expand All @@ -436,7 +440,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu}: Fl
}),
},
];
}, [canUseCombinedTrackSubmit, translate, selfDMReportID, hasSeenTrackTraining, isOffline, shouldRedirectToOD]);
}, [canUseCombinedTrackSubmit, translate, selfDMReportID, hasSeenTrackTraining, isOffline, shouldRedirectToExpensifyClassic]);

const quickActionMenuItems = useMemo(() => {
// Define common properties in baseQuickAction
Expand Down Expand Up @@ -529,10 +533,10 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu}: Fl
{
icon: Expensicons.InvoiceGeneric,
text: translate('workspace.invoices.sendInvoice'),
shouldCallAfterModalHide: shouldRedirectToOD,
shouldCallAfterModalHide: shouldRedirectToExpensifyClassic,
onSelected: () =>
interceptAnonymousUser(() => {
if (shouldRedirectToOD) {
if (shouldRedirectToExpensifyClassic) {
setModalVisible(true);
return;
}
Expand Down Expand Up @@ -591,14 +595,14 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu}: Fl
anchorRef={fabRef}
/>
<ConfirmModal
prompt={translate('sidebarScreen.redirectToOldDotModal.description')}
prompt={translate('sidebarScreen.redirectToExpensifyClassicModal.description')}
isVisible={modalVisible}
onConfirm={() => {
setModalVisible(false);
Link.openOldDotLink(CONST.OLDDOT_URLS.INBOX);
}}
onCancel={() => setModalVisible(false)}
title={translate('sidebarScreen.redirectToOldDotModal.title')}
title={translate('sidebarScreen.redirectToExpensifyClassicModal.title')}
confirmText={translate('exitSurvey.goToExpensifyClassic')}
cancelText={translate('common.cancel')}
/>
Expand Down

0 comments on commit 539de6e

Please sign in to comment.