Show folders first in foldernav

This commit is contained in:
Quinten Kock 2026-05-09 06:37:50 +02:00
parent cc1565f366
commit 33f860de47
1 changed files with 4 additions and 2 deletions

View File

@ -86,7 +86,7 @@ export const FolderTreeView = () => {
u.InlineButton(refreshFolder, "Refresh current folder", "⟳"),
u.InlineButton(openFolder, "Open another folder", "📁"),
),
folderTreeState.val.children?.map(FsItemView) || [],
folderTreeState.val.children?.toSorted((a, b) => a.type.localeCompare(b.type)).map(FsItemView) || [],
);
};
@ -104,9 +104,11 @@ const FsItemView = (tree: FolderTree): HTMLElement => {
tree.name,
);
const isOpen = van.state(false);
const sorted = tree.children?.toSorted((a, b) =>
a.type.localeCompare(b.type));
const children = () =>
isOpen.val
? v.ul({ class: "pl-4" }, tree.children?.map(FsItemView))
? v.ul({ class: "pl-4" }, sorted.map(FsItemView))
: v.div({ ariaBusy: true });
const folder = v.details(
{