Commit 2ee876fb authored by Alexandre Delanoë's avatar Alexandre Delanoë

[CLEAN] Sidebar (needs more love)

parent b4764a1a
...@@ -94,15 +94,20 @@ sideTab (Opened SideTabSelection) props = ...@@ -94,15 +94,20 @@ sideTab (Opened SideTabSelection) props =
) )
) )
] ]
, RH.div { className: "tab-content" } , RH.div { className: "tab-content flex-space-between" }
[ removeButton "Remove candidate" CandidateTerm props nodesMap [ removeButton "Move as candidate" CandidateTerm props nodesMap
, removeButton "Remove stop" StopTerm props nodesMap , removeButton "Move as stop" StopTerm props nodesMap
] ]
] ]
, RH.div { className: "col-md-12", id: "query" } , RH.div { className: "col-md-12", id: "query" }
[ query props.frontends props.metaData props.session nodesMap props.selectedNodeIds] [ query props.frontends
props.metaData
props.session
nodesMap
props.selectedNodeIds
]
] ]
] ]
, RH.div { className: "tab-content", id: "myTabContent" } , RH.div { className: "tab-content", id: "myTabContent" }
...@@ -126,9 +131,10 @@ sideTab (Opened SideTabSelection) props = ...@@ -126,9 +131,10 @@ sideTab (Opened SideTabSelection) props =
if Set.isEmpty $ fst props'.selectedNodeIds then if Set.isEmpty $ fst props'.selectedNodeIds then
RH.div {} [] RH.div {} []
else else
RH.button { className: "btn btn-danger" RH.button { className: "btn btn-info"
, on: { click: onClickRemove rType props' nodesMap' }} , on: { click: onClickRemove rType props' nodesMap' }
[ RH.text text ] }
[ RH.text text ]
onClickRemove rType props' nodesMap' e = do onClickRemove rType props' nodesMap' e = do
let nodes = mapMaybe (\id -> Map.lookup id nodesMap') let nodes = mapMaybe (\id -> Map.lookup id nodesMap')
...@@ -221,17 +227,21 @@ query _ _ _ _ (selectedNodeIds /\ _) | Set.isEmpty selectedNodeIds = RH.div {} [ ...@@ -221,17 +227,21 @@ query _ _ _ _ (selectedNodeIds /\ _) | Set.isEmpty selectedNodeIds = RH.div {} [
query frontends (GET.MetaData metaData) session nodesMap (selectedNodeIds /\ _) = query frontends (GET.MetaData metaData) session nodesMap (selectedNodeIds /\ _) =
query' (head metaData.corpusId) query' (head metaData.corpusId)
where where
query' Nothing = RH.div {} [] query' Nothing = RH.div {} []
query' (Just corpusId) = query' (Just corpusId) = CGT.tabs { frontends
CGT.tabs {frontends, session, query: q <$> Set.toUnfoldable selectedNodeIds, sides: [side corpusId]} , session
q id = case Map.lookup id nodesMap of , query: toQuery <$> Set.toUnfoldable selectedNodeIds
, sides: [side corpusId]
}
toQuery id = case Map.lookup id nodesMap of
Nothing -> [] Nothing -> []
Just n -> words n.label Just n -> words n.label
side corpusId = GET.GraphSideCorpus {
corpusId side corpusId = GET.GraphSideCorpus { corpusId
, listId: metaData.list.listId , listId : metaData.list.listId
, corpusLabel: metaData.title , corpusLabel: metaData.title
} }
------------------------------------------------------------------------ ------------------------------------------------------------------------
......
...@@ -11,8 +11,8 @@ import Gargantext.Components.Tab as Tab ...@@ -11,8 +11,8 @@ import Gargantext.Components.Tab as Tab
import Gargantext.Ends (Frontends) import Gargantext.Ends (Frontends)
import Gargantext.Sessions (Session) import Gargantext.Sessions (Session)
type Props = ( type Props =
frontends :: Frontends ( frontends :: Frontends
, query :: TextQuery , query :: TextQuery
, session :: Session , session :: Session
, sides :: Array GraphSideCorpus , sides :: Array GraphSideCorpus
...@@ -35,7 +35,7 @@ tab :: Frontends -> Session -> TextQuery -> GraphSideCorpus -> Tuple String R.El ...@@ -35,7 +35,7 @@ tab :: Frontends -> Session -> TextQuery -> GraphSideCorpus -> Tuple String R.El
tab frontends session query (GraphSideCorpus {corpusId: nodeId, corpusLabel, listId}) = tab frontends session query (GraphSideCorpus {corpusId: nodeId, corpusLabel, listId}) =
Tuple corpusLabel (docView dvProps) Tuple corpusLabel (docView dvProps)
where where
dvProps = {frontends, session, nodeId, listId, query, chart, totalRecords: 0, container} dvProps = {frontends, session, nodeId, listId, query, chart, totalRecords: 0, container}
chart = mempty chart = mempty
container = T.graphContainer {title: corpusLabel} container = T.graphContainer {title: corpusLabel}
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