From 614a6b39d4d1dc844f98748671965079ba8e3e78 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Fri, 13 Mar 2026 08:05:56 -0500 Subject: [PATCH] consistently sort class names (#22415) keep None at the bottom --- .../overlay/ClassificationSelectionDialog.tsx | 28 ++-- .../classification/ModelTrainingView.tsx | 122 +++++++++--------- 2 files changed, 81 insertions(+), 69 deletions(-) diff --git a/web/src/components/overlay/ClassificationSelectionDialog.tsx b/web/src/components/overlay/ClassificationSelectionDialog.tsx index 6398348a4..f99011423 100644 --- a/web/src/components/overlay/ClassificationSelectionDialog.tsx +++ b/web/src/components/overlay/ClassificationSelectionDialog.tsx @@ -125,17 +125,23 @@ export default function ClassificationSelectionDialog({ isMobile && "gap-2 pb-4", )} > - {classes.sort().map((category) => ( - onCategorizeImage(category)} - > - {category === "none" - ? t("details.none") - : category.replaceAll("_", " ")} - - ))} + {classes + .sort((a, b) => { + if (a === "none") return 1; + if (b === "none") return -1; + return a.localeCompare(b); + }) + .map((category) => ( + onCategorizeImage(category)} + > + {category === "none" + ? t("details.none") + : category.replaceAll("_", " ")} + + ))} )} - {Object.keys(dataset).map((id) => ( - -
setPageToggle(id)} + {Object.keys(dataset) + .sort((a, b) => { + if (a === "none") return 1; + if (b === "none") return -1; + return a.localeCompare(b); + }) + .map((id) => ( + - {id === "none" ? t("details.none") : id.replaceAll("_", " ")} - - ({dataset?.[id].length}) - -
- {id != "none" && ( -
- - - - - - - {t("button.renameCategory")} - - - - - - - - - - {t("button.deleteCategory")} - - - +
setPageToggle(id)} + > + {id === "none" ? t("details.none") : id.replaceAll("_", " ")} + + ({dataset?.[id].length}) +
- )} - - ))} + {id != "none" && ( +
+ + + + + + + {t("button.renameCategory")} + + + + + + + + + + {t("button.deleteCategory")} + + + +
+ )} + + ))}