Commit 46d284c6 authored by Alexandre Delanoë's avatar Alexandre Delanoë
parents b209285d 8208ee08
...@@ -34,6 +34,7 @@ newtype State = State ...@@ -34,6 +34,7 @@ newtype State = State
, password :: String , password :: String
, response :: LoginRes , response :: LoginRes
, errorMessage :: String , errorMessage :: String
, loginC :: Boolean
} }
...@@ -43,6 +44,7 @@ initialState = State ...@@ -43,6 +44,7 @@ initialState = State
, password : "" , password : ""
, response : LoginRes {token : ""} , response : LoginRes {token : ""}
, errorMessage : "" , errorMessage : ""
, loginC : false
} }
data Action data Action
...@@ -54,7 +56,7 @@ data Action ...@@ -54,7 +56,7 @@ data Action
performAction :: forall eff props. PerformAction ( console :: CONSOLE performAction :: forall eff props. PerformAction ( console :: CONSOLE
, ajax :: AJAX , ajax :: AJAX
, dom :: DOM , dom :: DOM
| eff | eff
) State props Action ) State props Action
performAction NoOp _ _ = void do performAction NoOp _ _ = void do
...@@ -71,7 +73,7 @@ performAction (SetPassword pwd) _ _ = void do ...@@ -71,7 +73,7 @@ performAction (SetPassword pwd) _ _ = void do
performAction Login _ (State state) = void do performAction Login _ (State state) = void do
lift $ setHash "/search" lift $ setHash "/search"
modifyState id modifyState \(State state) -> State $ state {loginC = true}
-- res <- lift $ loginReq $ LoginReq { username : state.username, password : state.password } -- res <- lift $ loginReq $ LoginReq { username : state.username, password : state.password }
-- case res of -- case res of
-- Left e -> do -- Left e -> do
...@@ -148,6 +150,42 @@ renderSpec = simpleSpec performAction render ...@@ -148,6 +150,42 @@ renderSpec = simpleSpec performAction render
] ]
-- div [ className "modal fade myModal"
-- , role "dialog"
-- , _data {show : true}
-- ][ div [ className "modal-dialog"
-- , role "document"
-- ] [ div [ className "modal-content"]
-- [ div [ className "modal-header"]
-- [ h5 [ className "modal-title"
-- ]
-- [ text "CorpusView"
-- ]
-- , button [ _type "button"
-- , className "close"
-- , _data { dismiss : "modal"}
-- ] [ span [ aria {hidden : true}]
-- [ text "X"]
-- ]
-- ]
-- , div [ className "modal-body"]
-- [ ul [ className "list-group"] ( map fn1 state.response ) ]
-- , div [className "modal-footer"]
-- [ button [ _type "button"
-- , className "btn btn-secondary"
-- , _data {dismiss : "modal"}
-- ] [ text "GO"]
-- ]
-- ]
-- ]
-- ]
-- ]
unsafeEventValue :: forall event. event -> String unsafeEventValue :: forall event. event -> String
unsafeEventValue e = (unsafeCoerce e).target.value unsafeEventValue e = (unsafeCoerce e).target.value
......
...@@ -2,7 +2,6 @@ module Navigation where ...@@ -2,7 +2,6 @@ module Navigation where
import DOM import DOM
import Gargantext.Data.Lang import Gargantext.Data.Lang
import Prelude hiding (div)
import AddCorpusview as AC import AddCorpusview as AC
import AnnotationDocumentView as D import AnnotationDocumentView as D
...@@ -22,6 +21,7 @@ import Login as LN ...@@ -22,6 +21,7 @@ import Login as LN
import NTree as NT import NTree as NT
import Network.HTTP.Affjax (AJAX) import Network.HTTP.Affjax (AJAX)
import PageRouter (Routes(..)) import PageRouter (Routes(..))
import Prelude hiding (div)
import React (ReactElement) import React (ReactElement)
import React.DOM (a, button, div, footer, form, hr, i, img, input, li, p, span, text, ul) import React.DOM (a, button, div, footer, form, hr, i, img, input, li, p, span, text, ul)
import React.DOM.Props (Props, _data, _id, _type, aria, className, href, name, onChange, onClick, placeholder, role, src, style, tabIndex, target, title) import React.DOM.Props (Props, _data, _id, _type, aria, className, href, name, onChange, onClick, placeholder, role, src, style, tabIndex, target, title)
...@@ -29,7 +29,7 @@ import React.DOM.Props as RP ...@@ -29,7 +29,7 @@ import React.DOM.Props as RP
import Routing.Hash.Aff (setHash) import Routing.Hash.Aff (setHash)
import SearchForm as S import SearchForm as S
import Tabview as TV import Tabview as TV
import Thermite (PerformAction, Render, Spec, _render, cotransform, defaultRender, focus, modifyState, simpleSpec, withState) import Thermite (PerformAction, Render, Spec, _render, cotransform, defaultPerformAction, defaultRender, focus, modifyState, simpleSpec, withState)
import Unsafe.Coerce (unsafeCoerce) import Unsafe.Coerce (unsafeCoerce)
import UserPage as UP import UserPage as UP
...@@ -255,10 +255,13 @@ layout0 layout = ...@@ -255,10 +255,13 @@ layout0 layout =
, layoutFooter , layoutFooter
] ]
where where
outerLayout1 = simpleSpec defaultPerformAction defaultRender
outerLayout :: Spec (E eff) AppState props Action outerLayout :: Spec (E eff) AppState props Action
outerLayout = outerLayout =
cont $ fold cont $ fold
[ ls as [ withState \st ->
if ((\(LN.State s) -> s.loginC) st.loginState == true) then ls as
else outerLayout1
, rs bs ] , rs bs ]
ls = over _render \render d p s c -> ls = over _render \render d p s c ->
[div [className "col-md-3"] (render d p s c)] [div [className "col-md-3"] (render d p s c)]
......
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