Commit e558ac4c authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[tree] sort children properly (by id)

parent 5530fae5
...@@ -337,7 +337,7 @@ toHtmlFirstLevel = R.createElement elCpt ...@@ -337,7 +337,7 @@ toHtmlFirstLevel = R.createElement elCpt
, id: cId , id: cId
} }
) [] ) []
) publicizedChildren ) $ sorted publicizedChildren
) )
-- childNodesFirstLevel ( Record.merge commonProps -- childNodesFirstLevel ( Record.merge commonProps
-- { asyncTasks -- { asyncTasks
...@@ -351,6 +351,9 @@ toHtmlFirstLevel = R.createElement elCpt ...@@ -351,6 +351,9 @@ toHtmlFirstLevel = R.createElement elCpt
-- } -- }
-- ) -- )
sorted :: Array FTree -> Array FTree
sorted = A.sortWith (\(NTree (LNode {id}) _) -> id)
type ChildNodesProps = type ChildNodesProps =
( asyncTasks :: GAT.Reductor ( asyncTasks :: GAT.Reductor
...@@ -420,7 +423,9 @@ childNodeFirstLevelPaint = R.createElement elCpt ...@@ -420,7 +423,9 @@ childNodeFirstLevelPaint = R.createElement elCpt
elCpt :: R.Component ChildNodeFirstLevelPaintProps elCpt :: R.Component ChildNodeFirstLevelPaintProps
elCpt = R.hooksComponentWithModule thisModule "childNodeFirstLevelPaint" cpt elCpt = R.hooksComponentWithModule thisModule "childNodeFirstLevelPaint" cpt
cpt props@{ asyncTasks, handed, folderOpen: (false /\ _), reload, tree: ctree@(NTree (LNode { id }) _) } _ = do -- TODO folderOpen is unused
cpt props@{ asyncTasks, handed, reload, tree: ctree@(NTree (LNode { id }) _) } _ = do
pure $ H.ul {} [ pure $ H.ul {} [
toHtmlFirstLevel (Record.merge commonProps { asyncTasks toHtmlFirstLevel (Record.merge commonProps { asyncTasks
, handed , handed
...@@ -430,16 +435,6 @@ childNodeFirstLevelPaint = R.createElement elCpt ...@@ -430,16 +435,6 @@ childNodeFirstLevelPaint = R.createElement elCpt
-- pure $ H.div { } [ H.text $ "[closed] Node id " <> show id ] -- pure $ H.div { } [ H.text $ "[closed] Node id " <> show id ]
where where
commonProps = RecordE.pick props :: Record CommonProps commonProps = RecordE.pick props :: Record CommonProps
cpt props@{ asyncTasks, handed, folderOpen: (true /\ _), reload, tree: ctree@(NTree (LNode { id }) _) } _ = do
pure $ H.ul {} [
toHtmlFirstLevel (Record.merge commonProps { asyncTasks
, handed
, tree: ctree }
) []
]
-- pure $ H.div { } [ H.text $ "[opened] Node id " <> show id ]
where
commonProps = RecordE.pick props :: Record CommonProps
type PerformActionProps = type PerformActionProps =
......
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