Commit 5f116919 authored by arturo's avatar arturo

>>> continue

parent 70a6e248
Pipeline #2682 canceled with stage
...@@ -165,16 +165,12 @@ sideTabDataCpt = here.component "sideTabData" cpt ...@@ -165,16 +165,12 @@ sideTabDataCpt = here.component "sideTabData" cpt
{ nodesMap: SigmaxT.nodesGraphMap props.graph { nodesMap: SigmaxT.nodesGraphMap props.graph
} `Record.merge` props } `Record.merge` props
, ,
-- (separator) sideBarTabSeparator
H.div
{ className: "graph-sidebar__separator" }
[
B.icon
{ name: "angle-down" }
]
, ,
neighborhood neighborhood
props props
,
sideBarTabSeparator
, ,
query query
{ frontends: props.frontends { frontends: props.frontends
...@@ -229,9 +225,13 @@ sideTabCommunityCpt = here.component "sideTabCommunity" cpt ...@@ -229,9 +225,13 @@ sideTabCommunityCpt = here.component "sideTabCommunity" cpt
selectedNodes $ selectedNodes $
{ nodesMap: SigmaxT.nodesGraphMap props.graph { nodesMap: SigmaxT.nodesGraphMap props.graph
} `Record.merge` props } `Record.merge` props
,
sideBarTabSeparator
, ,
neighborhood neighborhood
props props
,
sideBarTabSeparator
, ,
query query
{ frontends { frontends
...@@ -244,6 +244,16 @@ sideTabCommunityCpt = here.component "sideTabCommunity" cpt ...@@ -244,6 +244,16 @@ sideTabCommunityCpt = here.component "sideTabCommunity" cpt
] ]
] ]
-------------------------------------------
sideBarTabSeparator :: R.Element
sideBarTabSeparator =
H.div
{ className: "graph-sidebar__separator" }
[
B.icon
{ name: "angle-down" }
]
------------------------------------------- -------------------------------------------
-- TODO -- TODO
...@@ -347,43 +357,45 @@ neighborhoodCpt = R.memo' $ here.component "neighborhood" cpt where ...@@ -347,43 +357,45 @@ neighborhoodCpt = R.memo' $ here.component "neighborhood" cpt where
, graph , graph
} _ = do } _ = do
-- States -- States
{ selectedNodeIds } <- GEST.focusedSidePanel sidePanelGraph { selectedNodeIds } <-
selectedNodeIds' <- T.useLive T.unequal selectedNodeIds GEST.focusedSidePanel sidePanelGraph
selectedNodeIds' <-
T.useLive T.unequal selectedNodeIds
showMore /\ showMoreBox <-
R2.useBox' false
showMore /\ showMoreBox <- R2.useBox' false termList /\ termListBox <-
R2.useBox' []
truncateResults /\ truncateResultsBox <- R2.useBox' false termCount /\ termCountBox <-
R2.useBox' 0
-- Computed -- Computed
let let
badges' = neighbourBadges graph selectedNodeIds'
minSize = F.foldl Math.min 0.0 (Seq.map _.size (SigmaxT.graphNodes graph)) minSize = F.foldl Math.min 0.0 (Seq.map _.size (SigmaxT.graphNodes graph))
maxSize = F.foldl Math.max 0.0 (Seq.map _.size (SigmaxT.graphNodes graph)) maxSize = F.foldl Math.max 0.0 (Seq.map _.size (SigmaxT.graphNodes graph))
orderedBadges = A.sortWith (\n -> -n.size) $ Seq.toUnfoldable badges'
maxTruncateResult = 5 maxTruncateResult = 5
termCount = Seq.length badges' withTruncateResults = (termCount > maxTruncateResult) && (not showMore)
-- truncateResults
-- = termCount > maxTruncateResult
-- && not showMore
-- Behaviors -- Behaviors
let let
onBadgeClick id _ = T.write_ (Set.singleton id) selectedNodeIds onBadgeClick id _ = T.write_ (Set.singleton id) selectedNodeIds
-- Effects -- Effects
R.useEffect1' selectedNodeIds' $ R.useEffect1' selectedNodeIds' do
let refreshed = neighbourBadges graph selectedNodeIds'
let count = Seq.length refreshed
let ordered = A.sortWith (\n -> -n.size) $ Seq.toUnfoldable refreshed
T.write_ count termCountBox
T.write_ ordered termListBox
T.write_ false showMoreBox T.write_ false showMoreBox
R.useEffect1' showMore $
flip T.write_ truncateResultsBox $
(termCount > maxTruncateResult) && (not showMore)
-- Render -- Render
pure $ pure $
...@@ -416,11 +428,11 @@ neighborhoodCpt = R.memo' $ here.component "neighborhood" cpt where ...@@ -416,11 +428,11 @@ neighborhoodCpt = R.memo' $ here.component "neighborhood" cpt where
[ [
H.ul H.ul
{} $ {} $
flip mapWithIndex orderedBadges \index node -> flip mapWithIndex termList \index node ->
R2.if' R2.if'
( (
truncateResults == false withTruncateResults == false
|| index < maxTruncateResult || index < maxTruncateResult
) $ ) $
H.li H.li
...@@ -444,7 +456,7 @@ neighborhoodCpt = R.memo' $ here.component "neighborhood" cpt where ...@@ -444,7 +456,7 @@ neighborhoodCpt = R.memo' $ here.component "neighborhood" cpt where
[ H.text node.label ] [ H.text node.label ]
] ]
, ,
R2.if' (truncateResults) $ R2.if' (withTruncateResults) $
B.button B.button
{ variant: ButtonVariant Light { variant: ButtonVariant 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