diff --git a/src/Gargantext/Components/Tab.purs b/src/Gargantext/Components/Tab.purs index fb9d66b2135d501329f2dac69f7a98fe015db709..870fb5faae652fa504f50d21e38af539f1398edf 100644 --- a/src/Gargantext/Components/Tab.purs +++ b/src/Gargantext/Components/Tab.purs @@ -9,34 +9,49 @@ import Data.Tuple (Tuple(..)) import React (ReactElement) import React.DOM (a, div, nav, text) import React.DOM.Props (className, onClick) -import Thermite (PerformAction, Render, Spec, _render, modifyState, focus, simpleSpec, withState) +import Thermite ( PerformAction, Render, Spec + , _render, modifyState, focus + , simpleSpec, withState) type State = Int data Action = ChangeTab Int -tabs :: forall state props action . Lens' state State -> Prism' action Action -> List (Tuple String (Spec state props action)) -> Spec state props action +tabs :: forall state props action. + Lens' state State -> Prism' action Action + -> List (Tuple String (Spec state props action)) + -> Spec state props action tabs l p ls = withState \st -> fold - [ focus l p $ simpleSpec performAction (render (activeTab st) ls) - , wrapper $ fold $ mapWithIndex (tab (activeTab st)) ls + [ focus l p $ simpleSpec performAction (render (activeTab st) ls) + , wrapper $ fold $ mapWithIndex ( tab (activeTab st)) ls ] where activeTab = view l wrapper = over _render \render d p s c -> [div [className "tab-content"] $ render d p s c] -tab :: forall state props action. Int -> Int -> Tuple String (Spec state props action) -> Spec state props action +tab :: forall state props action. + Int -> Int -> Tuple String (Spec state props action) + -> Spec state props action tab sid iid (Tuple name spec) = over _render tabRender spec where tabRender renderer d p s c = - [div [ className $ "tab-pane " <> if sid ==iid then " show active" else " fade"] $ renderer d p s c] + [ div [ className $ "tab-pane " <> + if sid ==iid + then " show active" + else " fade"] $ renderer d p s c + ] -performAction :: forall props. PerformAction State props Action -performAction (ChangeTab i) _ _ = void $ modifyState $ const i +performAction :: forall props. + PerformAction State props Action +performAction (ChangeTab i) _ _ = + void $ modifyState $ const i -render :: forall state props action. State -> List (Tuple String (Spec state props action)) -> Render State props Action +render :: forall state props action. + State -> List (Tuple String (Spec state props action)) + -> Render State props Action render at ls d p s c = [ nav [] [ div [className "nav nav-tabs"] @@ -46,4 +61,7 @@ render at ls d p s c = where item :: forall a. Int -> Int -> (Tuple String a) -> ReactElement item sid iid (Tuple name _) = - a [className $ "nav-item nav-link" <> if sid == iid then " active" else "", onClick \e -> d $ ChangeTab iid] [text name] + a [className $ "nav-item nav-link" <> + if sid == iid + then " active" + else "", onClick \e -> d $ ChangeTab iid] [text name] diff --git a/src/Gargantext/Pages/Corpus/Annuaire.purs b/src/Gargantext/Pages/Annuaire.purs similarity index 98% rename from src/Gargantext/Pages/Corpus/Annuaire.purs rename to src/Gargantext/Pages/Annuaire.purs index 6c1d7e1baed400933400f71793bd0915a7521082..3277619057d19cbd823c07348da6165a6c29ef93 100644 --- a/src/Gargantext/Pages/Corpus/Annuaire.purs +++ b/src/Gargantext/Pages/Annuaire.purs @@ -1,4 +1,4 @@ -module Gargantext.Pages.Corpus.Annuaire where +module Gargantext.Pages.Annuaire where import Prelude @@ -20,7 +20,7 @@ import Effect.Aff (Aff) import Gargantext.Config (toUrl, NodeType(..), End(..)) import Gargantext.Config.REST (get) -import Gargantext.Pages.Corpus.User.Users.Types.Types (User(..), HyperData(..)) +import Gargantext.Pages.Annuaire.User.Users.Types.Types (User(..), HyperData(..)) import Gargantext.Utils.DecodeMaybe ((.?|)) import Data.Argonaut (class DecodeJson, decodeJson, (.?)) @@ -99,7 +99,6 @@ render dispatch _ state _ = [ div [className "row"] ] ] ] - , p [] [] , div [] [ text " Filter ", input []] , br' @@ -175,7 +174,6 @@ instance decodeAnnuaireTable :: DecodeJson AnnuaireTable where decodeJson json = do rows <- decodeJson json pure $ AnnuaireTable { annuaireTable : rows} - ------------------------------------------------------------------------ performAction :: PerformAction State {} Action performAction (Load aId) _ _ = do diff --git a/src/Gargantext/Pages/Corpus/User/Brevets.purs b/src/Gargantext/Pages/Annuaire/User/Brevets.purs similarity index 82% rename from src/Gargantext/Pages/Corpus/User/Brevets.purs rename to src/Gargantext/Pages/Annuaire/User/Brevets.purs index 77d29c2fb6cc4679b40ec4426b09dfd732d8f35c..4f9c3579c72b9db6eae2d93fdbcd04f2ca586f8a 100644 --- a/src/Gargantext/Pages/Corpus/User/Brevets.purs +++ b/src/Gargantext/Pages/Annuaire/User/Brevets.purs @@ -1,4 +1,4 @@ -module Gargantext.Pages.Corpus.User.Brevets where +module Gargantext.Pages.Annuaire.User.Brevets where import Prelude import Thermite (Render, Spec, defaultPerformAction, simpleSpec) diff --git a/src/Gargantext/Pages/Annuaire/User/Users.purs b/src/Gargantext/Pages/Annuaire/User/Users.purs new file mode 100644 index 0000000000000000000000000000000000000000..a88321ba8ce2f219ab5a795ff49bddde1f0e0930 --- /dev/null +++ b/src/Gargantext/Pages/Annuaire/User/Users.purs @@ -0,0 +1,7 @@ +module Gargantext.Pages.Annuaire.User.Users + (module Gargantext.Pages.Annuaire.User.Users.Types, + module Gargantext.Pages.Annuaire.User.Users.Specs) + where + +import Gargantext.Pages.Annuaire.User.Users.Types +import Gargantext.Pages.Annuaire.User.Users.Specs diff --git a/src/Gargantext/Pages/Corpus/User/Users/API.purs b/src/Gargantext/Pages/Annuaire/User/Users/API.purs similarity index 84% rename from src/Gargantext/Pages/Corpus/User/Users/API.purs rename to src/Gargantext/Pages/Annuaire/User/Users/API.purs index 937c15b4072209507ce3734290da7ea5f05e7aaa..23077fb040bd034059a0eb7f04cbd4c57f5c3a84 100644 --- a/src/Gargantext/Pages/Corpus/User/Users/API.purs +++ b/src/Gargantext/Pages/Annuaire/User/Users/API.purs @@ -1,4 +1,4 @@ -module Gargantext.Pages.Corpus.User.Users.API where +module Gargantext.Pages.Annuaire.User.Users.API where import Prelude @@ -12,7 +12,7 @@ import Effect.Console (log) import Gargantext.Config (toUrl, NodeType(..), End(..)) import Gargantext.Config.REST (get) -import Gargantext.Pages.Corpus.User.Users.Types (Action(..), State, User, _user) +import Gargantext.Pages.Annuaire.User.Users.Types (Action(..), State, User, _user) import Thermite (PerformAction, modifyState) getUser :: Int -> Aff (Either String User) diff --git a/src/Gargantext/Pages/Annuaire/User/Users/Specs.purs b/src/Gargantext/Pages/Annuaire/User/Users/Specs.purs new file mode 100644 index 0000000000000000000000000000000000000000..fc7bc07198d4fcf4389577ae8cad9731686e4e5c --- /dev/null +++ b/src/Gargantext/Pages/Annuaire/User/Users/Specs.purs @@ -0,0 +1,13 @@ +module Gargantext.Pages.Annuaire.User.Users.Specs + (module Gargantext.Pages.Annuaire.User.Users.Specs.Renders, + layoutUser) + where + +import Gargantext.Pages.Annuaire.User.Users.Specs.Renders + +import Thermite (Spec, simpleSpec) +import Gargantext.Pages.Annuaire.User.Users.Types (Action, State) +import Gargantext.Pages.Annuaire.User.Users.API (performAction) + +layoutUser :: Spec State {} Action +layoutUser = simpleSpec performAction render diff --git a/src/Gargantext/Pages/Corpus/User/Users/Specs/Documents.purs b/src/Gargantext/Pages/Annuaire/User/Users/Specs/Documents.purs similarity index 96% rename from src/Gargantext/Pages/Corpus/User/Users/Specs/Documents.purs rename to src/Gargantext/Pages/Annuaire/User/Users/Specs/Documents.purs index 9ec2f162512c04d2a984c2ecb62ef8a7cd3ca527..10c09e99fe19105484c2732925892e70dcfd2e57 100644 --- a/src/Gargantext/Pages/Corpus/User/Users/Specs/Documents.purs +++ b/src/Gargantext/Pages/Annuaire/User/Users/Specs/Documents.purs @@ -1,4 +1,4 @@ -module Gargantext.Pages.Corpus.User.Users.Specs.Documents where +module Gargantext.Pages.Annuaire.User.Users.Specs.Documents where import Prelude import React.DOM (table, tbody, td, text, th, thead, tr) diff --git a/src/Gargantext/Pages/Corpus/User/Users/Specs/Renders.purs b/src/Gargantext/Pages/Annuaire/User/Users/Specs/Renders.purs similarity index 95% rename from src/Gargantext/Pages/Corpus/User/Users/Specs/Renders.purs rename to src/Gargantext/Pages/Annuaire/User/Users/Specs/Renders.purs index b70270ec4e5d8d062a184dc9e452225dfb2a8517..d414294a48e20501ff1e3f493c3dfb8cd97ffed9 100644 --- a/src/Gargantext/Pages/Corpus/User/Users/Specs/Renders.purs +++ b/src/Gargantext/Pages/Annuaire/User/Users/Specs/Renders.purs @@ -1,7 +1,7 @@ -module Gargantext.Pages.Corpus.User.Users.Specs.Renders +module Gargantext.Pages.Annuaire.User.Users.Specs.Renders where -import Gargantext.Pages.Corpus.User.Users.Types +import Gargantext.Pages.Annuaire.User.Users.Types import Data.Maybe (Maybe(..)) import Data.Tuple (Tuple(..)) diff --git a/src/Gargantext/Pages/Corpus/User/Users/Types.purs b/src/Gargantext/Pages/Annuaire/User/Users/Types.purs similarity index 63% rename from src/Gargantext/Pages/Corpus/User/Users/Types.purs rename to src/Gargantext/Pages/Annuaire/User/Users/Types.purs index 08b8977132a0905cfc65dfc29ed5170ecdb564d7..62c99b264ed25fa5c1b9f96237d792d6f66c7508 100644 --- a/src/Gargantext/Pages/Corpus/User/Users/Types.purs +++ b/src/Gargantext/Pages/Annuaire/User/Users/Types.purs @@ -1,7 +1,7 @@ -module Gargantext.Pages.Corpus.User.Users.Types - (module Gargantext.Pages.Corpus.User.Users.Types.Types, - module Gargantext.Pages.Corpus.User.Users.Types.Lens, - module Gargantext.Pages.Corpus.User.Users.Types.States, +module Gargantext.Pages.Annuaire.User.Users.Types + (module Gargantext.Pages.Annuaire.User.Users.Types.Types, + module Gargantext.Pages.Annuaire.User.Users.Types.Lens, + module Gargantext.Pages.Annuaire.User.Users.Types.States, brevetSpec, projectSpec, facets @@ -10,10 +10,10 @@ module Gargantext.Pages.Corpus.User.Users.Types import Prelude -import Gargantext.Pages.Corpus.User.Users.Types.Lens -import Gargantext.Pages.Corpus.User.Users.Types.Types -import Gargantext.Pages.Corpus.User.Users.Types.States -import Gargantext.Pages.Corpus.User.Brevets as B +import Gargantext.Pages.Annuaire.User.Users.Types.Lens +import Gargantext.Pages.Annuaire.User.Users.Types.Types +import Gargantext.Pages.Annuaire.User.Users.Types.States +import Gargantext.Pages.Annuaire.User.Brevets as B import Data.List (fromFoldable) import Data.Tuple (Tuple(..)) import Gargantext.Components.Tab (tabs) diff --git a/src/Gargantext/Pages/Corpus/User/Users/Types/Lens.purs b/src/Gargantext/Pages/Annuaire/User/Users/Types/Lens.purs similarity index 65% rename from src/Gargantext/Pages/Corpus/User/Users/Types/Lens.purs rename to src/Gargantext/Pages/Annuaire/User/Users/Types/Lens.purs index 32d65cb32bc94def177f30f7407f519f5a5a768b..c8e9c68b98a8ad40d559cd9aae79ad93b2a24cbd 100644 --- a/src/Gargantext/Pages/Corpus/User/Users/Types/Lens.purs +++ b/src/Gargantext/Pages/Annuaire/User/Users/Types/Lens.purs @@ -1,12 +1,12 @@ -module Gargantext.Pages.Corpus.User.Users.Types.Lens where +module Gargantext.Pages.Annuaire.User.Users.Types.Lens where -import Gargantext.Pages.Corpus.User.Brevets as B +import Gargantext.Pages.Annuaire.User.Brevets as B import Data.Either (Either(..)) import Data.Lens (Lens', Prism', lens, prism) import Data.Maybe (Maybe) -import Gargantext.Pages.Corpus.User.Users.Types.States (Action(..), State) -import Gargantext.Pages.Corpus.User.Users.Types.Types (User) -import Gargantext.Pages.Corpus.User.Users.Specs.Documents as P +import Gargantext.Pages.Annuaire.User.Users.Types.States (Action(..), State) +import Gargantext.Pages.Annuaire.User.Users.Types.Types (User) +import Gargantext.Pages.Annuaire.User.Users.Specs.Documents as P import Gargantext.Components.Tab as Tab import Thermite (Spec, noState) diff --git a/src/Gargantext/Pages/Corpus/User/Users/Types/States.purs b/src/Gargantext/Pages/Annuaire/User/Users/Types/States.purs similarity index 57% rename from src/Gargantext/Pages/Corpus/User/Users/Types/States.purs rename to src/Gargantext/Pages/Annuaire/User/Users/Types/States.purs index f437b2e37d9c0fc6d3e6b6f3d54aff9e5a020a33..1f9ba2de3087d7ee8d729225b84ed0c0efc2be5f 100644 --- a/src/Gargantext/Pages/Corpus/User/Users/Types/States.purs +++ b/src/Gargantext/Pages/Annuaire/User/Users/Types/States.purs @@ -1,8 +1,8 @@ -module Gargantext.Pages.Corpus.User.Users.Types.States where +module Gargantext.Pages.Annuaire.User.Users.Types.States where import Data.Maybe (Maybe(..)) -import Gargantext.Pages.Corpus.User.Users.Types.Types (User) -import Gargantext.Pages.Corpus.User.Users.Specs.Documents as P +import Gargantext.Pages.Annuaire.User.Users.Types.Types (User) +import Gargantext.Pages.Annuaire.User.Users.Specs.Documents as P import Gargantext.Components.Tab as Tab data Action diff --git a/src/Gargantext/Pages/Corpus/User/Users/Types/Types.purs b/src/Gargantext/Pages/Annuaire/User/Users/Types/Types.purs similarity index 97% rename from src/Gargantext/Pages/Corpus/User/Users/Types/Types.purs rename to src/Gargantext/Pages/Annuaire/User/Users/Types/Types.purs index aeb240105f950150282c992b1e8e1b1f1efdcb36..bb19d8a0f0b7109769ac2a9d7631a450eec4a9de 100644 --- a/src/Gargantext/Pages/Corpus/User/Users/Types/Types.purs +++ b/src/Gargantext/Pages/Annuaire/User/Users/Types/Types.purs @@ -1,4 +1,4 @@ -module Gargantext.Pages.Corpus.User.Users.Types.Types where +module Gargantext.Pages.Annuaire.User.Users.Types.Types where import Prelude diff --git a/src/Gargantext/Pages/Corpus/Doc/Facets/Documents.purs b/src/Gargantext/Pages/Corpus/Doc/Facets/Documents.purs index f9aa5177f5cc1043898d9d9d8ae1b51391dcdfd2..6e97437c396ce17dc769eff2c7c08c9abcc2f993 100644 --- a/src/Gargantext/Pages/Corpus/Doc/Facets/Documents.purs +++ b/src/Gargantext/Pages/Corpus/Doc/Facets/Documents.purs @@ -17,7 +17,7 @@ import Effect.Aff (Aff) import Effect.Class (liftEffect) import Effect.Console (log) -import Gargantext.Config (NodeType(..), toUrl, End(Back)) +import Gargantext.Config (NodeType(..), toUrl, End(..)) import Gargantext.Config.REST (get) import Gargantext.Utils.DecodeMaybe ((.|)) @@ -165,10 +165,7 @@ layoutDocview = simpleSpec performAction render [thead [ className "thead-dark"] [tr [] [ th [scope "col"] [ b' [text ""] ] , th [scope "col"] [ b' [text "Date"]] - , th [scope "col"] [ b' [text "Name"] ] - --, th [scope "col"] [ b' [text "Title"] ] - --, th [scope "col"] [ b' [text "Source"] ] - , th [scope "col"] [ b' [text "Fonction"] ] + , th [scope "col"] [ b' [text "Title"] ] , th [scope "col"] [ b' [text "Delete"] ] ] ] @@ -272,7 +269,7 @@ showRow {row : (CorpusView c), delete} = [ td [] [div [className $ fa <> "fa-star"][]] -- TODO show date: Year-Month-Day only , td [] [text c.date] - , td [] [ a [ href (toUrl Back Document 1) ] [ text c.title ] ] + , td [] [ a [ href (toUrl Front Document c._id) ] [ text c.title ] ] , td [] [text c.source] , td [] [input [ _type "checkbox"]] ] diff --git a/src/Gargantext/Pages/Corpus/User/Users.purs b/src/Gargantext/Pages/Corpus/User/Users.purs deleted file mode 100644 index caefe67a0f7f639d54823ec89fca5a4afa6771f4..0000000000000000000000000000000000000000 --- a/src/Gargantext/Pages/Corpus/User/Users.purs +++ /dev/null @@ -1,7 +0,0 @@ -module Gargantext.Pages.Corpus.User.Users - (module Gargantext.Pages.Corpus.User.Users.Types, - module Gargantext.Pages.Corpus.User.Users.Specs) - where - -import Gargantext.Pages.Corpus.User.Users.Types -import Gargantext.Pages.Corpus.User.Users.Specs diff --git a/src/Gargantext/Pages/Corpus/User/Users/Specs.purs b/src/Gargantext/Pages/Corpus/User/Users/Specs.purs deleted file mode 100644 index e3ed1cd4e805ebc36e3fe892d95c5f805b840a00..0000000000000000000000000000000000000000 --- a/src/Gargantext/Pages/Corpus/User/Users/Specs.purs +++ /dev/null @@ -1,13 +0,0 @@ -module Gargantext.Pages.Corpus.User.Users.Specs - (module Gargantext.Pages.Corpus.User.Users.Specs.Renders, - layoutUser) - where - -import Gargantext.Pages.Corpus.User.Users.Specs.Renders - -import Thermite (Spec, simpleSpec) -import Gargantext.Pages.Corpus.User.Users.Types (Action, State) -import Gargantext.Pages.Corpus.User.Users.API (performAction) - -layoutUser :: Spec State {} Action -layoutUser = simpleSpec performAction render diff --git a/src/Gargantext/Pages/Layout.purs b/src/Gargantext/Pages/Layout.purs index 67bc3792a1183400e25ff7d026f1354dd933b2aa..f53901ec87a7c852c336eb848b1b8f762653cb63 100644 --- a/src/Gargantext/Pages/Layout.purs +++ b/src/Gargantext/Pages/Layout.purs @@ -11,8 +11,8 @@ import Gargantext.Pages.Corpus.Doc.Facets.Documents as DV import Gargantext.Pages.Corpus.Doc.Facets.Graph as GE -- import Gargantext.Pages.Corpus.Doc.Facets.Terms.NgramsTable as NG -import Gargantext.Pages.Corpus.User.Users as U -import Gargantext.Pages.Corpus.Annuaire as Annuaire +import Gargantext.Pages.Annuaire.User.Users as U +import Gargantext.Pages.Annuaire as Annuaire -- import Gargantext.Pages.Home as L -- import Gargantext.Pages.Layout.Specs.Search as S import Gargantext.Router (Routes(..)) @@ -39,6 +39,10 @@ dispatchAction dispatcher _ (DocView n) = do dispatcher $ SetRoute (DocView n) dispatcher $ DocViewA $ DV.LoadData n +dispatchAction dispatcher _ (Corpus n) = do + dispatcher $ SetRoute $ Corpus n + dispatcher $ DocViewA $ DV.LoadData n + dispatchAction dispatcher _ SearchView = do dispatcher $ SetRoute SearchView -- dispatcher $ SearchA TODO @@ -63,10 +67,6 @@ dispatchAction dispatcher _ Tabview = do dispatcher $ SetRoute Tabview -- dispatcher $ TabViewA TODO -dispatchAction dispatcher _ (Corpus n) = do - dispatcher $ SetRoute $ Corpus n - dispatcher $ DocViewA $ DV.LoadData n - dispatchAction dispatcher _ PGraphExplorer = do dispatcher $ SetRoute PGraphExplorer dispatcher $ GraphExplorerA $ GE.LoadGraph "imtNew.json" diff --git a/src/Gargantext/Pages/Layout/Actions.purs b/src/Gargantext/Pages/Layout/Actions.purs index 42e8af7b3c5c2822fac67907992afa1ba38f2090..bf3acc8ee17a48211d88aeaebe02d802f2bff036 100644 --- a/src/Gargantext/Pages/Layout/Actions.purs +++ b/src/Gargantext/Pages/Layout/Actions.purs @@ -15,8 +15,8 @@ import Gargantext.Components.Tree as Tree import Gargantext.Pages.Corpus.Doc.Annotation as D import Gargantext.Pages.Corpus.Doc.Facets.Documents as DV import Gargantext.Pages.Corpus.Doc.Facets.Graph as GE -import Gargantext.Pages.Corpus.User.Users as U -import Gargantext.Pages.Corpus.Annuaire as Annuaire +import Gargantext.Pages.Annuaire.User.Users as U +import Gargantext.Pages.Annuaire as Annuaire import Gargantext.Pages.Layout.Specs.AddCorpus as AC import Gargantext.Pages.Layout.Specs.Search as S import Gargantext.Pages.Layout.States (AppState) @@ -53,6 +53,8 @@ performAction (ShowLogin) _ _ = void do liftEffect $ modalShow "loginModal" modifyState $ _ {showLogin = true} +--------------------------------------------------------- +-- TODO chose one of them performAction (ShowAddcorpus) _ _ = void do liftEffect $ modalShow "addCorpus" modifyState $ _ {showCorpus = true} @@ -62,6 +64,7 @@ performAction Go _ _ = void do modifyState $ _ {showCorpus = true} -- _ <- lift $ setHash "/addCorpus" --modifyState id +--------------------------------------------------------- performAction Initialize _ state = void do _ <- liftEffect $ log "loading Initial nodes" diff --git a/src/Gargantext/Pages/Layout/Specs.purs b/src/Gargantext/Pages/Layout/Specs.purs index d2069d39ae24eca4b814095820550cf979f3a08a..536b668513f660a2139211f74563bd5a58b82fd7 100644 --- a/src/Gargantext/Pages/Layout/Specs.purs +++ b/src/Gargantext/Pages/Layout/Specs.purs @@ -9,16 +9,16 @@ import Effect (Effect) import Gargantext.Components.Data.Lang (Lang(..)) import Gargantext.Components.Login as LN import Gargantext.Components.Tree as Tree -import Gargantext.Pages.Corpus.Annuaire as A +import Gargantext.Pages.Annuaire as A import Gargantext.Folder as F -import Gargantext.Pages.Corpus as CA +import Gargantext.Pages.Corpus as Corpus import Gargantext.Pages.Corpus.Doc.Annotation as Annotation import Gargantext.Pages.Corpus.Doc.Facets as TV import Gargantext.Pages.Corpus.Doc.Facets.Dashboard as Dsh import Gargantext.Pages.Corpus.Doc.Facets.Documents as DV import Gargantext.Pages.Corpus.Doc.Facets.Graph as GE import Gargantext.Pages.Corpus.Doc.Facets.Terms.NgramsTable as NG -import Gargantext.Pages.Corpus.User.Users as U +import Gargantext.Pages.Annuaire.User.Users as U import Gargantext.Pages.Home as L import Gargantext.Pages.Layout.Actions (Action(..), _addCorpusAction, _docAnnotationViewAction, _docViewAction, _graphExplorerAction, _loginAction, _searchAction, _treeAction, _userPageAction, performAction, _annuaireAction) import Gargantext.Pages.Layout.Specs.AddCorpus as AC @@ -62,8 +62,8 @@ pagesComponent s = selectSpec (UserPage i) = layout0 $ focus _userPageState _userPageAction U.layoutUser selectSpec (DocAnnotation i) = layout0 $ focus _docAnnotationViewState _docAnnotationViewAction Annotation.docview - selectSpec Tabview = layout0 $ noState TV.pureTab1 -- To be removed + selectSpec Tabview = layout0 $ noState TV.pureTab1 selectSpec SearchView = layout0 $ focus _searchState _searchAction S.searchSpec selectSpec NGramsTable = layout0 $ noState NG.ngramsTableSpec selectSpec PGraphExplorer = focus _graphExplorerState _graphExplorerAction GE.specOld diff --git a/src/Gargantext/Pages/Layout/States.purs b/src/Gargantext/Pages/Layout/States.purs index 61f434c0260ddb9d2918f80b64a2aa958dc3777d..c076124fb8374019543369c629d40e98f9ea6e26 100644 --- a/src/Gargantext/Pages/Layout/States.purs +++ b/src/Gargantext/Pages/Layout/States.purs @@ -7,10 +7,10 @@ import Data.Maybe (Maybe(Just)) import Gargantext.Components.Login as LN import Gargantext.Components.Tree as Tree import Gargantext.Pages.Corpus.Doc.Annotation as D -import Gargantext.Pages.Corpus.Annuaire as Annuaire +import Gargantext.Pages.Annuaire as Annuaire import Gargantext.Pages.Corpus.Doc.Facets.Documents as DV import Gargantext.Pages.Corpus.Doc.Facets.Graph as GE -import Gargantext.Pages.Corpus.User.Users as U +import Gargantext.Pages.Annuaire.User.Users as U import Gargantext.Pages.Layout.Specs.AddCorpus as AC import Gargantext.Pages.Layout.Specs.Search as S import Gargantext.Router (Routes(..)) diff --git a/src/Gargantext/Router.purs b/src/Gargantext/Router.purs index 2a31081f7fe09acf55eeb6f4c1047b9dba230513..13035905030a650decc043d4c1c5bd8e3f3ba6a8 100644 --- a/src/Gargantext/Router.purs +++ b/src/Gargantext/Router.purs @@ -33,17 +33,17 @@ data Routes instance showRoutes :: Show Routes where show Login = "Login" show AddCorpus = "AddCorpus" - show (DocView i) = "DocView" show SearchView = "Search" - show (UserPage i) = "User" <> show i + show (UserPage i) = "User" <> show i show (DocAnnotation i)= "Document" + show (Corpus i) = "Corpus" <> show i show Tabview = "Tabview" - show PGraphExplorer = "graphExplorer" + show (DocView i) = "DocView" show NGramsTable = "NGramsTable" - show Dashboard = "Dashboard" - show (Corpus i) = "Corpus" <> show i show (Annuaire i) = "Annuaire" <> show i show (Folder i) = "Folder" <> show i + show Dashboard = "Dashboard" + show PGraphExplorer = "graphExplorer" show Home = "Home" int :: Match Int @@ -68,14 +68,18 @@ routing = where route str = lit "" *> lit str -routeHandler :: (Maybe Routes -> Routes -> Effect Unit) -> Maybe Routes -> Routes -> Effect Unit +routeHandler :: (Maybe Routes -> Routes -> Effect Unit) + -> Maybe Routes -> Routes -> Effect Unit routeHandler dispatchAction old new = do liftEffect $ log $ "change route : " <> show new + w <- window ls <- localStorage w token <- getItem "accessToken" ls let tkn = token + liftEffect $ log $ "JWToken : " <> show tkn + case tkn of Nothing -> do dispatchAction old new diff --git a/src/Gargantext/Utils/DecodeMaybe.purs b/src/Gargantext/Utils/DecodeMaybe.purs index 3df8b05b057a39b430c0328be160f6daf74a8fca..95aea6075c6384f2c1b63dc808d916bf5eecf769 100644 --- a/src/Gargantext/Utils/DecodeMaybe.purs +++ b/src/Gargantext/Utils/DecodeMaybe.purs @@ -9,7 +9,8 @@ import Foreign.Object (Object) foreign import isNull :: forall a. a -> Boolean -getFieldOptional' :: forall a. DecodeJson a => Object Json -> String -> Either String (Maybe a) +getFieldOptional' :: forall a. DecodeJson a => + Object Json -> String -> Either String (Maybe a) getFieldOptional' o s = (case _ of Just v -> if isNull v then Nothing else v Nothing -> Nothing @@ -17,7 +18,9 @@ getFieldOptional' o s = (case _ of infix 7 getFieldOptional' as .?| -getFieldOptionalAsMempty :: forall a. DecodeJson a => Monoid a => Object Json -> String -> Either String a -getFieldOptionalAsMempty o s = fromMaybe mempty <$> (getFieldOptional' o s) +getFieldOptionalAsMempty :: forall a. DecodeJson a => + Monoid a => Object Json -> String -> Either String a +getFieldOptionalAsMempty o s = + fromMaybe mempty <$> (getFieldOptional' o s) infix 7 getFieldOptionalAsMempty as .|