aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web/components/dashboard
diff options
context:
space:
mode:
authorkamtschatka <simon.schatka@gmx.at>2024-09-15 02:56:40 +0200
committerGitHub <noreply@github.com>2024-09-15 01:56:40 +0100
commit064d5f8b4d74508d2b045389ae3393a2742b5286 (patch)
tree2f1c71b9b50ddd778d1498260cc8b50d627faecd /apps/web/components/dashboard
parent47939a5409a0eb18b088c37b011ca6a3c4920746 (diff)
downloadkarakeep-064d5f8b4d74508d2b045389ae3393a2742b5286.tar.zst
feature(web): Alphabetical sorting for lists. Fixes #315 (#351)
* [Feature Request] Alphabetical sorting for lists #315 sorting lists alphabetical * [Feature Request] Alphabetical sorting for lists #315 added sorting also for sublists
Diffstat (limited to 'apps/web/components/dashboard')
-rw-r--r--apps/web/components/dashboard/lists/CollapsibleBookmarkLists.tsx44
1 files changed, 24 insertions, 20 deletions
diff --git a/apps/web/components/dashboard/lists/CollapsibleBookmarkLists.tsx b/apps/web/components/dashboard/lists/CollapsibleBookmarkLists.tsx
index da1b7408..77a67f5f 100644
--- a/apps/web/components/dashboard/lists/CollapsibleBookmarkLists.tsx
+++ b/apps/web/components/dashboard/lists/CollapsibleBookmarkLists.tsx
@@ -53,16 +53,18 @@ function ListItem({
open,
})}
<CollapsibleContent>
- {node.children.map((l) => (
- <ListItem
- isOpenFunc={isOpenFunc}
- key={l.item.id}
- node={l}
- render={render}
- level={level + 1}
- className={className}
- />
- ))}
+ {node.children
+ .sort((a, b) => a.item.name.localeCompare(b.item.name))
+ .map((l) => (
+ <ListItem
+ isOpenFunc={isOpenFunc}
+ key={l.item.id}
+ node={l}
+ render={render}
+ level={level + 1}
+ className={className}
+ />
+ ))}
</CollapsibleContent>
</Collapsible>
);
@@ -96,16 +98,18 @@ export function CollapsibleBookmarkLists({
return (
<div>
- {Object.values(root).map((l) => (
- <ListItem
- key={l.item.id}
- node={l}
- render={render}
- level={0}
- className={className}
- isOpenFunc={isOpenFunc ?? (() => false)}
- />
- ))}
+ {Object.values(root)
+ .sort((a, b) => a.item.name.localeCompare(b.item.name))
+ .map((l) => (
+ <ListItem
+ key={l.item.id}
+ node={l}
+ render={render}
+ level={0}
+ className={className}
+ isOpenFunc={isOpenFunc ?? (() => false)}
+ />
+ ))}
</div>
);
}