Commit 44a83609 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[graph] some small refactorings

parent 9d8ff06d
......@@ -70,7 +70,6 @@ to generate this file without the comments in this block.
, "record"
, "record-extra"
, "routing"
, "sequences"
, "simple-json"
, "simple-json-generics"
, "simplecrypto"
......
......@@ -33,6 +33,9 @@ options =
, sustainingPhaseDuration : Nothing
}
cname :: String
cname = "b-cloak"
-- | Abstract component type easing the transition display between a content
-- | component and transitional (or cloak) component
-- |
......@@ -108,10 +111,6 @@ options =
-- | ```
cloak :: forall r. R2.OptLeaf Options Props r
cloak = R2.optLeaf component options
cname :: String
cname = "b-cloak"
component :: R.Component Props
component = R.hooksComponent cname cpt where
cpt props _ = do
......
......@@ -49,7 +49,6 @@ type GraphUpdateButtonProps =
graphUpdateButton :: Record GraphUpdateButtonProps -> R.Element
graphUpdateButton p = R.createElement graphUpdateButtonCpt p []
graphUpdateButtonCpt :: R.Component GraphUpdateButtonProps
graphUpdateButtonCpt = here.component "graphUpdateButton" cpt
where
......
......@@ -51,8 +51,8 @@ type Props =
layout :: R2.Leaf Props
layout = R2.leaf layoutCpt
layoutCpt :: R.Memo Props
layoutCpt = R.memo' $ here.component "explorerWriteGraph" cpt where
layoutCpt :: R.Component Props
layoutCpt = here.component "layout" cpt where
cpt { fa2Ref
, sigmaRef
} _ = do
......
......@@ -64,7 +64,6 @@ drawGraphCpt = R.memo' $ here.component "graph" cpt where
, edgeConfluence
, edgeWeight
, forceAtlasState
, graph
, graphStage
, hyperdataGraph
, mouseSelectorSize
......@@ -78,7 +77,6 @@ drawGraphCpt = R.memo' $ here.component "graph" cpt where
edgeWeight' <- R2.useLive' edgeWeight
forceAtlasState' <- R2.useLive' forceAtlasState
graphStage' <- R2.useLive' graphStage
graph' <- R2.useLive' graph
startForceAtlas' <- R2.useLive' startForceAtlas
hyperdataGraph' <- R2.useLive' hyperdataGraph
......
......@@ -160,7 +160,6 @@ sideTabLegendCpt = here.component "sideTabLegend" cpt where
sideTabData :: R2.Leaf Props
sideTabData = R2.leaf sideTabDataCpt
sideTabDataCpt :: R.Component Props
sideTabDataCpt = here.component "sideTabData" cpt where
cpt props _ = do
......
......@@ -31,7 +31,6 @@ type Props =
legend :: R2.Leaf Props
legend = R2.leaf legendCpt
legendCpt :: R.Component Props
legendCpt = here.component "legend" cpt where
cpt { legendSeq
......
......@@ -54,9 +54,7 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
, edgeWeight
, forceAtlasState
, graph
, graphId
, graphStage
, hyperdataGraph
, labelRenderedSizeThreshold
, labelSize
, mouseSelectorSize
......@@ -71,9 +69,7 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
forceAtlasState' <- R2.useLive' forceAtlasState
graph' <- R2.useLive' graph
graphId' <- R2.useLive' graphId
graphStage' <- R2.useLive' graphStage
hyperdataGraph' <- R2.useLive' hyperdataGraph
selectedNodeIds' <- R2.useLive' selectedNodeIds
showSidebar' <- R2.useLive' showSidebar
......@@ -89,7 +85,7 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
-- When graph is changed, cleanup the mFAPauseRef so that forceAtlas
-- timeout is retriggered.
R.useEffect' $ do
R.useEffect1' graphStage' $ do
case graphStage' of
GET.Init -> R.setRef mFAPauseRef Nothing
_ -> pure unit
......
......@@ -114,7 +114,6 @@ renderNodeCpt = here.component "renderNode" cpt where
GET.HyperdataGraph { graph: hyperdataGraph } = loaded
Tuple mMetaData graph = convert hyperdataGraph
in
-- H.div {} [ H.text "hello" ]
hydrateStore
{ cacheParams: cache'
, graph
......@@ -185,6 +184,7 @@ hydrateStoreCpt = here.component "hydrateStore" cpt where
-- |
pure $
GraphStore.provide
state
[
......
......@@ -44,12 +44,9 @@ newGraph = runEffectFn1 _newGraph
graphFromSigmaxGraph :: Types.Graph Types.Node Types.Edge -> Effect Graph
graphFromSigmaxGraph (Types.Graph g) = do
graph <- newGraph unit
_ <- traverse (addNode graph) nodes
_ <- traverse (addEdge graph) edges
_ <- traverse (addNode graph) g.nodes
_ <- traverse (addEdge graph) g.edges
pure graph
where
nodes = A.fromFoldable g.nodes
edges = A.fromFoldable g.edges
addNode :: Graph -> Record Types.Node -> Effect String
addNode g node@{ id } = runEffectFn3 _addNode g id node
......
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