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
Grégoire Locqueville
purescript-gargantext
Commits
ee654ac1
Commit
ee654ac1
authored
Apr 08, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[forest] rewrite forest layout so that it won't rerender
parent
f8e4fa94
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
84 additions
and
160 deletions
+84
-160
Forest.purs
src/Gargantext/Components/Forest.purs
+2
-2
Lists.purs
src/Gargantext/Components/Nodes/Lists.purs
+12
-55
Texts.purs
src/Gargantext/Components/Nodes/Texts.purs
+11
-34
Router.purs
src/Gargantext/Components/Router.purs
+59
-69
No files found.
src/Gargantext/Components/Forest.purs
View file @
ee654ac1
...
@@ -76,7 +76,7 @@ forestCpt = here.component "forest" cpt where
...
@@ -76,7 +76,7 @@ forestCpt = here.component "forest" cpt where
handed' <- T.useLive T.unequal handed
handed' <- T.useLive T.unequal handed
reloadForest' <- T.useLive T.unequal reloadForest
reloadForest' <- T.useLive T.unequal reloadForest
-- reloadRoot' <- T.useLive T.unequal reloadRoot
-- reloadRoot' <- T.useLive T.unequal reloadRoot
route' <- T.useLive T.unequal route
--
route' <- T.useLive T.unequal route
forestOpen' <- T.useLive T.unequal forestOpen
forestOpen' <- T.useLive T.unequal forestOpen
sessions' <- T.useLive T.unequal sessions
sessions' <- T.useLive T.unequal sessions
...
@@ -85,7 +85,7 @@ forestCpt = here.component "forest" cpt where
...
@@ -85,7 +85,7 @@ forestCpt = here.component "forest" cpt where
-- R.useEffect' $ do
-- R.useEffect' $ do
-- R.setRef tasks $ Just tasks'
-- R.setRef tasks $ Just tasks'
R2.useCache
R2.useCache
( frontends /\
route' /\
sessions' /\ handed' /\ forestOpen' /\ reloadForest' )
( frontends /\ sessions' /\ handed' /\ forestOpen' /\ reloadForest' )
(cp handed' sessions')
(cp handed' sessions')
where
where
common = RX.pick props :: Record Common
common = RX.pick props :: Record Common
...
...
src/Gargantext/Components/Nodes/Lists.purs
View file @
ee654ac1
...
@@ -30,65 +30,22 @@ import Toestand as T
...
@@ -30,65 +30,22 @@ import Toestand as T
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Lists"
here = R2.here "Gargantext.Components.Nodes.Lists"
type ListsWithForest =
listsWithSessionContext :: R2.Component CommonPropsSessionContext
( forestProps :: Record Forest.Props
listsWithSessionContext = R.createElement listsWithSessionContextCpt
, listsProps :: Record CommonProps
)
type ListsWithForestSessionContext =
( forestProps :: Record Forest.Props
, listsProps :: Record CommonPropsSessionContext )
listsWithForestSessionContext :: R2.Component ListsWithForestSessionContext
listsWithForestSessionContext = R.createElement listsWithForestSessionContextCpt
listsWith
ForestSessionContextCpt :: R.Component ListsWithForest
SessionContext
listsWith
SessionContextCpt :: R.Component CommonProps
SessionContext
listsWith
ForestSessionContextCpt = here.component "listsWithForest
SessionContext" cpt where
listsWith
SessionContextCpt = here.component "listsWith
SessionContext" cpt where
cpt
{ forestProps, listsProps: listsProps@{ session }
} _ = do
cpt
props@{ session
} _ = do
session' <- R.useContext session
session' <- R.useContext session
pure $ listsWithForest
{ forestProps
, listsProps: Record.merge { session: session' } $ (REX.pick listsProps :: Record CommonPropsNoSession)
} []
listsWithForest :: R2.Component ListsWithForest
listsWithForest = R.createElement listsWithForestCpt
listsWithForestCpt :: R.Component ListsWithForest
listsWithForestCpt = here.component "listsWithForest" cpt
where
cpt { forestProps
, listsProps: listsProps@{ session } } _ = do
controls <- initialControls
controls <- initialControls
pure $ Forest.forestLayoutWithTopBar forestProps
pure $ R.fragment [
[ topBar { controls } []
-- topBar { controls } []
, listsLayout (Record.merge listsProps { controls }) []
listsLayout (Record.merge { controls, session: session' } props) []
, H.div { className: "side-panel" } [ sidePanel { controls, session: session' } [] ]
-- TODO remove className "side-panel" is preview is not triggered
]
-- , H.div { className: "" }
, H.div { className: "side-panel" }
[ sidePanel { controls, session } []]
]
--------------------------------------------------------
--------------------------------------------------------
type TopBarProps = ( controls :: Record ListsLayoutControls )
topBar :: R2.Component TopBarProps
topBar = R.createElement topBarCpt
topBarCpt :: R.Component TopBarProps
topBarCpt = here.component "topBar" cpt where
cpt { controls } _ = do
-- empty for now because the button is moved to the side panel
pure $ H.div {} []
-- H.ul { className: "nav navbar-nav" } [
-- H.li {} [
-- sidePanelToggleButton { state: controls.showSidePanel } []
-- ]
-- ] -- head (goes to top bar)
type CommonPropsNoSession =
type CommonPropsNoSession =
( nodeId :: Int
( nodeId :: Int
, reloadForest :: T.Box T2.Reload
, reloadForest :: T.Box T2.Reload
...
@@ -110,9 +67,9 @@ listsLayout = R.createElement listsLayoutCpt
...
@@ -110,9 +67,9 @@ listsLayout = R.createElement listsLayoutCpt
listsLayoutCpt :: R.Component Props
listsLayoutCpt :: R.Component Props
listsLayoutCpt = here.component "listsLayout" cpt where
listsLayoutCpt = here.component "listsLayout" cpt where
cpt p
ath
@{ nodeId, session } _ = do
cpt p
rops
@{ nodeId, session } _ = do
let sid = sessionId session
let sid = sessionId session
pure $ listsLayoutWithKey $ Record.merge p
ath
{ key: show sid <> "-" <> show nodeId }
pure $ listsLayoutWithKey $ Record.merge p
rops
{ key: show sid <> "-" <> show nodeId }
type KeyProps = ( key :: String | Props )
type KeyProps = ( key :: String | Props )
...
...
src/Gargantext/Components/Nodes/Texts.purs
View file @
ee654ac1
...
@@ -42,44 +42,21 @@ here :: R2.Here
...
@@ -42,44 +42,21 @@ here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Texts"
here = R2.here "Gargantext.Components.Nodes.Texts"
--------------------------------------------------------
--------------------------------------------------------
type TextsWithForest = (
textsWithSessionContext :: R2.Component CommonPropsSessionContext
forestProps :: Record Forest.Props
textsWithSessionContext = R.createElement textsWithSessionContextCpt
, textsProps :: Record CommonProps
)
type TextsWithForestSessionContext =
( forestProps :: Record Forest.Props
, textsProps :: Record CommonPropsSessionContext )
textsWithForestSessionContext :: R2.Component TextsWithForestSessionContext
textsWithForestSessionContext = R.createElement textsWithForestSessionContextCpt
textsWith
ForestSessionContextCpt :: R.Component TextsWithForest
SessionContext
textsWith
SessionContextCpt :: R.Component CommonProps
SessionContext
textsWith
ForestSessionContextCpt = here.component "textsWithForest
SessionContext" cpt
textsWith
SessionContextCpt = here.component "textsWith
SessionContext" cpt
where
where
cpt
{ forestProps, textsProps: textsProps@{ session }
} _ = do
cpt
props@{ session
} _ = do
session' <- R.useContext session
session' <- R.useContext session
pure $ textsWithForest
{ forestProps
, textsProps: Record.merge { session: session' } $ (REX.pick textsProps :: Record CommonPropsNoSession)
} []
textsWithForest :: R2.Component TextsWithForest
textsWithForest = R.createElement textsWithForestCpt
textsWithForestCpt :: R.Component TextsWithForest
textsWithForestCpt = here.component "textsWithForest" cpt
where
cpt { forestProps, textsProps: textProps@{ session } } _ = do
controls <- initialControls
controls <- initialControls
pure $ Forest.forestLayoutWithTopBar forestProps
[ topBar { controls } []
pure $ R.fragment
, textsLayout (Record.merge textProps { controls }) []
[ -- topBar { controls } []
-- TODO remove className "side-panel" is preview is not triggered
textsLayout (Record.merge { controls, session: session' } props) []
-- , H.div { className: "" }
, H.div { className: "side-panel" } [ sidePanel { controls, session: session' } [] ]
, H.div { className: "side-panel" }
]
[ sidePanel { controls, session } [] ]]
type TopBarProps = ( controls :: Record TextsLayoutControls )
type TopBarProps = ( controls :: Record TextsLayoutControls )
...
...
src/Gargantext/Components/Router.purs
View file @
ee654ac1
This diff is collapsed.
Click to expand it.
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