From b6024b602ccc5931d9385d40b2e920b429adb0a0 Mon Sep 17 00:00:00 2001 From: Patrick Ackermann Date: Tue, 16 Jul 2024 17:38:28 +0200 Subject: [PATCH] Sort catalogs in Detail page --- src/ClientApp/src/components/Detail.jsx | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/ClientApp/src/components/Detail.jsx b/src/ClientApp/src/components/Detail.jsx index 6aa070e..959845f 100644 --- a/src/ClientApp/src/components/Detail.jsx +++ b/src/ClientApp/src/components/Detail.jsx @@ -180,15 +180,20 @@ export function Detail() { {t("catalogue-files")}:{" "} {model.catalogueFiles && - model.catalogueFiles.map((f) => ( - - - - {f} - - - - ))} + model.catalogueFiles + .sort((a, b) => { + const result = (a.match(/\//g) || []).length - (b.match(/\//g) || []).length; + return result === 0 ? a.localeCompare(b, undefined, { sensitivity: "base" }) : result; + }) + .map((f) => ( + + + + {f} + + + + ))} )} {model.technicalContact && (