Commit bbb3350a authored by James Laver's avatar James Laver

more twiddling

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