Commit 44ab0a2d authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge branch 'dev-tree-sort' into dev

parents 336e7803 76d15cc9
...@@ -6,6 +6,7 @@ import Data.Maybe (Maybe) ...@@ -6,6 +6,7 @@ import Data.Maybe (Maybe)
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Effect.Class (liftEffect) import Effect.Class (liftEffect)
import Data.Array as Array
import Gargantext.Components.Forest.Tree.Node.Action import Gargantext.Components.Forest.Tree.Node.Action
import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadFile) import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadFile)
import Gargantext.Components.Forest.Tree.Node.Box (nodeMainSpan) import Gargantext.Components.Forest.Tree.Node.Box (nodeMainSpan)
...@@ -94,8 +95,10 @@ childNodes :: Session ...@@ -94,8 +95,10 @@ childNodes :: Session
childNodes _ _ _ _ _ [] = [] childNodes _ _ _ _ _ [] = []
childNodes _ _ _ (false /\ _) _ _ = [] childNodes _ _ _ (false /\ _) _ _ = []
childNodes session frontends reload (true /\ _) mCurrentRoute ary = childNodes session frontends reload (true /\ _) mCurrentRoute ary =
map (\ctree -> childNode {tree: ctree}) ary map (\ctree -> childNode {tree: ctree}) $ sorted ary
where where
sorted :: Array FTree -> Array FTree
sorted = Array.sortWith (\(NTree (LNode {id}) _) -> id)
childNode :: Tree -> R.Element childNode :: Tree -> R.Element
childNode props = R.createElement el props [] childNode props = R.createElement el props []
el = R.hooksComponent "ChildNodeView" cpt el = R.hooksComponent "ChildNodeView" cpt
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment