From 064d5f8b4d74508d2b045389ae3393a2742b5286 Mon Sep 17 00:00:00 2001 From: kamtschatka Date: Sun, 15 Sep 2024 02:56:40 +0200 Subject: [PATCH] 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 --- .../lists/CollapsibleBookmarkLists.tsx | 44 ++++++++++--------- 1 file 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, })} - {node.children.map((l) => ( - - ))} + {node.children + .sort((a, b) => a.item.name.localeCompare(b.item.name)) + .map((l) => ( + + ))} ); @@ -96,16 +98,18 @@ export function CollapsibleBookmarkLists({ return (
- {Object.values(root).map((l) => ( - false)} - /> - ))} + {Object.values(root) + .sort((a, b) => a.item.name.localeCompare(b.item.name)) + .map((l) => ( + false)} + /> + ))}
); }