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