From fbc1d40dc1cdc31e0b934a9b09568af6de63801d Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 14 Mar 2024 09:09:43 -0600 Subject: [PATCH 1/2] sort tag list --- .../workspace/tags/WorkspaceTagsPage.tsx | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/src/pages/workspace/tags/WorkspaceTagsPage.tsx b/src/pages/workspace/tags/WorkspaceTagsPage.tsx index 4ea8ba669b9b..de856df3e34f 100644 --- a/src/pages/workspace/tags/WorkspaceTagsPage.tsx +++ b/src/pages/workspace/tags/WorkspaceTagsPage.tsx @@ -18,6 +18,7 @@ import useNetwork from '@hooks/useNetwork'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; +import localeCompare from '@libs/LocaleCompare'; import Navigation from '@libs/Navigation/Navigation'; import * as PolicyUtils from '@libs/PolicyUtils'; import type {WorkspacesCentralPaneNavigatorParamList} from '@navigation/types'; @@ -68,25 +69,27 @@ function WorkspaceTagsPage({policyTags, route}: WorkspaceTagsPageProps) { () => policyTagLists .map((policyTagList) => - Object.values(policyTagList.tags || []).map((value) => ({ - value: value.name, - text: value.name, - keyForList: value.name, - isSelected: !!selectedTags[value.name], - rightElement: ( - - - {value.enabled ? translate('workspace.common.enabled') : translate('workspace.common.disabled')} - - - + 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], + 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 44621799ca4f2ff50ec1a3a7c19dd2f89e3434ae Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Mon, 18 Mar 2024 17:44:09 -0600 Subject: [PATCH 2/2] fix style --- src/pages/workspace/tags/WorkspaceTagsPage.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/workspace/tags/WorkspaceTagsPage.tsx b/src/pages/workspace/tags/WorkspaceTagsPage.tsx index 1e55422db95c..42cd6d612bcb 100644 --- a/src/pages/workspace/tags/WorkspaceTagsPage.tsx +++ b/src/pages/workspace/tags/WorkspaceTagsPage.tsx @@ -98,8 +98,8 @@ function WorkspaceTagsPage({policyTags, route}: WorkspaceTagsPageProps) { ), })), - ) - .flat(), + ) + .flat(), [policyTagLists, selectedTags, styles.alignSelfCenter, styles.flexRow, styles.label, styles.p1, styles.pl2, styles.textSupporting, theme.icon, translate], );