From 924c85d3dcc3025b8e09ba52a15a02f48707ea5e Mon Sep 17 00:00:00 2001 From: Sodbileg Gansukh Date: Thu, 15 Feb 2024 17:49:29 +0700 Subject: [PATCH] Sort themes based on package name (#19696) ref DES-72 - current sorting makes it difficult to find themes when theme directory and package name are different, because the sorting is based on the directory name - this new sorting is based on package name first - as package name is optional, it then sorts based on directory name if it doesn't exist --- .../settings/site/theme/AdvancedThemeSettings.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/admin-x-settings/src/components/settings/site/theme/AdvancedThemeSettings.tsx b/apps/admin-x-settings/src/components/settings/site/theme/AdvancedThemeSettings.tsx index 535620233f..642e5a9326 100644 --- a/apps/admin-x-settings/src/components/settings/site/theme/AdvancedThemeSettings.tsx +++ b/apps/admin-x-settings/src/components/settings/site/theme/AdvancedThemeSettings.tsx @@ -151,7 +151,11 @@ const ThemeList:React.FC = ({ return 1; // b comes before a } else { // Both have the same active status, sort alphabetically - return a.name.localeCompare(b.name); + if (a.package?.name && b.package?.name) { + return a.package.name.localeCompare(b.package.name); + } else { + return a.name.localeCompare(b.name); + } } });