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
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Christian Merten
purescript-gargantext
Commits
eacd8241
Commit
eacd8241
authored
Oct 18, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[sidebar] tag cloud for neighbour badges
Rescale the font-size according to the log of node.size (node.score).
parent
0b5b7644
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
15 deletions
+27
-15
Sidebar.purs
src/Gargantext/Components/GraphExplorer/Sidebar.purs
+27
-15
No files found.
src/Gargantext/Components/GraphExplorer/Sidebar.purs
View file @
eacd8241
...
@@ -33,6 +33,7 @@ import Gargantext.Sessions (Session)
...
@@ -33,6 +33,7 @@ import Gargantext.Sessions (Session)
import Gargantext.Types (CTabNgramType, FrontendError(..), NodeID, TabSubType(..), TabType(..), TermList(..), modeTabType)
import Gargantext.Types (CTabNgramType, FrontendError(..), NodeID, TabSubType(..), TabType(..), TermList(..), modeTabType)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Gargantext.Utils.Toestand as T2
import Math as Math
import Partial.Unsafe (unsafePartial)
import Partial.Unsafe (unsafePartial)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
...
@@ -182,6 +183,8 @@ selectedNodesCpt = here.component "selectedNodes" cpt
...
@@ -182,6 +183,8 @@ selectedNodesCpt = here.component "selectedNodes" cpt
{ selectedNodeIds } <- GEST.focusedSidePanel sidePanelGraph
{ selectedNodeIds } <- GEST.focusedSidePanel sidePanelGraph
selectedNodeIds' <- T.useLive T.unequal selectedNodeIds
selectedNodeIds' <- T.useLive T.unequal selectedNodeIds
let badges' = neighbourBadges graph selectedNodeIds'
pure $ R2.row
pure $ R2.row
[ R2.col 12
[ R2.col 12
[ RH.ul { className: "nav nav-tabs d-flex justify-content-center"
[ RH.ul { className: "nav nav-tabs d-flex justify-content-center"
...
@@ -191,9 +194,7 @@ selectedNodesCpt = here.component "selectedNodes" cpt
...
@@ -191,9 +194,7 @@ selectedNodesCpt = here.component "selectedNodes" cpt
[ RH.div { className: "d-flex flex-wrap justify-content-center"
[ RH.div { className: "d-flex flex-wrap justify-content-center"
, role: "tabpanel" }
, role: "tabpanel" }
( Seq.toUnfoldable
( Seq.toUnfoldable
$ ( Seq.map (badge selectedNodeIds)
$ ( Seq.map (\node -> badge { node, selectedNodeIds }) badges')
(badges graph selectedNodeIds')
)
)
)
, H.br {}
, H.br {}
]
]
...
@@ -225,15 +226,15 @@ neighborhoodCpt = here.component "neighborhood" cpt
...
@@ -225,15 +226,15 @@ neighborhoodCpt = here.component "neighborhood" cpt
{ selectedNodeIds } <- GEST.focusedSidePanel sidePanelGraph
{ selectedNodeIds } <- GEST.focusedSidePanel sidePanelGraph
selectedNodeIds' <- T.useLive T.unequal selectedNodeIds
selectedNodeIds' <- T.useLive T.unequal selectedNodeIds
let badges' = neighbourBadges graph selectedNodeIds'
pure $ RH.div { className: "tab-content", id: "myTabContent" }
pure $ RH.div { className: "tab-content", id: "myTabContent" }
[ RH.div { -- className: "flex-space-around d-flex justify-content-center"
[ RH.div { -- className: "flex-space-around d-flex justify-content-center"
className: "d-flex flex-wrap flex-space-around"
className: "d-flex flex-wrap flex-space-around"
, id: "home"
, id: "home"
, role: "tabpanel"
, role: "tabpanel"
}
}
(Seq.toUnfoldable $ Seq.map (badge selectedNodeIds)
(Seq.toUnfoldable $ Seq.map (\node -> badge { node, selectedNodeIds }) badges')
$ neighbourBadges graph selectedNodeIds'
)
]
]
...
@@ -284,12 +285,23 @@ updateTermButtonCpt = here.component "updateTermButton" cpt
...
@@ -284,12 +285,23 @@ updateTermButtonCpt = here.component "updateTermButton" cpt
T.write_ SigmaxT.emptyNodeIds selectedNodeIds
T.write_ SigmaxT.emptyNodeIds selectedNodeIds
type BadgeProps =
( node :: Record SigmaxT.Node
, selectedNodeIds :: T.Box SigmaxT.NodeIds )
badge :: R2.Leaf BadgeProps
badge props = R.createElement badgeCpt props []
badgeCpt :: R.Component BadgeProps
badgeCpt = here.component "badge" cpt where
cpt { node: { id, label, size }, selectedNodeIds } _ = do
let scale = Math.max 1.0 (Math.log size)
let style = {
fontSize: show scale <> "em"
}
badge :: T.Box SigmaxT.NodeIds -> Record SigmaxT.Node -> R.Element
pure $ RH.a { className: "badge badge-pill badge-light"
badge selectedNodeIds {id, label} =
RH.a { className: "badge badge-pill badge-light"
, on: { click: onClick }
, on: { click: onClick }
} [ RH.h6 {
} [ RH.text label ] ]
} [ RH.h6 { style
} [ RH.text label ] ]
where
where
onClick _ = do
onClick _ = do
T.write_ (Set.singleton id) selectedNodeIds
T.write_ (Set.singleton id) selectedNodeIds
...
...
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