Commit 80479a93 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[GraphExplorer] more reactix refactorings in Layout

parent e6c7df25
...@@ -38,7 +38,7 @@ import Gargantext.Config.REST (get) ...@@ -38,7 +38,7 @@ import Gargantext.Config.REST (get)
import Gargantext.Pages.Corpus.Graph.Tabs as GT import Gargantext.Pages.Corpus.Graph.Tabs as GT
import Gargantext.Types (class Optional) import Gargantext.Types (class Optional)
import Gargantext.Utils (toggleSet) import Gargantext.Utils (toggleSet)
import Gargantext.Utils.Reactix (scuff) import Gargantext.Utils.Reactix as R2
import Partial.Unsafe (unsafePartial) import Partial.Unsafe (unsafePartial)
import Unsafe.Coerce (unsafeCoerce) import Unsafe.Coerce (unsafeCoerce)
import Web.HTML (window) import Web.HTML (window)
...@@ -49,6 +49,8 @@ import Reactix.DOM.HTML as RH ...@@ -49,6 +49,8 @@ import Reactix.DOM.HTML as RH
type Props s fa2 = () type Props s fa2 = ()
spec = R2.scuff $ explorer {}
explorer :: forall s fa2. Record (Props s fa2) -> R.Element explorer :: forall s fa2. Record (Props s fa2) -> R.Element
explorer props = R.createElement explorerCpt props [] explorer props = R.createElement explorerCpt props []
......
This diff is collapsed.
...@@ -53,7 +53,7 @@ dispatchAction dispatcher _ (Document i n) = do ...@@ -53,7 +53,7 @@ dispatchAction dispatcher _ (Document i n) = do
dispatchAction dispatcher _ (PGraphExplorer nid) = do dispatchAction dispatcher _ (PGraphExplorer nid) = do
dispatcher $ SetRoute $ PGraphExplorer nid dispatcher $ SetRoute $ PGraphExplorer nid
dispatcher $ GraphExplorerA $ GE.LoadGraph nid -- dispatcher $ GraphExplorerA $ GE.LoadGraph nid
--dispatcher $ GraphExplorerA $ GE.LoadGraph "imtNew.json" --dispatcher $ GraphExplorerA $ GE.LoadGraph "imtNew.json"
dispatchAction dispatcher _ Dashboard = do dispatchAction dispatcher _ Dashboard = do
......
...@@ -12,7 +12,7 @@ import Routing.Hash (setHash) ...@@ -12,7 +12,7 @@ import Routing.Hash (setHash)
import Gargantext.Components.Login as LN import Gargantext.Components.Login as LN
import Gargantext.Components.Modals.Modal (modalShow) import Gargantext.Components.Modals.Modal (modalShow)
import Gargantext.Pages.Annuaire as Annuaire import Gargantext.Pages.Annuaire as Annuaire
import Gargantext.Pages.Corpus.Graph as GE --import Gargantext.Pages.Corpus.Graph as GE
import Gargantext.Pages.Layout.Specs.AddCorpus as AC import Gargantext.Pages.Layout.Specs.AddCorpus as AC
import Gargantext.Pages.Layout.Specs.Search as S import Gargantext.Pages.Layout.Specs.Search as S
import Gargantext.Pages.Layout.States (AppState) import Gargantext.Pages.Layout.States (AppState)
...@@ -26,7 +26,7 @@ data Action ...@@ -26,7 +26,7 @@ data Action
| SetRoute Routes | SetRoute Routes
| SearchA S.Action | SearchA S.Action
| AddCorpusA AC.Action | AddCorpusA AC.Action
| GraphExplorerA GE.Action -- | GraphExplorerA GE.Action
| AnnuaireAction Annuaire.Action | AnnuaireAction Annuaire.Action
| ShowLogin | ShowLogin
| Logout | Logout
...@@ -63,7 +63,7 @@ performAction ShowAddCorpus _ _ = void do ...@@ -63,7 +63,7 @@ performAction ShowAddCorpus _ _ = void do
performAction (LoginA _) _ _ = pure unit performAction (LoginA _) _ _ = pure unit
performAction (AddCorpusA _) _ _ = pure unit performAction (AddCorpusA _) _ _ = pure unit
performAction (SearchA _) _ _ = pure unit performAction (SearchA _) _ _ = pure unit
performAction (GraphExplorerA _) _ _ = pure unit -- performAction (GraphExplorerA _) _ _ = pure unit
performAction (AnnuaireAction _) _ _ = pure unit performAction (AnnuaireAction _) _ _ = pure unit
-- liftEffect $ modalShow "addCorpus" -- liftEffect $ modalShow "addCorpus"
-- modifyState $ _ {showCorpus = true} -- modifyState $ _ {showCorpus = true}
...@@ -94,8 +94,8 @@ _annuaireAction = prism AnnuaireAction \action -> ...@@ -94,8 +94,8 @@ _annuaireAction = prism AnnuaireAction \action ->
AnnuaireAction a -> Right a AnnuaireAction a -> Right a
_ -> Left action _ -> Left action
_graphExplorerAction :: Prism' Action GE.Action -- _graphExplorerAction :: Prism' Action GE.Action
_graphExplorerAction = prism GraphExplorerA \action -> -- _graphExplorerAction = prism GraphExplorerA \action ->
case action of -- case action of
GraphExplorerA caction -> Right caction -- GraphExplorerA caction -> Right caction
_-> Left action -- _-> Left action
...@@ -12,6 +12,7 @@ import Thermite (Render, Spec, _render, defaultPerformAction, defaultRender, foc ...@@ -12,6 +12,7 @@ import Thermite (Render, Spec, _render, defaultPerformAction, defaultRender, foc
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Components.Data.Lang (Lang(..)) import Gargantext.Components.Data.Lang (Lang(..))
import Gargantext.Components.GraphExplorer as GE
import Gargantext.Components.Login.Types (AuthData(..)) import Gargantext.Components.Login.Types (AuthData(..))
import Gargantext.Components.Login as LN import Gargantext.Components.Login as LN
import Gargantext.Components.Tree as Tree import Gargantext.Components.Tree as Tree
...@@ -21,13 +22,13 @@ import Gargantext.Pages.Annuaire.User.Contacts as C ...@@ -21,13 +22,13 @@ import Gargantext.Pages.Annuaire.User.Contacts as C
import Gargantext.Pages.Corpus as Corpus import Gargantext.Pages.Corpus as Corpus
import Gargantext.Pages.Corpus.Document as Annotation import Gargantext.Pages.Corpus.Document as Annotation
import Gargantext.Pages.Corpus.Dashboard as Dsh import Gargantext.Pages.Corpus.Dashboard as Dsh
import Gargantext.Pages.Corpus.Graph as GE --import Gargantext.Pages.Corpus.Graph as GE
import Gargantext.Pages.Home as L import Gargantext.Pages.Home as L
import Gargantext.Pages.Layout.Actions (Action(..), _addCorpusAction, _graphExplorerAction, _loginAction, _searchAction, performAction) import Gargantext.Pages.Layout.Actions (Action(..), _addCorpusAction, _loginAction, _searchAction, performAction)
import Gargantext.Pages.Layout.Specs.AddCorpus as AC import Gargantext.Pages.Layout.Specs.AddCorpus as AC
import Gargantext.Pages.Layout.Specs.Search as S import Gargantext.Pages.Layout.Specs.Search as S
import Gargantext.Pages.Layout.Specs.SearchBar as SB import Gargantext.Pages.Layout.Specs.SearchBar as SB
import Gargantext.Pages.Layout.States (AppState, _addCorpusState, _graphExplorerState, _loginState, _searchState) import Gargantext.Pages.Layout.States (AppState, _addCorpusState, _loginState, _searchState)
import Gargantext.Router (Routes(..)) import Gargantext.Router (Routes(..))
import Gargantext.Utils.Reactix (scuff) import Gargantext.Utils.Reactix (scuff)
...@@ -61,7 +62,8 @@ pagesComponent s = case s.currentRoute of ...@@ -61,7 +62,8 @@ pagesComponent s = case s.currentRoute of
selectSpec AddCorpus = layout0 $ focus _addCorpusState _addCorpusAction AC.layoutAddcorpus selectSpec AddCorpus = layout0 $ focus _addCorpusState _addCorpusAction AC.layoutAddcorpus
selectSpec SearchView = layout0 $ focus _searchState _searchAction S.searchSpec selectSpec SearchView = layout0 $ focus _searchState _searchAction S.searchSpec
selectSpec (Document l i) = layout0 $ cmapProps (const {nodeId: i, listId: l}) $ noState Annotation.layout selectSpec (Document l i) = layout0 $ cmapProps (const {nodeId: i, listId: l}) $ noState Annotation.layout
selectSpec (PGraphExplorer i)= layout1 $ focus _graphExplorerState _graphExplorerAction GE.specOld --selectSpec (PGraphExplorer i)= layout1 $ focus _graphExplorerState _graphExplorerAction GE.specOld
selectSpec (PGraphExplorer i) = layout1 $ noState $ GE.spec
selectSpec Dashboard = layout0 $ noState Dsh.layoutDashboard selectSpec Dashboard = layout0 $ noState Dsh.layoutDashboard
selectSpec (Annuaire i) = layout0 $ cmapProps (const {annuaireId: i}) $ noState A.layout selectSpec (Annuaire i) = layout0 $ cmapProps (const {annuaireId: i}) $ noState A.layout
selectSpec (UserPage i) = layout0 $ cmapProps (const {nodeId: i}) $ noState C.layoutUser selectSpec (UserPage i) = layout0 $ cmapProps (const {nodeId: i}) $ noState C.layoutUser
......
...@@ -7,7 +7,7 @@ import Data.Maybe (Maybe(Just)) ...@@ -7,7 +7,7 @@ import Data.Maybe (Maybe(Just))
import Effect (Effect) import Effect (Effect)
import Gargantext.Components.Login as LN import Gargantext.Components.Login as LN
import Gargantext.Pages.Corpus.Graph as GE --import Gargantext.Pages.Corpus.Graph as GE
import Gargantext.Pages.Layout.Specs.AddCorpus as AC import Gargantext.Pages.Layout.Specs.AddCorpus as AC
import Gargantext.Pages.Layout.Specs.Search as S import Gargantext.Pages.Layout.Specs.Search as S
import Gargantext.Router (Routes(..)) import Gargantext.Router (Routes(..))
...@@ -19,7 +19,7 @@ type AppState = ...@@ -19,7 +19,7 @@ type AppState =
, searchState :: S.State , searchState :: S.State
, showLogin :: Boolean , showLogin :: Boolean
, showCorpus :: Boolean , showCorpus :: Boolean
, graphExplorerState :: GE.State --, graphExplorerState :: GE.State
, showTree :: Boolean , showTree :: Boolean
} }
...@@ -33,7 +33,7 @@ initAppState = do ...@@ -33,7 +33,7 @@ initAppState = do
, searchState : S.initialState , searchState : S.initialState
, showLogin : false , showLogin : false
, showCorpus : false , showCorpus : false
, graphExplorerState : GE.initialState --, graphExplorerState : GE.initialState
, showTree : false , showTree : false
} }
...@@ -49,6 +49,6 @@ _addCorpusState = lens (\s -> s.addCorpusState) (\s ss -> s{addCorpusState = ss} ...@@ -49,6 +49,6 @@ _addCorpusState = lens (\s -> s.addCorpusState) (\s ss -> s{addCorpusState = ss}
_searchState :: Lens' AppState S.State _searchState :: Lens' AppState S.State
_searchState = lens (\s -> s.searchState) (\s ss -> s{searchState = ss}) _searchState = lens (\s -> s.searchState) (\s ss -> s{searchState = ss})
_graphExplorerState :: Lens' AppState GE.State -- _graphExplorerState :: Lens' AppState GE.State
_graphExplorerState = lens (\s -> s.graphExplorerState) (\s ss -> s{graphExplorerState = ss}) -- _graphExplorerState = lens (\s -> s.graphExplorerState) (\s ss -> s{graphExplorerState = ss})
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