Commit d775f14c authored by Alexandre Delanoë's avatar Alexandre Delanoë

[TREE] Sort nodes with id.

parent 855d0457
......@@ -5,7 +5,7 @@ import Prelude hiding (div)
import Control.Monad.Cont.Trans (lift)
import DOM.Simple.Console (log2)
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, jsonEmptyObject, (.:), (:=), (~>))
import Data.Array (filter)
import Data.Array (filter, sortWith)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Eq (genericEq)
import Data.Generic.Rep.Show (genericShow)
......@@ -198,11 +198,14 @@ toHtml setReload setState@({tree: (NTree (LNode {id, name, nodeType}) ary)} /\ _
pAction = performAction setReload setState
cpt props _ = do
folderOpen <- R.useState' true
let withId (NTree (LNode {id}) _) = id
pure $ H.ul {}
[ H.li {}
( [ nodeMainSpan pAction {id, name, nodeType, mCurrentRoute} folderOpen ]
<> childNodes setReload folderOpen mCurrentRoute ary
<> childNodes setReload folderOpen mCurrentRoute (sortWith withId ary)
)
]
......
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