Commit cd5c85f2 authored by James Laver's avatar James Laver

for seeg

parent 7ee27ee6
...@@ -4,6 +4,7 @@ import Data.Set as Set ...@@ -4,6 +4,7 @@ import Data.Set as Set
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Toestand as T import Toestand as T
import Gargantext.Ends (Backend)
import Gargantext.Sessions as Sessions import Gargantext.Sessions as Sessions
import Gargantext.Sessions (OpenNodes, Sessions) import Gargantext.Sessions (OpenNodes, Sessions)
import Gargantext.Routes (AppRoute(Home)) import Gargantext.Routes (AppRoute(Home))
...@@ -11,7 +12,8 @@ import Gargantext.Types (Handed(RightHanded)) ...@@ -11,7 +12,8 @@ import Gargantext.Types (Handed(RightHanded))
import Gargantext.Utils.Toestand as T2 import Gargantext.Utils.Toestand as T2
type App = type App =
{ handed :: Handed { backend :: Maybe Backend
, handed :: Handed
, forestOpen :: OpenNodes , forestOpen :: OpenNodes
, reloadRoot :: Int , reloadRoot :: Int
, reloadForest :: Int , reloadForest :: Int
...@@ -23,7 +25,8 @@ type App = ...@@ -23,7 +25,8 @@ type App =
emptyApp :: App emptyApp :: App
emptyApp = emptyApp =
{ handed: RightHanded { backend: Nothing
, handed: RightHanded
, route: Home , route: Home
, forestOpen: Set.empty , forestOpen: Set.empty
, reloadRoot: T2.newReload , reloadRoot: T2.newReload
...@@ -34,7 +37,8 @@ emptyApp = ...@@ -34,7 +37,8 @@ emptyApp =
} }
type Cursors = type Cursors =
{ handed :: T.Cursor Handed { backend :: T.Cursor (Maybe Backend)
, handed :: T.Cursor Handed
, forestOpen :: T.Cursor OpenNodes , forestOpen :: T.Cursor OpenNodes
, reloadRoot :: T.Cursor Int , reloadRoot :: T.Cursor Int
, reloadForest :: T.Cursor Int , reloadForest :: T.Cursor Int
......
...@@ -11,7 +11,7 @@ module Gargantext.Components.Forest ...@@ -11,7 +11,7 @@ module Gargantext.Components.Forest
import Data.Array as A import Data.Array as A
import Data.Maybe (Maybe(..), fromMaybe) import Data.Maybe (Maybe(..), fromMaybe)
import Data.Set as Set import Data.Set as Set
import Data.Tuple (fst, snd) import Data.Tuple (fst)
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
...@@ -25,7 +25,7 @@ import Gargantext.Ends (Frontends, Backend) ...@@ -25,7 +25,7 @@ import Gargantext.Ends (Frontends, Backend)
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Routes (AppRoute) import Gargantext.Routes (AppRoute)
import Gargantext.Sessions (Session(..), Sessions, OpenNodes, unSessions) import Gargantext.Sessions (Session(..), Sessions, OpenNodes, unSessions)
import Gargantext.Types (Handed(..), reverseHanded, switchHanded) import Gargantext.Types (Handed, reverseHanded, switchHanded)
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2 import Gargantext.Utils.Toestand as T2
...@@ -42,7 +42,7 @@ type Common = ...@@ -42,7 +42,7 @@ type Common =
) )
type LayoutProps = type LayoutProps =
( backend :: T.Cursor Backend ( backend :: T.Cursor (Maybe Backend)
, reloadForest :: T.Cursor T2.Reload , reloadForest :: T.Cursor T2.Reload
, sessions :: T.Cursor Sessions , sessions :: T.Cursor Sessions
, showLogin :: T.Cursor Boolean , showLogin :: T.Cursor Boolean
...@@ -75,8 +75,7 @@ forestCpt = here.component "forest" cpt where ...@@ -75,8 +75,7 @@ forestCpt = here.component "forest" cpt where
, tasks } _ = do , tasks } _ = do
-- NOTE: this is a hack to reload the forest on demand -- NOTE: this is a hack to reload the forest on demand
tasks' <- GAT.useTasks reloadRoot reloadForest tasks' <- GAT.useTasks reloadRoot reloadForest
R.useEffect' $ do R.useEffect' $ T2.write_ (Just tasks') tasks
T2.write_ (Just tasks') tasks
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
...@@ -108,7 +107,7 @@ forestCpt = here.component "forest" cpt where ...@@ -108,7 +107,7 @@ forestCpt = here.component "forest" cpt where
, session: s , session: s
, tasks } [] , tasks } []
plus :: Handed -> T.Cursor Boolean -> T.Cursor Backend -> R.Element plus :: Handed -> T.Cursor Boolean -> T.Cursor (Maybe Backend) -> R.Element
plus handed showLogin backend = H.div { className: "row" } plus handed showLogin backend = H.div { className: "row" }
[ H.button { className: buttonClass [ H.button { className: buttonClass
, on: { click } , on: { click }
...@@ -122,7 +121,7 @@ plus handed showLogin backend = H.div { className: "row" } ...@@ -122,7 +121,7 @@ plus handed showLogin backend = H.div { className: "row" }
-- [ H.i { className: "material-icons md-36"} [] ] -- [ H.i { className: "material-icons md-36"} [] ]
where where
click _ = do click _ = do
-- _ <- T.modify (const Nothing) backend -- _ <- T.write Nothing backend
T2.write_ true showLogin T2.write_ true showLogin
title = "Add or remove connections to the server(s)." title = "Add or remove connections to the server(s)."
divClass = "fa fa-universal-access" divClass = "fa fa-universal-access"
......
...@@ -44,8 +44,8 @@ import Gargantext.Utils.Toestand as T2 ...@@ -44,8 +44,8 @@ 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 LayoutProps = ( type LayoutProps =
backend :: T.Cursor 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
...@@ -250,8 +250,8 @@ explorerCpt = here.component "explorer" cpt ...@@ -250,8 +250,8 @@ explorerCpt = here.component "explorer" cpt
Sidebar.sidebar (Record.merge props { metaData }) Sidebar.sidebar (Record.merge props { metaData })
type TreeProps = ( type TreeProps = (
backend :: T.Cursor Backend backend :: T.Cursor (Maybe Backend)
, forestOpen :: T.Cursor OpenNodes , forestOpen :: T.Cursor OpenNodes
, frontends :: Frontends , frontends :: Frontends
, handed :: T.Cursor Types.Handed , handed :: T.Cursor Types.Handed
, reload :: T.Cursor T2.Reload , reload :: T.Cursor T2.Reload
......
This diff is collapsed.
...@@ -15,16 +15,16 @@ import Gargantext.Utils.Reactix as R2 ...@@ -15,16 +15,16 @@ import Gargantext.Utils.Reactix as R2
here :: R2.Here here :: R2.Here
here = R2.here "Gargantext.Components.SessionWrapper" here = R2.here "Gargantext.Components.SessionWrapper"
type Props sessions = type Props =
( sessionId :: SessionId ( sessionId :: SessionId
, sessions :: sessions , sessions :: T.Cursor Sessions
, provider :: R.Provider Session , provider :: R.Provider Session
, fallback :: R.Element ) , fallback :: R.Element )
sessionWrapper :: forall s. T.Read s Sessions => R2.Component (Props s) sessionWrapper :: R2.Component Props
sessionWrapper = R.createElement sessionWrapperCpt sessionWrapper = R.createElement sessionWrapperCpt
sessionWrapperCpt :: forall s. T.Read s Sessions => R.Component (Props s) sessionWrapperCpt :: R.Component Props
sessionWrapperCpt = here.component "sessionWrapper" cpt where sessionWrapperCpt = here.component "sessionWrapper" cpt where
cpt { sessionId, sessions, provider, fallback } content = cpt { sessionId, sessions, provider, fallback } content =
cp <$> T.useLive T.unequal sessions where cp <$> T.useLive T.unequal sessions where
......
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