Commit bbb3350a authored by James Laver's avatar James Laver

more twiddling

parent 21533aa5
......@@ -50,7 +50,7 @@ type LayoutProps = (
, graphId :: GET.GraphId
, handed :: T.Cursor Types.Handed
, route :: T.Cursor AppRoute
, session :: Session
, session :: R.Context Session
, sessions :: T.Cursor Sessions
, showLogin :: T.Cursor Boolean
, tasks :: T.Cursor (Maybe GAT.Reductor)
......@@ -69,15 +69,14 @@ explorerLayout :: Record LayoutProps -> R.Element
explorerLayout props = R.createElement explorerLayoutCpt props []
explorerLayoutCpt :: R.Component LayoutProps
explorerLayoutCpt = here.component "explorerLayout" cpt
where
explorerLayoutCpt = here.component "explorerLayout" cpt where
cpt props _ = do
graphVersion <- GUR.new
session <- R.useContext props.session -- todo: ugh, props fiddling
pure $ explorerLayoutView graphVersion props
explorerLayoutView :: GUR.ReloadS -> Record LayoutProps -> R.Element
explorerLayoutView graphVersion p = R.createElement el p []
where
explorerLayoutView graphVersion p = R.createElement el p [] where
el = here.component "explorerLayoutView" cpt
cpt props@{ graphId, session } _ = do
useLoader graphId (getNodes session graphVersion) handler
......
module Gargantext.Components.Router (router) where
import Data.Array (fromFoldable)
import Data.Maybe (Maybe(..), maybe')
import Prim.Row (class Cons, class Lacks)
import Data.Maybe (Maybe(..))
import Reactix as R
import Record as Record
import Record.Extra as RE
......@@ -14,7 +13,7 @@ import Gargantext.Prelude
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.App.Data (Cursors)
import Gargantext.Components.Footer (footer)
import Gargantext.Components.Forest (forestLayout, forestLayoutWithTopBar)
import Gargantext.Components.Forest (forestLayout)
import Gargantext.Components.GraphExplorer (explorerLayout)
import Gargantext.Components.Lang (LandingLang(LL_EN))
import Gargantext.Components.Login (login)
......@@ -31,12 +30,12 @@ import Gargantext.Components.Nodes.Lists as Lists
import Gargantext.Components.Nodes.Texts as Texts
import Gargantext.Components.SessionLoader (sessionWrapper)
import Gargantext.Components.SimpleLayout (simpleLayout)
import Gargantext.Config (defaultFrontends, defaultBackends, publicBackend)
import Gargantext.Config (defaultFrontends, defaultBackends)
import Gargantext.Ends (Backend)
import Gargantext.Routes (AppRoute(..))
import Gargantext.Routes (AppRoute)
import Gargantext.Routes as GR
import Gargantext.Sessions (Session)
import Gargantext.Types (CorpusId, ListId, NodeID, NodeType(..), SessionId(..))
import Gargantext.Types (CorpusId, ListId, NodeID, NodeType(..), SessionId)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
......@@ -139,66 +138,65 @@ corpusCpt = here.component "corpus" cpt where
cpt props@{ cursors, nodeId, session, tasks } _ = do
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $
forested props [ corpusLayout { nodeId, session } ]
forested { cursors, tasks } [ corpusLayout { nodeId, session } ]
type CorpusDocumentProps = (
corpusId :: CorpusId
type CorpusDocumentProps =
( corpusId :: CorpusId
, listID :: ListId
| SessionNodeProps
)
corpusDocument :: R2.Component CorpusDocumentProps
corpusDocument = R.createElement corpusDocumentCpt
corpusDocumentCpt :: R.Component CorpusDocumentProps
corpusDocumentCpt = here.component "corpusDocument" cpt
where
cpt props@{ corpusId: corpusId', listId, nodeId, session, sessionId, tasks } _ = do
cpt props@{ cursors, corpusId: corpusId', listID, nodeId, session, sessionId, tasks } _ = do
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $
forested props
[ documentMainLayout { corpusId', listId, nodeId, session, sessionId } [] ]
forested { cursors, tasks }
[ documentMainLayout { mCorpusId: corpusId, listId: listID, nodeId, session } [] ]
where corpusId = Just corpusId'
dashboard :: R2.Component SessionNodeProps
dashboard = R.createElement dashboardCpt
dashboardCpt :: R.Component SessionNodeProps
dashboardCpt = here.component "dashboard" cpt
where
cpt props@{ cursors: session, nodeId, session, tasks } _ = do
cpt props@{ cursors, nodeId, session, tasks } _ = do
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $
forested props [ dashboardLayout { nodeId, session } [] ]
forested { cursors, tasks } [ dashboardLayout { nodeId, session } [] ]
type DocumentProps = (
listId :: ListId
| SessionNodeProps
)
type DocumentProps = ( listId :: ListId | SessionNodeProps )
document :: R2.Component DocumentProps
document = R.createElement documentCpt
documentCpt :: R.Component DocumentProps
documentCpt = here.component "document" cpt
where
cpt props@{ listId, nodeId, session, sessionId, tasks } _ = do
documentCpt = here.component "document" cpt where
cpt props@{ listId, nodeId, session, sessionId, tasks, cursors } _ = do
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $
forested props
[ documentMainLayout { listId, nodeId, corpusId, session } [] ]
where corpusId = Nothing
forested { cursors, tasks }
[ documentMainLayout { listId, nodeId, mCorpusId, session } [] ]
where mCorpusId = Nothing
home :: R2.Component Props
home = R.createElement homeCpt
homeCpt :: R.Component Props
homeCpt = here.component "home" cpt
where
cpt props@{ cursors: { sessions, showLogin } } _ = do
pure $ forested props [ homeLayout { lang: LL_EN, sessions, showLogin } ]
homeCpt = here.component "home" cpt where
cpt props@{ cursors: cursors@{ sessions, showLogin }, tasks } _ = do
pure $ forested { cursors, tasks } [ homeLayout { lang: LL_EN, sessions, showLogin } ]
lists :: R2.Component SessionNodeProps
lists = R.createElement listsCpt
listsCpt :: R.Component SessionNodeProps
listsCpt = here.component "lists" cpt
where
listsCpt = here.component "lists" cpt where
cpt props@{ cursors: { backend
, handed
, reloadForest
......@@ -233,9 +231,9 @@ login' { backend, sessions, showLogin: visible } =
graphExplorer :: R2.Component SessionNodeProps
graphExplorer = R.createElement graphExplorerCpt
graphExplorerCpt :: R.Component SessionNodeProps
graphExplorerCpt = here.component "graphExplorer" cpt
where
graphExplorerCpt = here.component "graphExplorer" cpt where
cpt props@{ cursors: { backend
, handed
, route
......@@ -260,12 +258,13 @@ graphExplorerCpt = here.component "graphExplorer" cpt
routeFile :: R2.Component SessionNodeProps
routeFile = R.createElement routeFileCpt
routeFileCpt :: R.Component SessionNodeProps
routeFileCpt = here.component "routeFile" cpt
where
cpt props@{ nodeId, session, sessionId } _ = do
routeFileCpt = here.component "routeFile" cpt where
cpt props@{ nodeId, session, sessionId, cursors, tasks } _ = do
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $ forested props [ fileLayout { nodeId, session } ]
pure $ authed sessionProps $
forested { cursors, tasks } [ fileLayout { nodeId, session } ]
type RouteFrameProps = (
nodeType :: NodeType
......@@ -274,24 +273,25 @@ type RouteFrameProps = (
routeFrame :: R2.Component RouteFrameProps
routeFrame = R.createElement routeFrameCpt
routeFrameCpt :: R.Component RouteFrameProps
routeFrameCpt = here.component "routeFrame" cpt
where
cpt props@{ nodeId, nodeType, session, sessionId } _ = do
routeFrameCpt = here.component "routeFrame" cpt where
cpt props@{ nodeId, nodeType, session, sessionId, cursors, tasks } _ = do
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $ forested props [ frameLayout { nodeId, nodeType, session } ]
pure $ authed sessionProps $ forested { cursors, tasks } [ frameLayout { nodeId, nodeType, session } ]
team :: R2.Component SessionNodeProps
team = R.createElement teamCpt
teamCpt :: R.Component SessionNodeProps
teamCpt = here.component "team" cpt
where
cpt props@{ nodeId, session, sessionId } _ = do
teamCpt = here.component "team" cpt where
cpt props@{ nodeId, session, sessionId, cursors, tasks } _ = do
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $ forested props [ corpusLayout { nodeId, session } ]
pure $ authed sessionProps $ forested { cursors, tasks } [ corpusLayout { nodeId, session } ]
texts :: R2.Component SessionNodeProps
texts = R.createElement textsCpt
textsCpt :: R.Component SessionNodeProps
textsCpt = here.component "texts" cpt
where
......@@ -323,36 +323,26 @@ textsCpt = here.component "texts" cpt
user :: R2.Component SessionNodeProps
user = R.createElement userCpt
userCpt :: R.Component SessionNodeProps
userCpt = here.component "user" cpt
where
cpt props@{ cursors: { reloadRoot }
, nodeId
, session
, sessionId
, tasks } _ = do
userCpt = here.component "user" cpt where
cpt props@{ cursors: cursors@{ reloadRoot }
, nodeId, session, sessionId, tasks } _ = do
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $
forested props
forested { cursors, tasks }
[ userLayout { frontends, nodeId, reloadRoot, session, tasks } ]
where frontends = defaultFrontends
type ContactProps = (
annuaireId :: NodeID
| SessionNodeProps
)
type ContactProps = ( annuaireId :: NodeID | SessionNodeProps )
contact :: R2.Component ContactProps
contact = R.createElement contactCpt
contactCpt :: R.Component ContactProps
contactCpt = here.component "contact" cpt
where
cpt props@{ annuaireId
, cursors: { reloadForest, reloadRoot }
, nodeId
, session
, sessionId
, tasks } _ = do
contactCpt = here.component "contact" cpt where
cpt props@{ annuaireId, nodeId, session, sessionId, tasks
, cursors: { reloadForest, reloadRoot } } _ = do
let sessionProps = RE.pick props :: Record SessionProps
let forestedProps = RE.pick props :: Record Props
pure $ authed sessionProps $
......
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