From 546e8ab4c66eafae0ca7309e4584a02e583e9449 Mon Sep 17 00:00:00 2001 From: Rutika Pawar <183392827+twilight2294@users.noreply.github.com> Date: Sat, 30 Nov 2024 09:42:06 +0000 Subject: [PATCH 1/8] add blocking modal for support agents Signed-off-by: GitHub --- .../SupportalActionNotAllowedModal.tsx | 26 +++++++++++++++++++ src/languages/en.ts | 4 +++ src/languages/es.ts | 4 +++ src/pages/workspace/WorkspacesListPage.tsx | 15 +++++++++++ 4 files changed, 49 insertions(+) create mode 100644 src/components/SupportalActionNotAllowedModal.tsx diff --git a/src/components/SupportalActionNotAllowedModal.tsx b/src/components/SupportalActionNotAllowedModal.tsx new file mode 100644 index 000000000000..ff389874656f --- /dev/null +++ b/src/components/SupportalActionNotAllowedModal.tsx @@ -0,0 +1,26 @@ +import React from 'react'; +import useLocalize from '@hooks/useLocalize'; +import ConfirmModal from './ConfirmModal'; + +type SuppportalActionNotAllowedModalProps = { + isSupportalActionRestrictedModalOpen: boolean; + hideSupportalModal: () => void; +}; + +function SuppportalActionNotAllowedModal({isSupportalActionRestrictedModalOpen, hideSupportalModal}: SuppportalActionNotAllowedModalProps) { + const {translate} = useLocalize(); + return ( + + ); +} + +SuppportalActionNotAllowedModal.displayName = 'SuppportalActionNotAllowedModal'; + +export default SuppportalActionNotAllowedModal; diff --git a/src/languages/en.ts b/src/languages/en.ts index fa78b563c522..2323aef0d0f7 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -473,6 +473,10 @@ const translations = { days: 'days', rename: 'Rename', }, + supportalNoAccess: { + title: 'Not so fast', + description: 'You are not authorized to take this action when support logged in.', + }, location: { useCurrent: 'Use current location', notFound: 'We were unable to find your location. Please try again or enter an address manually.', diff --git a/src/languages/es.ts b/src/languages/es.ts index 0c682569263f..79b6f31aa337 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -463,6 +463,10 @@ const translations = { links: 'Enlaces', days: 'días', }, + supportalNoAccess: { + title: 'No tan rápido', + description: 'No estás autorizado para realizar esta acción mientras el soporte está conectado.', + }, connectionComplete: { title: 'Conexión completa', supportingText: 'Ya puedes cerrar esta página y volver a la App de Expensify.', diff --git a/src/pages/workspace/WorkspacesListPage.tsx b/src/pages/workspace/WorkspacesListPage.tsx index db21700a0c47..7495e938828f 100755 --- a/src/pages/workspace/WorkspacesListPage.tsx +++ b/src/pages/workspace/WorkspacesListPage.tsx @@ -17,6 +17,7 @@ import type {PopoverMenuItem} from '@components/PopoverMenu'; import {PressableWithoutFeedback} from '@components/Pressable'; import ScreenWrapper from '@components/ScreenWrapper'; import ScrollView from '@components/ScrollView'; +import SuppportalActionNotAllowedModal from '@components/SupportalActionNotAllowedModal'; import Text from '@components/Text'; import useActiveWorkspace from '@hooks/useActiveWorkspace'; import useLocalize from '@hooks/useLocalize'; @@ -126,6 +127,12 @@ function WorkspacesListPage() { const [cardsList] = useOnyx(`${ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST}${workspaceAccountID}_${CONST.EXPENSIFY_CARD.BANK}`); const hasCardFeedOrExpensifyCard = !isEmptyObject(cardFeeds) || !isEmptyObject(cardsList); + const isSupportalAction = Session.isSupportAuthToken(); + + const [isSupportalActionRestrictedModalOpen, setIsSupportalActionRestrictedModalOpen] = useState(false); + const hideSupportalModal = () => { + setIsSupportalActionRestrictedModalOpen(false); + }; const confirmDeleteAndHideModal = () => { if (!policyIDToDelete || !policyNameToDelete) { return; @@ -158,6 +165,10 @@ function WorkspacesListPage() { icon: Expensicons.Trashcan, text: translate('workspace.common.delete'), onSelected: () => { + if (isSupportalAction) { + setIsSupportalActionRestrictedModalOpen(true); + return; + } setPolicyIDToDelete(item.policyID ?? '-1'); setPolicyNameToDelete(item.title); setIsDeleteModalOpen(true); @@ -439,6 +450,10 @@ function WorkspacesListPage() { cancelText={translate('common.cancel')} danger /> + ); } From 09879590941d6d0e81bcf8db6f4f37c6618e1784 Mon Sep 17 00:00:00 2001 From: Rutika Pawar <183392827+twilight2294@users.noreply.github.com> Date: Sat, 30 Nov 2024 09:53:20 +0000 Subject: [PATCH 2/8] Fix prettier and rename component Signed-off-by: GitHub --- ...ActionNotAllowedModal.tsx => SupportalActionModal.tsx} | 8 ++++---- src/pages/workspace/WorkspacesListPage.tsx | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) rename src/components/{SupportalActionNotAllowedModal.tsx => SupportalActionModal.tsx} (66%) diff --git a/src/components/SupportalActionNotAllowedModal.tsx b/src/components/SupportalActionModal.tsx similarity index 66% rename from src/components/SupportalActionNotAllowedModal.tsx rename to src/components/SupportalActionModal.tsx index ff389874656f..16e5ba57ac34 100644 --- a/src/components/SupportalActionNotAllowedModal.tsx +++ b/src/components/SupportalActionModal.tsx @@ -2,12 +2,12 @@ import React from 'react'; import useLocalize from '@hooks/useLocalize'; import ConfirmModal from './ConfirmModal'; -type SuppportalActionNotAllowedModalProps = { +type SupportalActionModalProps = { isSupportalActionRestrictedModalOpen: boolean; hideSupportalModal: () => void; }; -function SuppportalActionNotAllowedModal({isSupportalActionRestrictedModalOpen, hideSupportalModal}: SuppportalActionNotAllowedModalProps) { +function SupportalActionModal({isSupportalActionRestrictedModalOpen, hideSupportalModal}: SupportalActionModalProps) { const {translate} = useLocalize(); return ( - + /> ); } From cd8f777514e3c9a618ec4525b45d223fe7fea692 Mon Sep 17 00:00:00 2001 From: Rutika Pawar <183392827+twilight2294@users.noreply.github.com> Date: Sat, 30 Nov 2024 15:28:14 +0530 Subject: [PATCH 3/8] add dependency --- src/pages/workspace/WorkspacesListPage.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/pages/workspace/WorkspacesListPage.tsx b/src/pages/workspace/WorkspacesListPage.tsx index 34b902dc0d2a..c1bc0452aa36 100755 --- a/src/pages/workspace/WorkspacesListPage.tsx +++ b/src/pages/workspace/WorkspacesListPage.tsx @@ -237,7 +237,18 @@ function WorkspacesListPage() { ); }, - [isLessThanMediumScreen, styles.mb2, styles.mh5, styles.ph5, styles.hoveredComponentBG, translate, styles.offlineFeedback.deleted, session?.accountID, session?.email], + [ + isLessThanMediumScreen, + styles.mb2, + styles.mh5, + styles.ph5, + styles.hoveredComponentBG, + translate, + styles.offlineFeedback.deleted, + session?.accountID, + session?.email, + isSupportalAction, + ], ); const listHeaderComponent = useCallback(() => { From 88337ae2c0dd3176c77d49fb8a7baf1b35ce62ed Mon Sep 17 00:00:00 2001 From: Rutika Pawar <183392827+twilight2294@users.noreply.github.com> Date: Tue, 3 Dec 2024 18:44:48 +0530 Subject: [PATCH 4/8] Update src/languages/es.ts Co-authored-by: Gandalf --- src/languages/es.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/es.ts b/src/languages/es.ts index 79b6f31aa337..11c1ca458931 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -465,7 +465,7 @@ const translations = { }, supportalNoAccess: { title: 'No tan rápido', - description: 'No estás autorizado para realizar esta acción mientras el soporte está conectado.', + description: 'No estás autorizado para realizar esta acción mientras estás conectado como soporte.', }, connectionComplete: { title: 'Conexión completa', From 013f5ab720f6d75492c868bb752aba7653fb1266 Mon Sep 17 00:00:00 2001 From: Rutika Pawar <183392827+twilight2294@users.noreply.github.com> Date: Tue, 3 Dec 2024 22:42:12 +0530 Subject: [PATCH 5/8] update modal name --- src/components/SupportalActionModal.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/SupportalActionModal.tsx b/src/components/SupportalActionModal.tsx index 16e5ba57ac34..3af249a1f116 100644 --- a/src/components/SupportalActionModal.tsx +++ b/src/components/SupportalActionModal.tsx @@ -2,17 +2,17 @@ import React from 'react'; import useLocalize from '@hooks/useLocalize'; import ConfirmModal from './ConfirmModal'; -type SupportalActionModalProps = { - isSupportalActionRestrictedModalOpen: boolean; +type SupportalActionRestrictedModalProps = { + isModalOpen: boolean; hideSupportalModal: () => void; }; -function SupportalActionModal({isSupportalActionRestrictedModalOpen, hideSupportalModal}: SupportalActionModalProps) { +function SupportalActionRestrictedModal({isModalOpen, hideSupportalModal}: SupportalActionRestrictedModalProps) { const {translate} = useLocalize(); return ( Date: Tue, 3 Dec 2024 22:42:40 +0530 Subject: [PATCH 6/8] update component name --- src/pages/workspace/WorkspacesListPage.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/workspace/WorkspacesListPage.tsx b/src/pages/workspace/WorkspacesListPage.tsx index c1bc0452aa36..f9fa2cb62250 100755 --- a/src/pages/workspace/WorkspacesListPage.tsx +++ b/src/pages/workspace/WorkspacesListPage.tsx @@ -17,7 +17,7 @@ import type {PopoverMenuItem} from '@components/PopoverMenu'; import {PressableWithoutFeedback} from '@components/Pressable'; import ScreenWrapper from '@components/ScreenWrapper'; import ScrollView from '@components/ScrollView'; -import SupportalActionModal from '@components/SupportalActionModal'; +import SupportalActionModal from '@components/SupportalActionRestrictedModal'; import Text from '@components/Text'; import useActiveWorkspace from '@hooks/useActiveWorkspace'; import useLocalize from '@hooks/useLocalize'; @@ -462,7 +462,7 @@ function WorkspacesListPage() { danger /> From 1b5ae4353d5c4536e33e6393bb585d5fa157b49d Mon Sep 17 00:00:00 2001 From: Rutika Pawar <183392827+twilight2294@users.noreply.github.com> Date: Tue, 3 Dec 2024 22:50:45 +0530 Subject: [PATCH 7/8] fix import --- src/pages/workspace/WorkspacesListPage.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/workspace/WorkspacesListPage.tsx b/src/pages/workspace/WorkspacesListPage.tsx index f9fa2cb62250..00abfef215ce 100755 --- a/src/pages/workspace/WorkspacesListPage.tsx +++ b/src/pages/workspace/WorkspacesListPage.tsx @@ -17,7 +17,7 @@ import type {PopoverMenuItem} from '@components/PopoverMenu'; import {PressableWithoutFeedback} from '@components/Pressable'; import ScreenWrapper from '@components/ScreenWrapper'; import ScrollView from '@components/ScrollView'; -import SupportalActionModal from '@components/SupportalActionRestrictedModal'; +import SupportalActionRestrictedModal from '@components/SupportalActionRestrictedModal'; import Text from '@components/Text'; import useActiveWorkspace from '@hooks/useActiveWorkspace'; import useLocalize from '@hooks/useLocalize'; @@ -461,7 +461,7 @@ function WorkspacesListPage() { cancelText={translate('common.cancel')} danger /> - From c2ec2f60729e96681e9e5f1bac3b11a5b0b01147 Mon Sep 17 00:00:00 2001 From: Rutika Pawar <183392827+twilight2294@users.noreply.github.com> Date: Tue, 3 Dec 2024 22:51:41 +0530 Subject: [PATCH 8/8] Rename SupportalActionModal.tsx to SupportalActionRestrictedModal.tsx --- ...upportalActionModal.tsx => SupportalActionRestrictedModal.tsx} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/components/{SupportalActionModal.tsx => SupportalActionRestrictedModal.tsx} (100%) diff --git a/src/components/SupportalActionModal.tsx b/src/components/SupportalActionRestrictedModal.tsx similarity index 100% rename from src/components/SupportalActionModal.tsx rename to src/components/SupportalActionRestrictedModal.tsx