Skip to content

Commit

Permalink
Merge pull request #38725 from Krishna2323/krishna2323/issue/38663
Browse files Browse the repository at this point in the history
fix: Tag - Deleted tag can be clicked on when deleted offline.
  • Loading branch information
luacmartins authored Mar 26, 2024
2 parents b25eb15 + 7f2c7ee commit d8361ee
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/pages/workspace/categories/WorkspaceCategoriesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
46 changes: 25 additions & 21 deletions src/pages/workspace/tags/WorkspaceTagsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: (
<View style={styles.flexRow}>
<Text style={[styles.textSupporting, styles.alignSelfCenter, styles.pl2, styles.label]}>
{value.enabled ? translate('workspace.common.enabled') : translate('workspace.common.disabled')}
</Text>
<View style={[styles.p1, styles.pl2]}>
<Icon
src={Expensicons.ArrowRight}
fill={theme.icon}
/>
.map((value) => {
const isDisabled = value.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE;
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: (
<View style={styles.flexRow}>
<Text style={[styles.textSupporting, styles.alignSelfCenter, styles.pl2, styles.label]}>
{value.enabled ? translate('workspace.common.enabled') : translate('workspace.common.disabled')}
</Text>
<View style={[styles.p1, styles.pl2]}>
<Icon
src={Expensicons.ArrowRight}
fill={theme.icon}
/>
</View>
</View>
</View>
),
})),
),
};
}),
)
.flat(),
[policyTagLists, selectedTags, styles.alignSelfCenter, styles.flexRow, styles.label, styles.p1, styles.pl2, styles.textSupporting, theme.icon, translate],
Expand Down

0 comments on commit d8361ee

Please sign in to comment.