Commit 48f83762 authored by James Laver's avatar James Laver

wowzer this record error...

parent bbb3350a
...@@ -19,6 +19,7 @@ import Partial.Unsafe (unsafePartial) ...@@ -19,6 +19,7 @@ import Partial.Unsafe (unsafePartial)
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as RH import Reactix.DOM.HTML as RH
import Record as Record import Record as Record
import Record.Extra as RX
import Toestand as T import Toestand as T
import Gargantext.AsyncTasks as GAT import Gargantext.AsyncTasks as GAT
...@@ -44,41 +45,49 @@ import Gargantext.Utils.Toestand as T2 ...@@ -44,41 +45,49 @@ 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 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
, 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) )
)
type LayoutLoaderProps = ( session :: R.Context Session | BaseProps )
type LayoutProps = ( session :: Session, graphVersion :: GUR.ReloadS | BaseProps )
type Props = type Props =
( graph :: SigmaxT.SGraph ( graph :: SigmaxT.SGraph
, graphVersion :: GUR.ReloadS , graphVersion :: GUR.ReloadS
, hyperdataGraph :: GET.HyperdataGraph , hyperdataGraph :: GET.HyperdataGraph
, mMetaData :: Maybe GET.MetaData , mMetaData :: Maybe GET.MetaData
, session :: Session
| LayoutProps | LayoutProps
) )
-------------------------------------------------------------- --------------------------------------------------------------
explorerLayout :: Record LayoutProps -> R.Element explorerLayoutLoader :: R2.Component LayoutLoaderProps
explorerLayout props = R.createElement explorerLayoutCpt props [] explorerLayoutLoader props = R.createElement explorerLayoutLoaderCpt props []
explorerLayoutCpt :: R.Component LayoutProps explorerLayoutLoaderCpt :: R.Component LayoutLoaderProps
explorerLayoutCpt = here.component "explorerLayout" cpt where explorerLayoutLoaderCpt = here.component "explorerLayoutLoader" cpt where
cpt props _ = do cpt props _ = do
graphVersion <- GUR.new graphVersion <- GUR.new
session <- R.useContext props.session -- todo: ugh, props fiddling session <- R.useContext props.session -- todo: ugh, props fiddling
pure $ explorerLayoutView graphVersion props let base = RX.pick props :: Record BaseProps
let props' = Record.merge base { graphVersion, session }
pure $ explorerLayout props'
explorerLayoutView :: GUR.ReloadS -> Record LayoutProps -> R.Element explorerLayout :: R2.Component LayoutProps
explorerLayoutView graphVersion p = R.createElement el p [] where explorerLayout props = R.createElement explorerLayoutCpt props []
el = here.component "explorerLayoutView" cpt
cpt props@{ graphId, session } _ = do explorerLayoutCpt :: R.Component LayoutProps
explorerLayoutCpt = here.component "explorerLayout" cpt where
cpt props@{ graphId, session, graphVersion } _ = do
useLoader graphId (getNodes session graphVersion) handler useLoader graphId (getNodes session graphVersion) handler
where where
handler loaded = handler loaded =
......
...@@ -234,14 +234,8 @@ graphExplorer = R.createElement graphExplorerCpt ...@@ -234,14 +234,8 @@ graphExplorer = R.createElement graphExplorerCpt
graphExplorerCpt :: R.Component SessionNodeProps graphExplorerCpt :: R.Component SessionNodeProps
graphExplorerCpt = here.component "graphExplorer" cpt where graphExplorerCpt = here.component "graphExplorer" cpt where
cpt props@{ cursors: { backend cpt props@{ cursors: { backend, handed, route, sessions, showLogin }
, handed , nodeId, session, tasks } _ = do
, route
, sessions
, showLogin }
, nodeId
, session
, tasks } _ = do
let sessionProps = RE.pick props :: Record SessionProps let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $ pure $ authed sessionProps $
simpleLayout { handed } simpleLayout { handed }
......
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