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

[FIX] GraphExplorer: adding selected nodes to community query tab

parent 7d4da0dd
module Gargantext.Components.GraphExplorer.Sidebar
(Props, sidebar)
-- (Props, sidebar)
where
import Control.Parallel (parTraverse)
......@@ -89,7 +89,47 @@ sideTab (Opened SideTabLegend) props@{metaData} =
in Legend.legend { items: Seq.fromFoldable legend}
sideTab (Opened SideTabData) props =
RH.div {} [ R2.row [ R2.col 12
RH.div {} [ selectedNodes props (SigmaxT.nodesGraphMap props.graph)
, neighborhood props
, RH.div { className: "col-md-12", id: "query" }
[ query SearchDoc
props.frontends
props.metaData
props.session
(SigmaxT.nodesGraphMap props.graph)
props.selectedNodeIds
]
]
where
checkbox text =
RH.li {}
[ RH.span {} [ RH.text text ]
, RH.input { type: "checkbox"
, className: "checkbox"
, checked: true
, title: "Mark as completed" } ]
sideTab (Opened SideTabCommunity) props =
RH.div { className: "col-md-12", id: "query" }
[ selectedNodes props (SigmaxT.nodesGraphMap props.graph)
, neighborhood props
, query SearchContact
props.frontends
props.metaData
props.session
(SigmaxT.nodesGraphMap props.graph)
props.selectedNodeIds
]
sideTab _ _ = H.div {} []
-------------------------------------------
-- TODO
-- selectedNodes :: Record Props -> Map.Map String Nodes -> R.Element
selectedNodes props nodesMap = R2.row [ R2.col 12
[ RH.ul { id: "myTab", className: "nav nav-tabs", role: "tablist"}
[ RH.div { className: "tab-content" }
[ RH.div { className: "", role: "tabpanel" }
......@@ -106,35 +146,15 @@ sideTab (Opened SideTabData) props =
]
]
]
, RH.div { className: "tab-content", id: "myTabContent" }
neighborhood props = RH.div { className: "tab-content", id: "myTabContent" }
[ RH.div { className: "", id: "home", role: "tabpanel" }
(Seq.toUnfoldable $ Seq.map (badge props.selectedNodeIds)
$ neighbourBadges props.graph props.selectedNodeIds
)
]
, RH.div { className: "col-md-12", id: "query" }
[ query SearchDoc
props.frontends
props.metaData
props.session
nodesMap
props.selectedNodeIds
]
]
where
nodesMap = SigmaxT.nodesGraphMap props.graph
checkbox text =
RH.li {}
[ RH.span {} [ RH.text text ]
, RH.input { type: "checkbox"
, className: "checkbox"
, checked: true
, title: "Mark as completed" } ]
removeButton text rType props' nodesMap' =
removeButton text rType props' nodesMap' =
if Set.isEmpty $ fst props'.selectedNodeIds then
RH.div {} []
else
......@@ -143,7 +163,7 @@ sideTab (Opened SideTabData) props =
}
[ RH.text text ]
onClickRemove rType props' nodesMap' e = do
onClickRemove rType props' nodesMap' e = do
let nodes = mapMaybe (\id -> Map.lookup id nodesMap')
$ Set.toUnfoldable $ fst props'.selectedNodeIds
deleteNodes { graphId: props'.graphId
......@@ -156,20 +176,7 @@ sideTab (Opened SideTabData) props =
snd props'.selectedNodeIds $ const SigmaxT.emptyNodeIds
sideTab (Opened SideTabCommunity) props =
RH.div { className: "col-md-12", id: "query" }
[ query SearchContact
props.frontends
props.metaData
props.session
(SigmaxT.nodesGraphMap props.graph)
props.selectedNodeIds
]
sideTab _ _ = H.div {} []
-------------------------------------------
badge :: R.State SigmaxT.NodeIds -> Record SigmaxT.Node -> R.Element
badge (_ /\ setNodeIds) {id, label} =
RH.a { className: "badge badge-light"
......
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