Commit b04fd6a8 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski Committed by James Laver

TEMP: endConfig work

parent d2018b69
......@@ -20,7 +20,7 @@ import Partial.Unsafe (unsafePartial)
import React.SyntheticEvent as E
import Reactix as R
import Reactix.DOM.HTML as H
import Thermite (Spec)
import Thermite as T
import URI.Extra.QueryPairs as QP
import URI.Query as Q
import Web.File.File (toBlob)
......@@ -30,6 +30,7 @@ import Web.File.FileReader.Aff (readAsText)
import Gargantext.Components.Loader2 (useLoader)
import Gargantext.Config (toUrl, endConfigStateful, End(..), NodeType(..), readNodeType)
import Gargantext.Config.REST (get, put, post, postWwwUrlencoded, delete)
import Gargantext.Pages.Layout.States (AppState)
import Gargantext.Router as Router
import Gargantext.Types (class ToQuery, toQuery)
import Gargantext.Utils (id)
......@@ -180,7 +181,6 @@ elTreeview props = R.createElement el props []
treeview :: Spec {} Props Void
treeview = R2.elSpec $ R.hooksComponent "TreeView" treeviewCpt
treeviewCpt {root, mCurrentRoute} _children = do
-- NOTE: this is a hack to reload the tree view on demand
setReload <- R.useState' 0
......
......@@ -28,10 +28,14 @@ import Gargantext.Pages.Texts as Texts
import Gargantext.Pages.Home as L
import Gargantext.Pages.Layout.Actions (Action(..), _graphExplorerAction, _loginAction, performAction)
import Gargantext.Pages.Layout.Specs.SearchBar as SB
import Gargantext.Pages.Layout.States (AppState, _loginState, _graphExplorerState)
import Gargantext.Pages.Layout.States (AppState, _graphExplorerState, _searchState, _loginState, _addCorpusState)
import Gargantext.Router (Routes(..))
import Gargantext.Utils.Reactix as R2
-- TODO
-- rewrite layoutSpec to use state (with EndConfig)
-- tree changes endConfig state => trigger endConfig change in outerLayout, layoutFooter etc
layoutSpec :: Spec AppState {} Action
layoutSpec =
fold
......@@ -101,6 +105,7 @@ layout0 layout =
case st.loginState.authData of
Just (AuthData {tree_id}) ->
ls $ cmapProps (const {root: tree_id, mCurrentRoute: st.currentRoute}) $ noState $ Tree.treeview
ls $ cmapProps (const {root: tree_id, mCurrentRoute: st.currentRoute}) $ Tree.treeview
Nothing ->
outerLayout1
, rs bs
......@@ -117,6 +122,7 @@ layout0 layout =
] (render d p s c) ]
cont = over _render \render d p s c -> [ div [className "row" ] (render d p s c) ]
--as = noState Tree.treeview
bs = innerLayout $ layout
innerLayout :: Spec AppState {} Action
......
......@@ -5,6 +5,8 @@ import Prelude hiding (div)
import Data.Lens (Lens', lens)
import Data.Maybe (Maybe(..))
import Effect (Effect)
import Gargantext.Components.Login as LN
import Gargantext.Config (EndConfig, endConfigStateful)
import Gargantext.Components.Login as LN
--import Gargantext.Components.Login.Types as LNT
......@@ -19,6 +21,7 @@ type AppState =
, showCorpus :: Boolean
--, graphExplorerState :: Record GET.StateGlue
, showTree :: Boolean
, endConfig :: EndConfig
}
initAppState :: Effect AppState
......@@ -32,6 +35,7 @@ initAppState = do
, showCorpus : false
--, graphExplorerState : GET.initialStateGlue
, showTree : false
, endConfig : endConfigStateful
}
......
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