diff --git a/src/DecodeMaybe.js b/src/DecodeMaybe.js new file mode 100644 index 0000000000000000000000000000000000000000..1f88a9e0d9c03b3af2daa0127e5949016108f951 --- /dev/null +++ b/src/DecodeMaybe.js @@ -0,0 +1,5 @@ +'use strict'; + +exports.isNull = function(v) { + return v === null; +}; diff --git a/src/DecodeMaybe.purs b/src/DecodeMaybe.purs new file mode 100644 index 0000000000000000000000000000000000000000..afc5fb28166ae1679430948d9886e4c765e185af --- /dev/null +++ b/src/DecodeMaybe.purs @@ -0,0 +1,17 @@ +module DecodeMaybe where + +import Prelude + +import Data.Argonaut (class DecodeJson, JObject, getFieldOptional) +import Data.Either (Either) +import Data.Maybe (Maybe(..)) + +foreign import isNull :: forall a. a -> Boolean + +getFieldOptional' :: forall a. DecodeJson a => JObject -> String -> Either String (Maybe a) +getFieldOptional' o s = (case _ of + Just v -> if isNull v then Nothing else v + Nothing -> Nothing + ) <$> (getFieldOptional o s) + +infix 7 getFieldOptional' as .?| diff --git a/src/Gargantext/REST.purs b/src/Gargantext/REST.purs index 13f925fc77fccd9f1b5cd048ea5dd542af7f1717..7589699bf7a364b64eb10a45cf4f63b918430659 100644 --- a/src/Gargantext/REST.purs +++ b/src/Gargantext/REST.purs @@ -15,8 +15,8 @@ import Data.Either (Either(..)) import Network.HTTP.Affjax (AJAX, affjax, defaultRequest) -get :: forall eff t2 t31. DecodeJson t31 => String -> - Aff ( console :: CONSOLE, ajax :: AJAX| eff) +get :: forall eff t2 t31. DecodeJson t31 => String -> + Aff (console :: CONSOLE, ajax :: AJAX| eff) (Either String t31) get url = do affResp <- liftAff $ attempt $ affjax defaultRequest diff --git a/src/Gargantext/Users.purs b/src/Gargantext/Users.purs new file mode 100644 index 0000000000000000000000000000000000000000..8c620521d1dffccf976e71340c0da8012abbb268 --- /dev/null +++ b/src/Gargantext/Users.purs @@ -0,0 +1,7 @@ +module Gargantext.Users + (module Gargantext.Users.Types, + module Gargantext.Users.Specs) + where + +import Gargantext.Users.Types +import Gargantext.Users.Specs diff --git a/src/Gargantext/Users/API.purs b/src/Gargantext/Users/API.purs new file mode 100644 index 0000000000000000000000000000000000000000..7ab40e260c0c6aebb4d265838a043e17fc8b0f5a --- /dev/null +++ b/src/Gargantext/Users/API.purs @@ -0,0 +1,38 @@ +module Gargantext.Users.API + where + +import Gargantext.Users.Types + +import Control.Monad.Aff (Aff) +import Control.Monad.Aff.Console (CONSOLE, log) +import Control.Monad.Trans.Class (lift) +import DOM (DOM) +import Data.Either (Either(..)) +import Data.Lens (set) +import Data.Maybe (Maybe(..)) +import Gargantext.REST (get) +import Network.HTTP.Affjax (AJAX) +import Prelude (bind, id, show, void, ($), (<<<), (<>)) +import Thermite (PerformAction, modifyState) + +getUser :: forall eff. Int -> Aff + (console :: CONSOLE, ajax :: AJAX | eff) (Either String User) +getUser id = get $ "http://localhost:8008/node/" <> show id + + +performAction :: forall eff props. PerformAction ( console :: CONSOLE + , ajax :: AJAX + , dom :: DOM + | eff ) State props Action +performAction NoOp _ _ = void do + modifyState id +performAction (FetchUser userId) _ _ = void do + value <- lift $ getUser userId + _ <- case value of + (Right user) -> modifyState \state -> set _user (Just user) state + (Left err) -> do + _ <- lift $ log err + modifyState id + lift <<< log $ "Fetching user..." +performAction _ _ _ = void do + modifyState id diff --git a/src/Gargantext/Users/Specs.purs b/src/Gargantext/Users/Specs.purs new file mode 100644 index 0000000000000000000000000000000000000000..6da6616c0acc5d20be75ca3cffacf3d7ca0d453b --- /dev/null +++ b/src/Gargantext/Users/Specs.purs @@ -0,0 +1,20 @@ +module Gargantext.Users.Specs + (module Gargantext.Users.Specs.Renders, + layoutUser) + where + +import Gargantext.Users.Specs.Renders + +import Control.Monad.Aff.Console (CONSOLE) +import DOM (DOM) +import Network.HTTP.Affjax (AJAX) +import Thermite (Spec, simpleSpec) +import Gargantext.Users.Types (Action, State) +import Gargantext.Users.API (performAction) + +layoutUser :: forall props eff . Spec ( console :: CONSOLE + , ajax :: AJAX + , dom :: DOM + | eff + ) State props Action +layoutUser = simpleSpec performAction render diff --git a/src/Gargantext/Users/Specs/Renders.purs b/src/Gargantext/Users/Specs/Renders.purs new file mode 100644 index 0000000000000000000000000000000000000000..259969b503324a81e07fd6cafeec1a0e5c5f4b4b --- /dev/null +++ b/src/Gargantext/Users/Specs/Renders.purs @@ -0,0 +1,81 @@ +module Gargantext.Users.Specs.Renders + where + +import Gargantext.Users.Types + +import Data.Maybe (Maybe(..)) +import Data.Tuple (Tuple(..)) +import Prelude (($), (<<<)) +import React (ReactElement) +import React.DOM (button, div, h4, li, span, text, ul) +import React.DOM.Props (_id, className) +import React.DOM.Props as RP +import Thermite (Render) + + +infoRender :: forall props. Tuple String String -> Array ReactElement +infoRender (Tuple title content) = + [ + span [className "font-weight-bold text-primary"] [text title], + span [className "pull-right"] [text content] + ] + +listElement :: forall props. Array ReactElement -> ReactElement +listElement = li [className "list-group-item justify-content-between"] + +card :: forall props. String -> Array ReactElement -> Array ReactElement +card title elems = + [ + div [className "card"] + [ + div [className "card-header text-white bg-primary"] + [ + h4 [] [text title] + ], + div [className "card-body"] + elems + ] + ] + +userInfos :: HyperData -> ReactElement +userInfos (HyperData user) = + ul [className "list-group"] + [ + listElement <<< infoRender <<< Tuple "Fonction: " $ checkMaybe user.fonction + , listElement <<< infoRender <<< Tuple "Entité, service: " $ checkMaybe user.entite + , listElement <<< infoRender <<< Tuple "Téléphone: " $ checkMaybe user.atel + , listElement <<< infoRender <<< Tuple "Courriel: " $ checkMaybe user.mail + , listElement <<< infoRender <<< Tuple "Bureau: " $ checkMaybe user.bureau + , listElement <<< infoRender <<< Tuple "Appelation: " $ checkMaybe user.fonction + , listElement <<< infoRender $ Tuple "Lieu: " $ checkMaybe user.lieu + ] + where checkMaybe (Nothing) = "" + checkMaybe (Just a) = a + +pbInfos :: ReactElement +pbInfos = + ul [className "list-group"] + [ + listElement <<< infoRender $ Tuple "" "https://www.imt.fr/en/" + , listElement <<< infoRender $ Tuple "" "https://www.imt.fr/en/" + , listElement <<< infoRender $ Tuple "" "https://www.imt.fr/en/" + ] + +render :: forall props. Render State props Action +render dispatch _ state _ = + [ + div [className "container-fluid"] + [ + div [className "row", _id "user-page-info"] + [ + div [className "row"] + [ + button [RP.onClick \_ -> dispatch $ FetchUser 452145] [ text "Fetch User"], + div [className "col-md-8"] + $ case state.user of + (Just (User user)) -> card user.name [userInfos user.hyperdata] + Nothing -> card "Aucun utilisateur" [] + ] + ] + ] + ] diff --git a/src/Gargantext/Users/Types.purs b/src/Gargantext/Users/Types.purs new file mode 100644 index 0000000000000000000000000000000000000000..dd5cdeecffb4eef973cd8a10d0db8b4536507e4f --- /dev/null +++ b/src/Gargantext/Users/Types.purs @@ -0,0 +1,38 @@ +module Gargantext.Users.Types + (module Gargantext.Users.Types.Types, + module Gargantext.Users.Types.Lens, + module Gargantext.Users.Types.States, + brevetSpec, + projectSpec, + facets + ) + where + +import Gargantext.Users.Types.Lens +import Gargantext.Users.Types.Types +import Gargantext.Users.Types.States + +import Brevets as B +import Control.Monad.Aff.Console (CONSOLE) +import DOM (DOM) +import Data.List (fromFoldable) +import Data.Tuple (Tuple(..)) +import Network.HTTP.Affjax (AJAX) +import Prelude (($)) +import Projects as PS +import Tab (tabs) +import Thermite (Spec, focus) + +brevetSpec :: forall eff props. Spec (dom :: DOM, console::CONSOLE, ajax :: AJAX | eff) State props Action +brevetSpec = focus _brevetslens _brevetsAction B.brevetsSpec + +projectSpec :: forall eff props. Spec (dom :: DOM, console :: CONSOLE, ajax :: AJAX | eff) State props Action +projectSpec = focus _projectslens _projectsAction PS.projets + + +facets :: forall eff props. Spec ( dom :: DOM, console :: CONSOLE, ajax :: AJAX| eff) State props Action +facets = tabs _tablens _tabAction $ fromFoldable + [ Tuple "Publications(12)" publicationSpec + , Tuple "Brevets (2)" brevetSpec + , Tuple "Projets IMT (5)" projectSpec + ] diff --git a/src/Gargantext/Users/Types/Lens.purs b/src/Gargantext/Users/Types/Lens.purs new file mode 100644 index 0000000000000000000000000000000000000000..e8f3be697c41f130eef8d46348e38f6646d34f7c --- /dev/null +++ b/src/Gargantext/Users/Types/Lens.purs @@ -0,0 +1,57 @@ +module Gargantext.Users.Types.Lens where + +import Brevets as B +import Control.Monad.Aff.Console (CONSOLE) +import DOM (DOM) +import Data.Either (Either(..)) +import Data.Lens (Lens', Prism', lens, prism) +import Data.Maybe (Maybe) +import Gargantext.Users.Types.States (Action(..), State) +import Gargantext.Users.Types.Types (User) +import Network.HTTP.Affjax (AJAX) +import Projects as PS +import Publications as P +import Tab as Tab +import Thermite (Spec, focus) + +_user :: Lens' State (Maybe User) +_user = lens (\s -> s.user) (\s ss -> s{user = ss}) + +_tablens :: Lens' State Tab.State +_tablens = lens (\s -> s.activeTab) (\s ss -> s {activeTab = ss}) + +_tabAction :: Prism' Action Tab.Action +_tabAction = prism TabA \ action -> + case action of + TabA laction -> Right laction + _-> Left action + +_publens :: Lens' State P.State +_publens = lens (\s -> s.publications) (\s ss -> s { publications= ss}) + +_pubAction :: Prism' Action P.Action +_pubAction = prism PublicationA \ action -> + case action of + PublicationA laction -> Right laction + _-> Left action + +publicationSpec :: forall eff props. Spec (dom :: DOM, console :: CONSOLE, ajax :: AJAX | eff) State props Action +publicationSpec = focus _publens _pubAction P.publicationSpec + +_brevetslens :: Lens' State B.State +_brevetslens = lens (\s -> s.brevets) (\s ss -> s {brevets = ss}) + +_brevetsAction :: Prism' Action B.Action +_brevetsAction = prism BrevetsA \ action -> + case action of + BrevetsA laction -> Right laction + _-> Left action + +_projectslens :: Lens' State PS.State +_projectslens = lens (\s -> s.projects) (\s ss -> s {projects = ss}) + +_projectsAction :: Prism' Action PS.Action +_projectsAction = prism ProjectsA \ action -> + case action of + ProjectsA laction -> Right laction + _-> Left action diff --git a/src/Gargantext/Users/Types/States.purs b/src/Gargantext/Users/Types/States.purs new file mode 100644 index 0000000000000000000000000000000000000000..a8988d41cc47eb7bf11fc089c1a0afbabb318427 --- /dev/null +++ b/src/Gargantext/Users/Types/States.purs @@ -0,0 +1,35 @@ +module Gargantext.Users.Types.States + where + +import Brevets as B +import Data.Maybe (Maybe(..)) +import Gargantext.Users.Types.Types (User) +import Projects as PS +import Publications as P +import Tab as Tab + +data Action + = NoOp + | PublicationA P.Action + | BrevetsA B.Action + | ProjectsA PS.Action + | TabA Tab.Action + | FetchUser Int + +type State = + { activeTab :: Int + , publications :: P.State + , brevets :: B.State + , projects :: PS.State + , user :: Maybe User + } + +initialState :: State +initialState = + { activeTab : 0 + , publications : P.initialState + , brevets : B.initialState + , projects : PS.initialState + , user: Nothing + } + diff --git a/src/Gargantext/Users/Types/Types.purs b/src/Gargantext/Users/Types/Types.purs new file mode 100644 index 0000000000000000000000000000000000000000..3813aa90a0dbaafe54dffe1c9fc681ba3b472896 --- /dev/null +++ b/src/Gargantext/Users/Types/Types.purs @@ -0,0 +1,81 @@ +module Gargantext.Users.Types.Types where +import Data.Argonaut (class DecodeJson, decodeJson, (.?)) +import Data.Generic (class Generic) +import Data.Maybe (Maybe) +import Prelude (bind, pure, ($)) +import DecodeMaybe + +newtype User = + User { + id ::Int, + typename :: Maybe Int, + userId ::Int, + parentId :: Int, + name :: String, + date ::Maybe String, + hyperdata :: HyperData + } + +newtype HyperData = + HyperData + { + bureau ::Maybe String, + atel ::Maybe String, + fax ::Maybe String, + aprecision ::Maybe String, + service ::Maybe String, + service2 ::Maybe String, + groupe ::Maybe String, + lieu ::Maybe String, + pservice ::Maybe String, + date_modification ::Maybe String, + fonction ::Maybe String, + pfonction ::Maybe String, + url ::Maybe String, + prenom ::Maybe String, + nom ::Maybe String, + idutilentite ::Maybe String, + afonction ::Maybe String, + grprech ::Maybe String, + entite ::Maybe String, + entite2 ::Maybe String, + mail :: Maybe String + } + +instance decodeUserHyperData :: DecodeJson HyperData where + decodeJson json = do + obj <- decodeJson json + bureau <- obj .?| "bureau" + atel <- obj .?| "atel" + fax <- obj .?| "fax" + aprecision <- obj .?| "aprecision" + service <- obj .?| "service" + service2 <- obj .?| "service2" + groupe <- obj .?| "groupe" + lieu <- obj .?| "lieu" + pservice <- obj .?| "pservice" + date_modification <- obj .?| "date_modification" + fonction <- obj .?| "fonction" + pfonction <- obj .?| "pfonction" + url <- obj .?| "url" + prenom <- obj .?| "prenom" + nom <- obj .?| "nom" + idutilentite <- obj .?| "idutilentite" + afonction <- obj .?| "afonction" + grprech <- obj .?| "grprech" + entite <- obj .?| "entite" + entite2 <- obj .?| "entite2" + mail <- obj .?| "mail" + pure $ HyperData {bureau, atel, fax, aprecision, service, service2, groupe, lieu, pservice, date_modification, fonction, pfonction, url, prenom, nom, idutilentite, afonction, grprech, entite, entite2, mail} + +instance decodeUser :: DecodeJson User where + decodeJson json = do + obj <- decodeJson json + id <- obj .? "id" + typename <- obj .?| "typename" + userId <- obj .? "userId" + parentId <- obj .? "parentId" + name <- obj .? "name" + date <- obj .?| "date" + hyperdata <- obj .? "hyperdata" + pure $ User {id, typename, userId, parentId, name, date, hyperdata} diff --git a/src/Landing.purs b/src/Landing.purs index ed1d33e47426258985083f647d48325ee5e7f96e..79b203bdbd7df37154e7aa1e8f56c601bd439f5b 100644 --- a/src/Landing.purs +++ b/src/Landing.purs @@ -1,23 +1,22 @@ module Landing where +import Gargantext.Data.Landing +import Gargantext.Data.Lang +import Prelude hiding (div) + import Control.Monad.Cont.Trans (lift) import Control.Monad.Eff.Console (CONSOLE) import DOM (DOM) +import Gargantext.Lang.Landing.EnUS as En +import Gargantext.Lang.Landing.FrFR as Fr import Network.HTTP.Affjax (AJAX) -import Prelude hiding (div) +import React (ReactElement) import React.DOM (a, button, div, footer, h1, h3, hr, i, img, li, p, span, text, ul) import React.DOM.Props (Props, _data, _id, aria, className, href, onClick, role, src, style, tabIndex, target, title) -import React (ReactElement) import Routing.Hash.Aff (setHash) import Thermite (PerformAction, Render, Spec, simpleSpec) import Thermite as T -import Gargantext.Data.Landing -import Gargantext.Data.Lang - -import Gargantext.Lang.Landing.EnUS as En -import Gargantext.Lang.Landing.FrFR as Fr - newtype State = State { userName :: String , password :: String diff --git a/src/Navigation.purs b/src/Navigation.purs index cac2e8f4e7f8d334d6f0aa98284d434673c1c345..09003882ca327356b28607ccb091bc8daecb91ce 100644 --- a/src/Navigation.purs +++ b/src/Navigation.purs @@ -36,7 +36,8 @@ import SearchForm as S import Tabview as TV import Thermite (PerformAction, Render, Spec, _render, cotransform, defaultPerformAction, defaultRender, focus, modifyState, simpleSpec, withState) import Unsafe.Coerce (unsafeCoerce) -import UserPage as UP +--import UserPage as UP +import Gargantext.Users as U import NgramsTable as NG import Gargantext.Dashboard as Dsh import Graph as GE @@ -51,7 +52,7 @@ type AppState = , addCorpusState :: AC.State , docViewState :: DV.State , searchState :: S.State - , userPage :: UP.State + , userPage :: U.State , docAnnotationView :: D.State , ntreeView :: NT.State , tabview :: TV.State @@ -73,7 +74,7 @@ initAppState = , addCorpusState : AC.initialState , docViewState : DV.tdata , searchState : S.initialState - , userPage : UP.initialState + , userPage : U.initialState , docAnnotationView : D.initialState , ntreeView : NT.exampleTree , tabview : TV.initialState @@ -95,7 +96,7 @@ data Action | AddCorpusA AC.Action | DocViewA DV.Action | SearchA S.Action - | UserPageA UP.Action + | UserPageA U.Action | DocAnnotationViewA D.Action | TreeViewA NT.Action | TabViewA TV.Action @@ -224,11 +225,11 @@ _searchAction = prism SearchA \action -> _-> Left action -_userPageState :: Lens' AppState UP.State +_userPageState :: Lens' AppState U.State _userPageState = lens (\s -> s.userPage) (\s ss -> s{userPage = ss}) -_userPageAction :: Prism' Action UP.Action +_userPageAction :: Prism' Action U.Action _userPageAction = prism UserPageA \action -> case action of UserPageA caction -> Right caction @@ -323,7 +324,7 @@ pagesComponent s = selectSpec Home = layout0 $ focus _landingState _landingAction (L.layoutLanding EN) selectSpec AddCorpus = layout0 $ focus _addCorpusState _addCorpusAction AC.layoutAddcorpus selectSpec DocView = layout0 $ focus _docViewState _docViewAction DV.layoutDocview - selectSpec UserPage = layout0 $ focus _userPageState _userPageAction UP.layoutUser + selectSpec UserPage = layout0 $ focus _userPageState _userPageAction U.layoutUser selectSpec (DocAnnotation i) = layout0 $ focus _docAnnotationViewState _docAnnotationViewAction D.docview selectSpec Tabview = layout0 $ focus _tabviewState _tabviewAction TV.tab1 -- To be removed @@ -639,7 +640,7 @@ dispatchAction dispatcher _ SearchView = do dispatchAction dispatcher _ UserPage = do _ <- dispatcher $ SetRoute $ UserPage - _ <- dispatcher $ UserPageA $ UP.NoOp + _ <- dispatcher $ UserPageA $ U.NoOp pure unit dispatchAction dispatcher _ (DocAnnotation i) = do diff --git a/src/UserPage.purs b/src/UserPage.purs deleted file mode 100644 index c279e8a2032b4c47e5eafecfc2722148b5667569..0000000000000000000000000000000000000000 --- a/src/UserPage.purs +++ /dev/null @@ -1,198 +0,0 @@ -module UserPage where - -import Tab - -import Brevets as B -import Control.Monad.Eff.Console (CONSOLE) -import DOM (DOM) -import Data.Either (Either(..)) -import Data.Lens (Lens', Prism', lens, prism) -import Data.List (fromFoldable) -import Data.Tuple (Tuple(..)) -import DocView as DV -import Network.HTTP.Affjax (AJAX) -import Prelude hiding (div) -import Projects as PS -import Publications as P -import React.DOM (a, div, h3, h5, h6, i, img, li, nav, small, span, table, tbody, td, text, th, thead, tr, ul) -import React.DOM.Props (_data, _id, aria, className, href, role, scope, src) -import Tab as Tab -import Thermite (PerformAction, Render, Spec, focus, modifyState, simpleSpec) - -type State = - { activeTab :: Int - , publications :: P.State - , brevets :: B.State - , projects :: PS.State - } - - -initialState :: State -initialState = - { activeTab : 0 - , publications : P.initialState - , brevets : B.initialState - , projects : PS.initialState - } - -data Action - = NoOp - | PublicationA P.Action - | BrevetsA B.Action - | ProjectsA PS.Action - | TabA Tab.Action - - -performAction :: forall eff props. PerformAction ( console :: CONSOLE - , ajax :: AJAX - , dom :: DOM - | eff ) State props Action -performAction NoOp _ _ = void do - modifyState id - - -performAction _ _ _ = void do - modifyState id - - - - -layoutUser :: forall props eff . Spec ( console :: CONSOLE - , ajax :: AJAX - , dom :: DOM - | eff - ) State props Action -layoutUser = simpleSpec performAction render - where - render :: Render State props Action - render dispatch _ state _ = - [ - div [className "container-fluid"] - [ div [className "row", _id "user-page-header"] - [ div [className "col-md-2"] - [ h3 [] [text "User Name"] - ] - , div [className "col-md-8"] [] - , div [className "col-md-2"] - [ span [] [text ""] - ] - ] - , div [className "row", _id "user-page-info"] - [ - div [className "col-md-12"] - [ div [className "row"] - [ div [className "col-md-2"] - [ img [src "/images/Gargantextuel-212x300.jpg"] [] - ] - , div [className "col-md-1"] [] - , div [className "col-md-8"] - [ - ul [className "list-group"] - [ - li [className "list-group-item justify-content-between"] - [ span [] [text "Fonction"] - , span [className "badge badge-default badge-pill"] [text "Enseignant chercheur"] - ] - , li [className "list-group-item justify-content-between"] - [ span [] [text "Entité, service"] - , span [className "badge badge-default badge-pill"] [text "Mines Saint-Etienne SPIN -PTSI"] - ] - - , li [className "list-group-item justify-content-between"] - [ span [] [text "Téléphone"] - , span [className "badge badge-default badge-pill"] [text "(+33) 04 77 42 0070"] - ] - , li [className "list-group-item justify-content-between"] - [ span [] [text "Courriel"] - , span [className "badge badge-default badge-pill"] [text "gargantua@rabelais.fr"] - ] - , li [className "list-group-item justify-content-between"] - [ span [] [text "Bureau"] - , span [className "badge badge-default badge-pill"] [text "D1/10"] - ] - , li [className "list-group-item justify-content-between"] - [ span [] [text "Apellation"] - , span [className "badge badge-default badge-pill"] [text "Maître de conférences (EPA)"] - ] - , li [className "list-group-item justify-content-between"] - [ span [] [text "Lieu"] - , span [className "badge badge-default badge-pill"] [text "Saint-Etienne, 158 Cours Fauriel"] - ] - - ] - ] - ] - ] - ] - , div [className "row",_id "user-page-footer"] - [ div [className "col-md-12"] - [] - - ] - ] - ] - - - -_tablens :: Lens' State Tab.State -_tablens = lens (\s -> s.activeTab) (\s ss -> s {activeTab = ss}) - -_tabAction :: Prism' Action Tab.Action -_tabAction = prism TabA \ action -> - case action of - TabA laction -> Right laction - _-> Left action - - - -_publens :: Lens' State P.State -_publens = lens (\s -> s.publications) (\s ss -> s { publications= ss}) - - -_pubAction :: Prism' Action P.Action -_pubAction = prism PublicationA \ action -> - case action of - PublicationA laction -> Right laction - _-> Left action - - - -publicationSpec :: forall eff props. Spec (dom :: DOM, console :: CONSOLE, ajax :: AJAX | eff) State props Action -publicationSpec = focus _publens _pubAction P.publicationSpec - - -_brevetslens :: Lens' State B.State -_brevetslens = lens (\s -> s.brevets) (\s ss -> s {brevets = ss}) - - -_brevetsAction :: Prism' Action B.Action -_brevetsAction = prism BrevetsA \ action -> - case action of - BrevetsA laction -> Right laction - _-> Left action - -brevetSpec :: forall eff props. Spec (dom :: DOM, console::CONSOLE, ajax :: AJAX | eff) State props Action -brevetSpec = focus _brevetslens _brevetsAction B.brevetsSpec - - -_projectslens :: Lens' State PS.State -_projectslens = lens (\s -> s.projects) (\s ss -> s {projects = ss}) - - -_projectsAction :: Prism' Action PS.Action -_projectsAction = prism ProjectsA \ action -> - case action of - ProjectsA laction -> Right laction - _-> Left action - - -projectSpec :: forall eff props. Spec (dom :: DOM, console :: CONSOLE, ajax :: AJAX | eff) State props Action -projectSpec = focus _projectslens _projectsAction PS.projets - - -facets :: forall eff props. Spec ( dom :: DOM, console :: CONSOLE, ajax :: AJAX| eff) State props Action -facets = tabs _tablens _tabAction $ fromFoldable - [ Tuple "Publications(12)" publicationSpec - , Tuple "Brevets (2)" brevetSpec - , Tuple "Projets IMT (5)" projectSpec - ]