Commit 5487e8a3 authored by Alexandre Delanoë's avatar Alexandre Delanoë
parents 0d6b9b29 b9c0de51
...@@ -19,3 +19,15 @@ ...@@ -19,3 +19,15 @@
#funnyimg { #funnyimg {
border:2px solid black; border:2px solid black;
} }
#page-wrapper {
margin-top : 56px;
}
#user-page-header {
border-bottom : 1px solid black;
}
#user-page-info {
margin-top : 38px;
}
\ No newline at end of file
module Facets where
import Prelude hiding (div)
type State = String
...@@ -21,6 +21,7 @@ import React.DOM.Props (_data, _id, aria, className, href, role, src, style, tab ...@@ -21,6 +21,7 @@ import React.DOM.Props (_data, _id, aria, className, href, role, src, style, tab
import Thermite (PerformAction, Render, Spec, _render, defaultRender, focus, modifyState, simpleSpec, withState) import Thermite (PerformAction, Render, Spec, _render, defaultRender, focus, modifyState, simpleSpec, withState)
import DocView as DV import DocView as DV
import SearchForm as S import SearchForm as S
import UserPage as UP
type E e = (dom :: DOM, ajax :: AJAX, console :: CONSOLE | e) type E e = (dom :: DOM, ajax :: AJAX, console :: CONSOLE | e)
...@@ -31,6 +32,7 @@ type AppState = ...@@ -31,6 +32,7 @@ type AppState =
, addCorpusState :: AC.State , addCorpusState :: AC.State
, docViewState :: DV.State , docViewState :: DV.State
, searchState :: S.State , searchState :: S.State
, userPage :: UP.State
} }
initAppState :: AppState initAppState :: AppState
...@@ -41,6 +43,7 @@ initAppState = ...@@ -41,6 +43,7 @@ initAppState =
, addCorpusState : AC.initialState , addCorpusState : AC.initialState
, docViewState : DV.tdata , docViewState : DV.tdata
, searchState : S.initialState , searchState : S.initialState
, userPage : UP.initialState
} }
...@@ -52,6 +55,7 @@ data Action ...@@ -52,6 +55,7 @@ data Action
| AddCorpusA AC.Action | AddCorpusA AC.Action
| DocViewA DV.Action | DocViewA DV.Action
| SearchA S.Action | SearchA S.Action
| UserPageA UP.Action
performAction :: forall eff props. PerformAction (dom :: DOM |eff) AppState props Action performAction :: forall eff props. PerformAction (dom :: DOM |eff) AppState props Action
...@@ -122,6 +126,17 @@ _searchAction = prism SearchA \action -> ...@@ -122,6 +126,17 @@ _searchAction = prism SearchA \action ->
_-> Left action _-> Left action
_userPageState:: Lens' AppState UP.State
_userPageState = lens (\s -> s.userPage) (\s ss -> s{userPage = ss})
_userPageAction :: Prism' Action UP.Action
_userPageAction = prism UserPageA \action ->
case action of
UserPageA caction -> Right caction
_-> Left action
pagesComponent :: forall props eff. AppState -> Spec (E eff) AppState props Action pagesComponent :: forall props eff. AppState -> Spec (E eff) AppState props Action
pagesComponent s = pagesComponent s =
...@@ -137,6 +152,7 @@ pagesComponent s = ...@@ -137,6 +152,7 @@ pagesComponent s =
selectSpec AddCorpus = wrap $ focus _addCorpusState _addCorpusAction AC.addcorpusviewSpec selectSpec AddCorpus = wrap $ focus _addCorpusState _addCorpusAction AC.addcorpusviewSpec
selectSpec DocView = wrap $ focus _docViewState _docViewAction DV.spec selectSpec DocView = wrap $ focus _docViewState _docViewAction DV.spec
selectSpec SearchView = wrap $ focus _searchState _searchAction S.searchSpec selectSpec SearchView = wrap $ focus _searchState _searchAction S.searchSpec
selectSpec UserPage = wrap $ focus _userPageState _userPageAction UP.userPageSpec
routingSpec :: forall props eff. Spec (dom :: DOM |eff) AppState props Action routingSpec :: forall props eff. Spec (dom :: DOM |eff) AppState props Action
routingSpec = simpleSpec performAction defaultRender routingSpec = simpleSpec performAction defaultRender
...@@ -284,3 +300,9 @@ dispatchAction dispatcher _ SearchView = do ...@@ -284,3 +300,9 @@ dispatchAction dispatcher _ SearchView = do
_ <- dispatcher $ SetRoute $ SearchView _ <- dispatcher $ SetRoute $ SearchView
_ <- dispatcher $ SearchA $ S.NoOp _ <- dispatcher $ SearchA $ S.NoOp
pure unit pure unit
dispatchAction dispatcher _ UserPage = do
_ <- dispatcher $ SetRoute $ UserPage
_ <- dispatcher $ UserPageA $ UP.NoOp
pure unit
...@@ -21,6 +21,8 @@ data Routes ...@@ -21,6 +21,8 @@ data Routes
| AddCorpus | AddCorpus
| DocView | DocView
| SearchView | SearchView
| UserPage
instance showRoutes :: Show Routes where instance showRoutes :: Show Routes where
show Home = "Home" show Home = "Home"
...@@ -28,18 +30,22 @@ instance showRoutes :: Show Routes where ...@@ -28,18 +30,22 @@ instance showRoutes :: Show Routes where
show AddCorpus = "AddCorpus" show AddCorpus = "AddCorpus"
show DocView = "DocView" show DocView = "DocView"
show SearchView = "SearchView" show SearchView = "SearchView"
show UserPage = "UserPage"
int :: Match Int int :: Match Int
int = floor <$> num int = floor <$> num
routing :: Match Routes routing :: Match Routes
routing = routing =
loginRoute loginRoute
<|> userPageRoute
<|> searchRoute <|> searchRoute
<|> docviewRoute <|> docviewRoute
<|> addcorpusRoute <|> addcorpusRoute
<|> home <|> home
where where
userPageRoute = UserPage <$ route "userPage"
searchRoute = SearchView <$ route "search" searchRoute = SearchView <$ route "search"
docviewRoute = DocView <$ route "docView" docviewRoute = DocView <$ route "docView"
addcorpusRoute = AddCorpus <$ route "addCorpus" addcorpusRoute = AddCorpus <$ route "addCorpus"
......
module UserPage where
import Prelude hiding (div)
import Control.Monad.Eff.Console (CONSOLE)
import DOM (DOM)
import Network.HTTP.Affjax (AJAX)
import React.DOM (a, div, h3, h5, img, span, text)
import React.DOM.Props (_id, className, src)
import Thermite (PerformAction, Render, Spec, modifyState, simpleSpec)
type State = String
initialState :: State
initialState =""
data Action
= NoOp
performAction :: forall eff props. PerformAction (console :: CONSOLE, ajax :: AJAX,dom::DOM | eff) State props Action
performAction NoOp _ _ = void do
modifyState id
userPageSpec :: forall props eff . Spec (console::CONSOLE, ajax::AJAX, dom::DOM | eff) State props Action
userPageSpec = 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 "UserName"]
]
, div [className "col-md-8"] []
, div [className "col-md-2"]
[ span [] [text "X"]
]
]
, div [className "row", _id "user-page-info"]
[
div [className "col-md-12"]
[ div [className "row"]
[ div [className "col-md-2"]
[ img [src "/images/corporate.jpg"] []
]
, div [className "col-md-8"]
[
div [className "list-group"]
[
a [className "list-group-item list-group-item-action flex-column align-items-start"]
[ div [className "d-flex w-100 justify-content-between"]
[ h5 [className "mb-1"] [ text "fonction"]
, h5 [] [text "Enseignent checheur"]
]
]
]
]
]
]
]
, div [className "row",_id "user-page-footer"]
[
]
]
]
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