module View.SignIn ( renderSignIn ) where import Json.Decode as Json import Signal exposing (Address) import Html as H exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (..) import Model exposing (Model) import Model.Action exposing (..) import Model.Action.SignInAction exposing (..) import Model.View.SignInView exposing (..) import Model.Translations exposing (getMessage) import View.Events exposing (onSubmitPrevDefault) import View.Icon exposing (renderIcon) import Persona exposing (operations) renderSignIn : Address Action -> Model -> SignInView -> Html renderSignIn address model signInView = div [ class "signIn" ] [ button [ onClick operations.address Persona.SignIn ] [ span [] [ text (getMessage "SignIn" model.translations) ] , renderIcon "plug" ] , div [ class "result" ] [ signInResult model signInView ] ] signInResult : Model -> SignInView -> Html signInResult model signInView = case signInView.result of Just result -> case result of Ok login -> div [ class "success" ] [ text (getMessage "SignInEmailSent" model.translations) ] Err error -> div [ class "error" ] [ text error ] Nothing -> text ""