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
6d0d0db7
Commit
6d0d0db7
authored
Mar 09, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[toestand] more refactoring fixes
parent
48f83762
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
98 additions
and
68 deletions
+98
-68
App.purs
src/Gargantext/Components/App.purs
+5
-2
GraphExplorer.purs
src/Gargantext/Components/GraphExplorer.purs
+22
-16
Router.purs
src/Gargantext/Components/Router.purs
+71
-50
No files found.
src/Gargantext/Components/App.purs
View file @
6d0d0db7
module Gargantext.Components.App (app) where
module Gargantext.Components.App (app) where
import Data.Maybe (Maybe(..))
import Prelude
import Prelude
import Reactix as R
import Toestand as T
import Gargantext.Components.App.Data (emptyApp)
import Gargantext.Components.App.Data (emptyApp)
import Gargantext.Components.Router (router)
import Gargantext.Components.Router (router)
import Gargantext.Hooks (useHashRouter)
import Gargantext.Hooks (useHashRouter)
import Gargantext.Router as Router
import Gargantext.Router as Router
import Gargantext.Sessions as Sessions
import Gargantext.Sessions as Sessions
import Reactix as R
import Gargantext.Utils.Reactix as R2
import Toestand as T
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.App"
here = R2.here "Gargantext.Components.App"
...
...
src/Gargantext/Components/GraphExplorer.purs
View file @
6d0d0db7
...
@@ -45,33 +45,36 @@ import Gargantext.Utils.Toestand as T2
...
@@ -45,33 +45,36 @@ import Gargantext.Utils.Toestand as T2
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.GraphExplorer"
here = R2.here "Gargantext.Components.GraphExplorer"
type BaseProps =
type BaseProps =
(
(
backend :: T.Cursor (Maybe Backend)
backend :: T.Cursor (Maybe Backend)
, frontends :: Frontends
, frontends :: Frontends
, graphId :: GET.GraphId
, graphId :: GET.GraphId
, handed :: T.Cursor Types.Handed
, handed :: T.Cursor Types.Handed
, route :: T.Cursor AppRoute
, route :: T.Cursor AppRoute
, sessions :: T.Cursor Sessions
, sessions :: T.Cursor Sessions
, showLogin :: T.Cursor Boolean
, showLogin :: T.Cursor Boolean
, tasks :: T.Cursor (Maybe GAT.Reductor) )
, tasks :: T.Cursor (Maybe GAT.Reductor)
)
type LayoutLoaderProps = ( session :: R.Context Session | BaseProps )
type LayoutLoaderProps = ( session :: R.Context Session | BaseProps )
type LayoutProps = ( session :: Session, graphVersion :: GUR.ReloadS | BaseProps )
type LayoutProps = (
graphVersion :: GUR.ReloadS
, session :: Session
| BaseProps
)
type Props =
type Props = (
( graph :: SigmaxT.SGraph
graph :: SigmaxT.SGraph
, graphVersion :: GUR.ReloadS
, hyperdataGraph :: GET.HyperdataGraph
, hyperdataGraph :: GET.HyperdataGraph
, mMetaData :: Maybe GET.MetaData
, mMetaData :: Maybe GET.MetaData
, session :: Session
| LayoutProps
| LayoutProps
)
)
--------------------------------------------------------------
--------------------------------------------------------------
explorerLayoutLoader :: R2.Component LayoutLoaderProps
explorerLayoutLoader :: R2.Component LayoutLoaderProps
explorerLayoutLoader
props = R.createElement explorerLayoutLoaderCpt props []
explorerLayoutLoader
= R.createElement explorerLayoutLoaderCpt
explorerLayoutLoaderCpt :: R.Component LayoutLoaderProps
explorerLayoutLoaderCpt :: R.Component LayoutLoaderProps
explorerLayoutLoaderCpt = here.component "explorerLayoutLoader" cpt where
explorerLayoutLoaderCpt = here.component "explorerLayoutLoader" cpt where
...
@@ -80,25 +83,28 @@ explorerLayoutLoaderCpt = here.component "explorerLayoutLoader" cpt where
...
@@ -80,25 +83,28 @@ explorerLayoutLoaderCpt = here.component "explorerLayoutLoader" cpt where
session <- R.useContext props.session -- todo: ugh, props fiddling
session <- R.useContext props.session -- todo: ugh, props fiddling
let base = RX.pick props :: Record BaseProps
let base = RX.pick props :: Record BaseProps
let props' = Record.merge base { graphVersion, session }
let props' = Record.merge base { graphVersion, session }
pure $ explorerLayout props'
pure $ explorerLayout props'
[]
explorerLayout :: R2.Component LayoutProps
explorerLayout :: R2.Component LayoutProps
explorerLayout
props = R.createElement explorerLayoutCpt props []
explorerLayout
= R.createElement explorerLayoutCpt
explorerLayoutCpt :: R.Component LayoutProps
explorerLayoutCpt :: R.Component LayoutProps
explorerLayoutCpt = here.component "explorerLayout" cpt where
explorerLayoutCpt = here.component "explorerLayout" cpt where
cpt props@{ graphId, session, graphVersion } _ = do
cpt props@{ backend
, graphId
, graphVersion
, session } _ = do
useLoader graphId (getNodes session graphVersion) handler
useLoader graphId (getNodes session graphVersion) handler
where
where
handler loaded =
handler loaded =
explorer (Record.merge props { graph, hyperdataGraph: loaded, mMetaData }) []
explorer (Record.merge props { graph, graphVersion, hyperdataGraph: loaded, mMetaData })
--
explorer (Record.merge props { graph, graphVersion, hyperdataGraph: loaded, mMetaData })
where
where
GET.HyperdataGraph { graph: hyperdataGraph } = loaded
GET.HyperdataGraph { graph: hyperdataGraph } = loaded
Tuple mMetaData graph = convert hyperdataGraph
Tuple mMetaData graph = convert hyperdataGraph
--------------------------------------------------------------
--------------------------------------------------------------
explorer :: R
ecord Props -> R.Element
explorer :: R
2.Component Props
explorer
props = R.createElement explorerCpt props []
explorer
= R.createElement explorerCpt
explorerCpt :: R.Component Props
explorerCpt :: R.Component Props
explorerCpt = here.component "explorer" cpt
explorerCpt = here.component "explorer" cpt
...
...
src/Gargantext/Components/Router.purs
View file @
6d0d0db7
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