Commit f4a8737b authored by Mael NICOLAS's avatar Mael NICOLAS

merged, resolved conflict

parent ed8a2a4f
module Gargantext.Users
(module Gargantext.Users.Types,
module Gargantext.Users.Specs)
where
import Gargantext.Users.Types
import Gargantext.Users.Specs
module Gargantext.Users.Actions
(module Gargantext.Users.Actions.API)
where
import Gargantext.Users.Actions.API
module Gargantext.Users.Actions.API
where
import Gargantext.Users.Types.Types
import Control.Monad.Aff (Aff, attempt, launchAff)
import Control.Monad.Aff.Class (liftAff)
import Control.Monad.Aff.Console (log)
import Data.Argonaut (decodeJson)
import Data.Either (Either(..))
import Data.HTTP.Method (Method(..))
import Data.Identity (Identity(..))
import Network.HTTP.Affjax (AJAX, affjax, defaultRequest, get)
import Prelude (pure, show, unit, bind, discard, (<<<), ($), (<>))
user userID = launchAff $ do
res <- get "http://localhost:8008/node/452146"
pure res
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.Types (Action, State, performAction)
layoutUser :: forall props eff . Spec ( console :: CONSOLE
, ajax :: AJAX
, dom :: DOM
| eff
) State props Action
layoutUser = simpleSpec performAction render
module Gargantext.Users.Specs.Renders
where
import Control.Monad.Aff.Class (liftAff)
import Data.Tuple (Tuple(..))
import Prelude (($), (<<<))
import React (ReactElement)
import React.DOM (div, h4, li, span, text, ul)
import React.DOM.Props (_id, className)
import Thermite (Render)
import Gargantext.Users.Types.Types (Action, State)
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 :: ReactElement
userInfos =
ul [className "list-group"]
[
listElement <<< infoRender $ Tuple "Fonction: " "Enseignant chercheur"
,listElement <<< infoRender $ Tuple "Entité, service: " "Mines Saint-Etienne SPIN -PTSI"
,listElement <<< infoRender $ Tuple "Téléphone: " "(+33) 4 77 42 00 70"
,listElement <<< infoRender $ Tuple "Courriel: " "gargantua@rabelais.fr"
,listElement <<< infoRender $ Tuple "Bureau: " "D1/10"
,listElement <<< infoRender $ Tuple "Appelation: " "Maître de conférences (EPA)"
,listElement <<< infoRender $ Tuple "Lieu: " "Saint-Etienne, 158 Cours Fauriel"
]
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"]
[
div [className "col-md-8"]
$ card "Jean HEUDE" [userInfos]
]
]
]
]
module Gargantext.Users.Types
(module Gargantext.Users.Types.Types,
module Gargantext.Users.Types.Lens,
brevetSpec,
projectSpec,
facets
)
where
import Gargantext.Users.Types.Lens
import Gargantext.Users.Types.Types
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
]
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 Network.HTTP.Affjax (AJAX)
import Projects as PS
import Publications as P
import Tab as Tab
import Thermite (Spec, focus)
import Gargantext.Users.Types.Types (State(..), Action(..))
_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
module Gargantext.Users.Types.Types where
import Brevets as B
import Control.Monad.Aff.Console (CONSOLE)
import DOM (DOM)
import Data.Date (Date)
import Data.Generic (class Generic)
import Network.HTTP.Affjax (AJAX)
import Prelude (id, void)
import Projects as PS
import Publications as P
import Tab as Tab
import Thermite (PerformAction, modifyState)
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
-- id 452146
-- typename 41
-- userId 1
-- parentId 452132
-- name "Pierre DEMUGNIER"
-- date "2018-06-18T14:27:50.670952Z"
-- hyperdata
-- bureau "V.305"
-- atel ""
-- fax ""
-- aprecision ""
-- service2 null
-- groupe ""
-- service "ARMINES"
-- lieu "Paris"
-- pservice ""
-- date_modification "07/06/2018"
-- pfonction ""
-- fonction "Service Développement Partenarial - Chargé de Projet France & International"
-- url ""
-- statut null
-- prenom "Pierre"
-- idutilentite "1055"
-- afonction ""
-- grprech ""
-- nom "DEMUGNIER"
-- entite "Armines"
-- entite2 null
-- id "11002"
-- tel "01.40.51.93.66"
-- idutilsiecoles null
-- groupe2 null
-- sexe "1"
-- mail "pierre.demugnier@mines-paristech.fr"
-- actif "1"
type User =
{
id :: Int,
typename :: Int,
userId :: Int,
parentId :: Int,
name :: String,
date :: Date,
hyperData :: HyperData
}
type HyperData =
{}
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