From 1f83da540aa749d034a055aabfc88b1836492847 Mon Sep 17 00:00:00 2001 From: Krishna Gupta Date: Thu, 21 Mar 2024 08:51:44 +0530 Subject: [PATCH 1/2] fix: Tag - Deleted tag can be clicked on when deleted offline. Signed-off-by: Krishna Gupta --- .../workspace/tags/WorkspaceTagsPage.tsx | 46 ++++++++++--------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/src/pages/workspace/tags/WorkspaceTagsPage.tsx b/src/pages/workspace/tags/WorkspaceTagsPage.tsx index a355cc062f3d..e7b31bf79ade 100644 --- a/src/pages/workspace/tags/WorkspaceTagsPage.tsx +++ b/src/pages/workspace/tags/WorkspaceTagsPage.tsx @@ -85,28 +85,32 @@ function WorkspaceTagsPage({policyTags, route}: WorkspaceTagsPageProps) { .map((policyTagList) => Object.values(policyTagList.tags || []) .sort((a, b) => localeCompare(a.name, b.name)) - .map((value) => ({ - value: value.name, - text: value.name, - keyForList: value.name, - isSelected: !!selectedTags[value.name], - pendingAction: value.pendingAction, - errors: value.errors ?? undefined, - enabled: value.enabled, - rightElement: ( - - - {value.enabled ? translate('workspace.common.enabled') : translate('workspace.common.disabled')} - - - + .map((value) => { + const isDisabled = value.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || Object.values(value.pendingFields ?? {}).length > 0; + return { + value: value.name, + text: value.name, + keyForList: value.name, + isSelected: !!selectedTags[value.name], + pendingAction: value.pendingAction, + errors: value.errors ?? undefined, + enabled: value.enabled, + isDisabled, + rightElement: ( + + + {value.enabled ? translate('workspace.common.enabled') : translate('workspace.common.disabled')} + + + + - - ), - })), + ), + }; + }), ) .flat(), [policyTagLists, selectedTags, styles.alignSelfCenter, styles.flexRow, styles.label, styles.p1, styles.pl2, styles.textSupporting, theme.icon, translate], From 7f2c7ee0e1fedfb6663efd2117968c02bd5dc99e Mon Sep 17 00:00:00 2001 From: Krishna Gupta Date: Tue, 26 Mar 2024 00:17:58 +0530 Subject: [PATCH 2/2] update: disable tax & category row only when deleted offline. Signed-off-by: Krishna Gupta --- src/pages/workspace/categories/WorkspaceCategoriesPage.tsx | 2 +- src/pages/workspace/tags/WorkspaceTagsPage.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx b/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx index 46afcd624350..7f07e3f45e65 100644 --- a/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx +++ b/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx @@ -78,7 +78,7 @@ function WorkspaceCategoriesPage({policy, policyCategories, route}: WorkspaceCat Object.values(policyCategories ?? {}) .sort((a, b) => localeCompare(a.name, b.name)) .map((value) => { - const isDisabled = value.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || Object.values(value.pendingFields ?? {}).length > 0; + const isDisabled = value.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE; return { text: value.name, keyForList: value.name, diff --git a/src/pages/workspace/tags/WorkspaceTagsPage.tsx b/src/pages/workspace/tags/WorkspaceTagsPage.tsx index 53aa5c2be010..2f98a3ee4322 100644 --- a/src/pages/workspace/tags/WorkspaceTagsPage.tsx +++ b/src/pages/workspace/tags/WorkspaceTagsPage.tsx @@ -86,7 +86,7 @@ function WorkspaceTagsPage({policyTags, route}: WorkspaceTagsPageProps) { Object.values(policyTagList.tags || []) .sort((a, b) => localeCompare(a.name, b.name)) .map((value) => { - const isDisabled = value.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || Object.values(value.pendingFields ?? {}).length > 0; + const isDisabled = value.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE; return { value: value.name, text: value.name,