Skip to content

Commit

Permalink
feture(study-tree)): sort study tree folders
Browse files Browse the repository at this point in the history
  • Loading branch information
Anis SMAIL committed Jan 20, 2025
1 parent d14454a commit ec2aa9c
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/

import { memo } from "react";
import { sortBy, prop } from "ramda";
import { StudyTreeNodeProps } from "./types";
import TreeItemEnhanced from "@/components/common/TreeItemEnhanced";
import { t } from "i18next";
Expand Down Expand Up @@ -43,13 +44,15 @@ export default memo(function StudyTreeNode({
);
}

const sortedChildren = sortBy(prop("name"), studyTreeNode.children);

return (
<TreeItemEnhanced
itemId={id}
label={studyTreeNode.name}
onClick={() => onNodeClick(id, studyTreeNode)}
>
{studyTreeNode.children.map((child) => (
{sortedChildren.map((child) => (
<StudyTreeNode
key={`${id}/${child.name}`}
studyTreeNode={child}
Expand Down

0 comments on commit ec2aa9c

Please sign in to comment.