add: order paths & mds

This commit is contained in:
h z
2024-12-29 18:52:39 +00:00
parent 34ab63d0bf
commit 75d083f11f
6 changed files with 116 additions and 17 deletions

View File

@@ -9,6 +9,9 @@ const SideNavigation = () => {
const deletePath = useDeletePath();
const updatePath = useUpdatePath();
const sortedPaths = paths
? paths.slice().sort((a, b) => a.order.localeCompare(b.order))
: [];
const handleDelete = (id) => {
if (window.confirm("Are you sure you want to delete this path?")){
deletePath.mutate(id, {
@@ -47,7 +50,7 @@ const SideNavigation = () => {
</PermissionGuard>
<ul className="menu-list">
{isLoading && <p>Loading...</p>}
{paths.map((path) => (
{sortedPaths.map((path) => (
<PathNode
key={path.id}
path={path}