Commit 789cef0d authored by Alexandre Delanoë's avatar Alexandre Delanoë

[MERGE] user-form

parents 72aeb6ae 20864e01
......@@ -291,7 +291,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 U.layoutUser
selectSpec (UserPage i) = 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
......@@ -593,9 +593,10 @@ dispatchAction dispatcher _ SearchView = do
_ <- dispatcher $ SearchA $ S.NoOp
pure unit
dispatchAction dispatcher _ UserPage = do
_ <- dispatcher $ SetRoute $ UserPage
dispatchAction dispatcher _ (UserPage id) = do
_ <- dispatcher $ SetRoute $ UserPage id
_ <- dispatcher $ UserPageA $ U.NoOp
_ <- dispatcher $ UserPageA $ U.FetchUser id
pure unit
dispatchAction dispatcher _ (DocAnnotation i) = do
......
......@@ -7,19 +7,18 @@ import Data.Maybe (Maybe(..))
import Data.Tuple (Tuple(..))
import Prelude (($), (<<<))
import React (ReactElement)
import React.DOM (button, div, h4, h3, li, span, text, ul, img)
import React.DOM (div, h3, h1, li, span, text, ul, img)
import React.DOM.Props (_id, className, src)
import React.DOM.Props as RP
import Thermite (Render)
render :: forall props. Render State props Action
render dispatch _ state _ =
[ button [RP.onClick \_ -> dispatch $ FetchUser 473593] [ text "Fetch User"],
[
div [className "col-md-12"]
$ case state.user of
(Just (User user)) -> display user.name [userInfos user.hyperdata]
Nothing -> display "No user" []
Nothing -> display "User not found" []
]
display :: forall props. String -> Array ReactElement -> Array ReactElement
......@@ -37,7 +36,7 @@ display title elems =
[ img [src "/images/Gargantextuel-212x300.jpg"] [] ]
, div [className "col-md-1"] []
, div [className "col-md-8"] elems
]
]
]
]
]
......@@ -55,7 +54,7 @@ userInfos (HyperData user) =
, listElement <<< infoRender <<< Tuple "Appelation: " $ checkMaybe user.fonction
, listElement <<< infoRender $ Tuple "Lieu: " $ checkMaybe user.lieu
]
where
where
checkMaybe (Nothing) = ""
checkMaybe (Just a) = a
......@@ -67,4 +66,3 @@ userInfos (HyperData user) =
[ span [] [text title]
, span [className "badge badge-default badge-pill"] [text content]
]
......@@ -21,7 +21,7 @@ data Routes
| AddCorpus
| DocView
| SearchView
| UserPage
| UserPage Int
| DocAnnotation Int
| Tabview
| CorpusAnalysis
......@@ -31,36 +31,36 @@ data Routes
instance showRoutes :: Show Routes where
show Login = "Login"
show AddCorpus = "AddCorpus"
show DocView = "DocView"
show Login = "Login"
show AddCorpus = "AddCorpus"
show DocView = "DocView"
show SearchView = "SearchView"
show UserPage = "UserPage"
show (UserPage i) = "UserPage"
show (DocAnnotation i)= "DocumentView"
show Tabview = "Tabview"
show CorpusAnalysis = "corpus"
show PGraphExplorer = "graphExplorer"
show NGramsTable = "NGramsTable"
show Dashboard = "Dashboard"
show Home = "Home"
show Tabview = "Tabview"
show CorpusAnalysis = "corpus"
show PGraphExplorer = "graphExplorer"
show NGramsTable = "NGramsTable"
show Dashboard = "Dashboard"
show Home = "Home"
int :: Match Int
int = floor <$> num
routing :: Match Routes
routing =
Login <$ route "login"
<|> Tabview <$ route "tabview"
Login <$ route "login"
<|> Tabview <$ route "tabview"
<|> DocAnnotation <$> (route "documentView" *> int)
<|> UserPage <$ route "userPage"
<|> SearchView <$ route "search"
<|> DocView <$ route "docView"
<|> AddCorpus <$ route "addCorpus"
<|> CorpusAnalysis <$ route "corpus"
<|> PGraphExplorer <$ route "graphExplorer"
<|> NGramsTable <$ route "ngrams"
<|> Dashboard <$ route "dashboard"
<|> Home <$ lit ""
<|> UserPage <$> (route "user" *> int)
<|> SearchView <$ route "search"
<|> DocView <$ route "docView"
<|> AddCorpus <$ route "addCorpus"
<|> CorpusAnalysis <$ route "corpus"
<|> PGraphExplorer <$ route "graphExplorer"
<|> NGramsTable <$ route "ngrams"
<|> Dashboard <$ route "dashboard"
<|> Home <$ lit ""
where
route str = lit "" *> lit str
......
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