mirror of
https://github.com/bunny-lab-io/Borealis.git
synced 2025-10-26 21:21:57 -06:00
Keep folders at top when sorting assemblies
This commit is contained in:
@@ -62,11 +62,14 @@ const Island = ({ title, description, icon, actions, children, sx }) => (
|
|||||||
// ---------------- Workflows Island -----------------
|
// ---------------- Workflows Island -----------------
|
||||||
const sortTree = (node) => {
|
const sortTree = (node) => {
|
||||||
if (!node || !Array.isArray(node.children)) return;
|
if (!node || !Array.isArray(node.children)) return;
|
||||||
node.children.sort((a, b) =>
|
node.children.sort((a, b) => {
|
||||||
String(a.label || "").localeCompare(String(b.label || ""), undefined, {
|
const aFolder = Boolean(a.isFolder);
|
||||||
|
const bFolder = Boolean(b.isFolder);
|
||||||
|
if (aFolder !== bFolder) return aFolder ? -1 : 1;
|
||||||
|
return String(a.label || "").localeCompare(String(b.label || ""), undefined, {
|
||||||
sensitivity: "base"
|
sensitivity: "base"
|
||||||
})
|
});
|
||||||
);
|
});
|
||||||
node.children.forEach(sortTree);
|
node.children.forEach(sortTree);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user