Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
purescript-gargantext
Commits
285cfdb3
Commit
285cfdb3
authored
Jun 26, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DESIGN] User Page info.
parent
92549bc7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
55 deletions
+44
-55
Renders.purs
src/Gargantext/Users/Specs/Renders.purs
+44
-55
No files found.
src/Gargantext/Users/Specs/Renders.purs
View file @
285cfdb3
...
@@ -7,33 +7,39 @@ import Data.Maybe (Maybe(..))
...
@@ -7,33 +7,39 @@ import Data.Maybe (Maybe(..))
import Data.Tuple (Tuple(..))
import Data.Tuple (Tuple(..))
import Prelude (($), (<<<))
import Prelude (($), (<<<))
import React (ReactElement)
import React (ReactElement)
import React.DOM (button, div, h4,
li, span, text, ul
)
import React.DOM (button, div, h4,
h3, li, span, text, ul, img
)
import React.DOM.Props (_id, className)
import React.DOM.Props (_id, className
, src
)
import React.DOM.Props as RP
import React.DOM.Props as RP
import Thermite (Render)
import Thermite (Render)
infoRender :: forall props. Tuple String String -> Array ReactElement
render :: forall props. Render State props Action
infoRender (Tuple title content) =
render dispatch _ state _ =
[
[ button [RP.onClick \_ -> dispatch $ FetchUser 452145] [ text "Fetch User"],
span [className "font-weight-bold text-primary"] [text title],
div [className "col-md-12"]
span [className "pull-right"] [text content]
$ case state.user of
(Just (User user)) -> display user.name [userInfos user.hyperdata]
Nothing -> display "No user" []
]
]
listElement :: forall props. Array ReactElement -> ReactElement
display :: forall props. String -> Array ReactElement -> Array ReactElement
listElement = li [className "list-group-item justify-content-between"]
display title elems =
[ div [className "container-fluid"]
card :: forall props. String -> Array ReactElement -> Array ReactElement
[ div [className "row", _id "user-page-header"]
card title elems =
[ div [className "col-md-6"] [ h3 [] [text title] ]
[
, div [className "col-md-8"] []
div [className "card"]
, div [className "col-md-2"] [ span [] [text ""] ]
[
]
div [className "card-header text-white bg-primary"]
, div [className "row", _id "user-page-info"]
[
[ div [className "col-md-12"]
h4 [] [text title]
[ div [className "row"]
],
[ div [className "col-md-2"]
div [className "card-body"]
[ img [src "/images/Gargantextuel-212x300.jpg"] [] ]
elems
, div [className "col-md-1"] []
, div [className "col-md-8"] elems
]
]
]
]
]
]
]
...
@@ -49,33 +55,16 @@ userInfos (HyperData user) =
...
@@ -49,33 +55,16 @@ userInfos (HyperData user) =
, listElement <<< infoRender <<< Tuple "Appelation: " $ checkMaybe user.fonction
, listElement <<< infoRender <<< Tuple "Appelation: " $ checkMaybe user.fonction
, listElement <<< infoRender $ Tuple "Lieu: " $ checkMaybe user.lieu
, listElement <<< infoRender $ Tuple "Lieu: " $ checkMaybe user.lieu
]
]
where checkMaybe (Nothing) = ""
where
checkMaybe (Nothing) = ""
checkMaybe (Just a) = a
checkMaybe (Just a) = a
pbInfos :: ReactElement
listElement :: forall props. Array ReactElement -> ReactElement
pbInfos =
listElement = li [className "list-group-item justify-content-between"]
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
infoRender :: forall props. Tuple String String -> Array ReactElement
render dispatch _ state _ =
infoRender (Tuple title content) =
[
[ span [] [text title]
div [className "container-fluid"]
, span [className "badge badge-default badge-pill"] [text content]
[
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" []
]
]
]
]
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment