Commit 7ee27ee6 authored by James Laver's avatar James Laver

remove views from router

parent 1b753ff9
...@@ -41,7 +41,6 @@ here = R2.here "Gargantext.Components.Router" ...@@ -41,7 +41,6 @@ here = R2.here "Gargantext.Components.Router"
type Props = ( type Props = (
cursors :: Cursors cursors :: Cursors
, tasks :: T.Cursor (Maybe GAT.Reductor) , tasks :: T.Cursor (Maybe GAT.Reductor)
, views :: App.Views
) )
router :: R2.Leaf Props router :: R2.Leaf Props
...@@ -49,11 +48,11 @@ router props = R.createElement routerCpt props [] ...@@ -49,11 +48,11 @@ router props = R.createElement routerCpt props []
routerCpt :: R.Component Props routerCpt :: R.Component Props
routerCpt = here.component "root" cpt where routerCpt = here.component "root" cpt where
cpt props@{ cursors, views, tasks } _ = do cpt props@{ cursors, ws, tasks } _ = do
let session = R.createContext (unsafeCoerce {}) let session = R.createContext (unsafeCoerce {})
showLogin <- T.useLive T.unequal views.showLogin showLogin <- T.useLive T.unequal cursors.showLogin
route <- T.useLive (T.changed notEq) views.route route <- T.useLive (T.changed notEq) cursors.route
if showLogin then login' cursors views if showLogin then login' cursors
else case route of else case route of
GR.Annuaire s n -> annuaire props s n GR.Annuaire s n -> annuaire props s n
GR.Corpus s n -> corpus props s n GR.Corpus s n -> corpus props s n
...@@ -78,58 +77,56 @@ routerCpt = here.component "root" cpt where ...@@ -78,58 +77,56 @@ routerCpt = here.component "root" cpt where
GR.ContactPage s a n -> contact props s a n GR.ContactPage s a n -> contact props s a n
forested :: Record Props -> Array R.Element -> R.Element forested :: Record Props -> Array R.Element -> R.Element
forested { tasks, views: { route, handed, sessions } forested { tasks, cursors: { route, handed, sessions, backend, reloadForest, reloadRoot, showLogin } } =
, cursors: { backend, reloadForest, reloadRoot, showLogin } } =
forestLayout forestLayout
{ tasks, frontends, route, handed, sessions { tasks, frontends, route, handed, sessions
, backend, reloadForest, reloadRoot, showLogin , backend, reloadForest, reloadRoot, showLogin
} where frontends = defaultFrontends } where frontends = defaultFrontends
authed :: Record Props -> SessionId -> R.Element -> R.Element authed :: Record Props -> SessionId -> R.Element -> R.Element
authed props@{ cursors: { session }, views: views@{ sessions } authed props@{ cursors: { session, sessions } , tasks } sessionId content =
, tasks } sessionId content =
sessionWrapper { sessionId, session, sessions, fallback: home props } sessionWrapper { sessionId, session, sessions, fallback: home props }
[ content, footer { session: views.session } ] [ content, footer { session } ]
annuaire :: Record Props -> SessionId -> NodeID -> R.Element annuaire :: Record Props -> SessionId -> NodeID -> R.Element
annuaire props@{ tasks, cursors, views: { session } } sessionId nodeId = annuaire props@{ tasks, cursors: { session } } sessionId nodeId =
authed props sessionId $ authed props sessionId $
forested props [ annuaireLayout { nodeId, frontends, session } ] forested props [ annuaireLayout { nodeId, frontends, session } ]
where frontends = defaultFrontends where frontends = defaultFrontends
corpus :: Record Props -> SessionId -> NodeID -> R.Element corpus :: Record Props -> SessionId -> NodeID -> R.Element
corpus props@{ tasks, cursors, views } sessionId nodeId = corpus props@{ tasks, cursors: session } sessionId nodeId =
authed props sessionId $ authed props sessionId $
forested props forested props
[ corpusLayout { nodeId, session: views.session } ] [ corpusLayout { nodeId, session } ]
corpusDocument :: Record Props -> SessionId -> CorpusId -> ListId -> NodeID -> R.Element corpusDocument :: Record Props -> SessionId -> CorpusId -> ListId -> NodeID -> R.Element
corpusDocument props@{ tasks, cursors, views } sessionId corpusId' listId nodeId = corpusDocument props@{ tasks, cursors: session } sessionId corpusId' listId nodeId =
authed props sessionId $ authed props sessionId $
forested props forested props
[ documentMainLayout { listId, nodeId, corpusId, sessionId, session: views.session } [] ] [ documentMainLayout { listId, nodeId, corpusId, sessionId, session } [] ]
where corpusId = Just corpusId' where corpusId = Just corpusId'
dashboard :: Record Props -> SessionId -> NodeID -> R.Element dashboard :: Record Props -> SessionId -> NodeID -> R.Element
dashboard props@{ tasks, cursors, views: { session } } sessionId nodeId = dashboard props@{ tasks, cursors: { session } } sessionId nodeId =
authed props sessionId $ authed props sessionId $
forested props [ dashboardLayout { nodeId, session } [] ] forested props [ dashboardLayout { nodeId, session } [] ]
document :: Record Props -> SessionId -> ListId -> NodeID -> R.Element document :: Record Props -> SessionId -> ListId -> NodeID -> R.Element
document props@{ tasks, cursors, views: { session } } sessionId listId nodeId = document props@{ tasks, cursors: { session } } sessionId listId nodeId =
authed props sessionId $ authed props sessionId $
forested props forested props
[ documentMainLayout { listId, nodeId, corpusId, session } [] ] [ documentMainLayout { listId, nodeId, corpusId, session } [] ]
where corpusId = Nothing where corpusId = Nothing
home :: Record Props -> R.Element home :: Record Props -> R.Element
home props@{ cursors: { backend, showLogin }, views: { sessions } } = home props@{ cursors: { backend, showLogin, sessions } } =
forested props [ homeLayout { sessions, backend, showLogin, lang: LL_EN } ] forested props [ homeLayout { sessions, backend, showLogin, lang: LL_EN } ]
lists :: Record Props -> SessionId -> NodeID -> R.Element lists :: Record Props -> SessionId -> NodeID -> R.Element
lists props@{ tasks lists props@{ cursors: { backend, route, handed, sessions
, cursors: { reloadForest, reloadRoot, session, showLogin } , reloadForest, reloadRoot, session, showLogin }
, views: { backend, route, handed, sessions } } sessionId nodeId = , tasks } sessionId nodeId =
authed props sessionId $ authed props sessionId $
Lists.listsWithForest Lists.listsWithForest
{ forestProps: { backend { forestProps: { backend
...@@ -151,8 +148,8 @@ login' { backend, sessions, showLogin: visible } = ...@@ -151,8 +148,8 @@ login' { backend, sessions, showLogin: visible } =
, backends: fromFoldable defaultBackends } , backends: fromFoldable defaultBackends }
graphExplorer :: Record Props -> SessionId -> Int -> R.Element graphExplorer :: Record Props -> SessionId -> Int -> R.Element
graphExplorer props@{ views: { backend, route, handed, session, sessions } graphExplorer props@{ views: { backend, route, handed, session, sessions, showLogin }
, tasks, cursors: { showLogin } } sessionId graphId = , tasks } sessionId graphId =
authed props sessionId $ authed props sessionId $
simpleLayout { handed } simpleLayout { handed }
[ explorerLayout { tasks, graphId, backend, route, frontends [ explorerLayout { tasks, graphId, backend, route, frontends
...@@ -160,20 +157,19 @@ graphExplorer props@{ views: { backend, route, handed, session, sessions } ...@@ -160,20 +157,19 @@ graphExplorer props@{ views: { backend, route, handed, session, sessions }
where frontends = defaultFrontends where frontends = defaultFrontends
routeFile :: Record Props -> SessionId -> NodeID -> R.Element routeFile :: Record Props -> SessionId -> NodeID -> R.Element
routeFile props@{ views: { session } } sessionId nodeId = routeFile props@{ cursors: { session } } sessionId nodeId =
authed props sessionId $ forested props [ fileLayout { nodeId, session } ] authed props sessionId $ forested props [ fileLayout { nodeId, session } ]
routeFrame :: Record Props -> SessionId -> NodeID -> NodeType -> R.Element routeFrame :: Record Props -> SessionId -> NodeID -> NodeType -> R.Element
routeFrame props@{ views: { session } } sessionId nodeId nodeType = routeFrame props@{ cursors: { session } } sessionId nodeId nodeType =
authed props sessionId $ forested props [ frameLayout { nodeId, nodeType, session } ] authed props sessionId $ forested props [ frameLayout { nodeId, nodeType, session } ]
team :: Record Props -> SessionId -> NodeID -> R.Element team :: Record Props -> SessionId -> NodeID -> R.Element
team props@{ tasks, cursors, views: { session } } sessionId nodeId = team props@{ tasks, cursors: { session } } sessionId nodeId =
authed props sessionId $ forested props [ corpusLayout { nodeId, session } ] authed props sessionId $ forested props [ corpusLayout { nodeId, session } ]
texts :: Record Props -> SessionId -> NodeID -> R.Element texts :: Record Props -> SessionId -> NodeID -> R.Element
texts props@{ cursors: { backend, reloadForest, reloadRoot, showLogin } texts props@{ cursors: { backend, reloadForest, reloadRoot, showLogin, route, handed, session, sessions }
, views: { route, handed, session, sessions }
, tasks } sessionId nodeId = , tasks } sessionId nodeId =
authed props sessionId $ authed props sessionId $
Texts.textsWithForest Texts.textsWithForest
...@@ -183,10 +179,10 @@ texts props@{ cursors: { backend, reloadForest, reloadRoot, showLogin } ...@@ -183,10 +179,10 @@ texts props@{ cursors: { backend, reloadForest, reloadRoot, showLogin }
[] where frontends = defaultFrontends [] where frontends = defaultFrontends
user :: Record Props -> SessionId -> NodeID -> R.Element user :: Record Props -> SessionId -> NodeID -> R.Element
user props@{ cursors: { reloadRoot }, tasks, views } sessionId nodeId = user props@{ cursors: { reloadRoot, session }, tasks } sessionId nodeId =
authed props sessionId $ authed props sessionId $
forested props forested props
[ userLayout { tasks, nodeId, session: views.session, reloadRoot, frontends } ] [ userLayout { tasks, nodeId, session, reloadRoot, frontends } ]
where frontends = defaultFrontends where frontends = defaultFrontends
contact :: Record Props -> SessionId -> NodeID -> R.Element contact :: Record Props -> SessionId -> NodeID -> R.Element
......
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