summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/login/src/ElmModule/Update.elm20
-rw-r--r--src/login/src/Struct/Event.elm1
-rw-r--r--src/login/src/View/SignIn.elm18
3 files changed, 39 insertions, 0 deletions
diff --git a/src/login/src/ElmModule/Update.elm b/src/login/src/ElmModule/Update.elm
index 66708d8..be840fc 100644
--- a/src/login/src/ElmModule/Update.elm
+++ b/src/login/src/ElmModule/Update.elm
@@ -88,3 +88,23 @@ update event model =
)
Struct.Event.Connected -> (Update.HandleConnected.apply_to model)
+
+ (Struct.Event.DebugSignInAs pid) ->
+ (Update.SendSignIn.apply_to
+ (
+ case pid of
+ "0" ->
+ {new_model |
+ username = "Player1",
+ password1 = "Kalimer0"
+ }
+
+ "1" ->
+ {new_model |
+ username = "Player2",
+ password1 = "Kalimer1"
+ }
+
+ _ -> new_model
+ )
+ )
diff --git a/src/login/src/Struct/Event.elm b/src/login/src/Struct/Event.elm
index 39af983..8402cc9 100644
--- a/src/login/src/Struct/Event.elm
+++ b/src/login/src/Struct/Event.elm
@@ -27,6 +27,7 @@ type Type =
| ServerReplied (Result Http.Error (List Struct.ServerReply.Type))
| TabSelected Struct.UI.Tab
| Connected
+ | DebugSignInAs String
attempted : (Result.Result err val) -> Type
attempted act =
diff --git a/src/login/src/View/SignIn.elm b/src/login/src/View/SignIn.elm
index d758263..6d75cb4 100644
--- a/src/login/src/View/SignIn.elm
+++ b/src/login/src/View/SignIn.elm
@@ -62,6 +62,24 @@ get_html model =
[
(Html.text "Send")
]
+ ),
+ (Html.button
+ [
+ (Html.Attributes.class "login-debug-button"),
+ (Html.Events.onClick (Struct.Event.DebugSignInAs "0"))
+ ]
+ [
+ (Html.text "[PH] Login as Player 1")
+ ]
+ ),
+ (Html.button
+ [
+ (Html.Attributes.class "login-debug-button"),
+ (Html.Events.onClick (Struct.Event.DebugSignInAs "1"))
+ ]
+ [
+ (Html.text "[PH] Login as Player 2")
+ ]
)
]
)