Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
purescript-gargantext
Commits
5f116919
Commit
5f116919
authored
Apr 08, 2022
by
arturo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
>>> continue
parent
70a6e248
Pipeline
#2682
canceled with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
27 deletions
+39
-27
Sidebar.purs
src/Gargantext/Components/GraphExplorer/Sidebar.purs
+39
-27
No files found.
src/Gargantext/Components/GraphExplorer/Sidebar.purs
View file @
5f116919
...
@@ -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'
(
(
t
runcateResults == false
withT
runcateResults == 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' (
t
runcateResults) $
R2.if' (
withT
runcateResults) $
B.button
B.button
{ variant: ButtonVariant Light
{ variant: ButtonVariant Light
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment