aboutsummaryrefslogtreecommitdiff
path: root/src/client/View/Page.elm
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/View/Page.elm')
-rw-r--r--src/client/View/Page.elm47
1 files changed, 35 insertions, 12 deletions
diff --git a/src/client/View/Page.elm b/src/client/View/Page.elm
index eb86132..bf61dc1 100644
--- a/src/client/View/Page.elm
+++ b/src/client/View/Page.elm
@@ -18,6 +18,7 @@ import Json.Decode as Json
import Model exposing (Model)
import Model.Payment exposing (Payments, Payment)
import Model.View exposing (..)
+import Model.View.SignIn exposing (..)
import Update exposing (..)
import Update.SignIn exposing (..)
@@ -60,27 +61,33 @@ renderMain model =
case model.view of
LoadingView ->
loadingView
- SignInView { login } ->
- signInView login
+ SignInView signIn ->
+ signInView signIn
PaymentView payments ->
paymentsView payments
loadingView : Html
loadingView = text ""
-signInView : String -> Html
-signInView login =
+signInView : SignIn -> Html
+signInView signIn =
div
[ class "signIn" ]
- [ input
- [ value login
- , on "input" targetValue (Signal.message actions.address << UpdateSignIn << UpdateLogin)
- , onEnter serverCommunications.address (SC.SignIn login)
+ [ div
+ [ class "form" ]
+ [ input
+ [ value signIn.login
+ , on "input" targetValue (Signal.message actions.address << UpdateSignIn << UpdateLogin)
+ , onEnter serverCommunications.address (SC.SignIn signIn.login)
+ ]
+ []
+ , button
+ [ onClick serverCommunications.address (SC.SignIn signIn.login) ]
+ [ text "Sign in" ]
]
- []
- , button
- [ onClick serverCommunications.address (SC.SignIn login) ]
- [ text "Sign in" ]
+ , div
+ [ class "result" ]
+ [ signInResult signIn ]
]
onEnter : Signal.Address a -> a -> Attribute
@@ -89,6 +96,22 @@ onEnter address value =
(Json.customDecoder keyCode (\code -> if code == 13 then Ok () else Err ""))
(\_ -> Signal.message address value)
+signInResult : SignIn -> Html
+signInResult signIn =
+ case signIn.result of
+ Just result ->
+ case result of
+ Ok login ->
+ div
+ [ class "success" ]
+ [ text ("We send you an email, please click to the provided link in order to sign in.") ]
+ Err error ->
+ div
+ [ class "error" ]
+ [ text error ]
+ Nothing ->
+ text ""
+
paymentsView : Payments -> Html
paymentsView payments =
table