summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2018-09-14 18:57:42 +0200
committernsensfel <SpamShield0@noot-noot.org>2018-09-14 18:57:42 +0200
commit2aa0c12b6a193d16681a0179a067664390af7aee (patch)
treeca2e2533c3a9947ba5ef9d5e1d646b964ba82eb6 /src/ElmModule
parentac5b50e4a622ee0885678a96c69af7f49290bcee (diff)
...
Diffstat (limited to 'src/ElmModule')
-rw-r--r--src/ElmModule/Init.elm15
-rw-r--r--src/ElmModule/Update.elm10
-rw-r--r--src/ElmModule/View.elm34
3 files changed, 52 insertions, 7 deletions
diff --git a/src/ElmModule/Init.elm b/src/ElmModule/Init.elm
index ccb3595..65d31b7 100644
--- a/src/ElmModule/Init.elm
+++ b/src/ElmModule/Init.elm
@@ -1,8 +1,11 @@
module ElmModule.Init exposing (init)
-- Elm -------------------------------------------------------------------------
+import Delay
--- Main Menu -------------------------------------------------------------------
+import Time
+
+-- Extension -------------------------------------------------------------------
import Struct.Event
import Struct.Flags
import Struct.Model
@@ -15,4 +18,12 @@ import Struct.Model
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
init : Struct.Flags.Type -> (Struct.Model.Type, (Cmd Struct.Event.Type))
-init flags = ((Struct.Model.new flags), Cmd.none)
+init flags =
+ (
+ (Struct.Model.new flags),
+ (Delay.after
+ (toFloat (Struct.Flags.get_frequency flags))
+ (Time.minute)
+ Struct.Event.ShouldRefresh
+ )
+ )
diff --git a/src/ElmModule/Update.elm b/src/ElmModule/Update.elm
index fbe8dfe..9e162fe 100644
--- a/src/ElmModule/Update.elm
+++ b/src/ElmModule/Update.elm
@@ -6,7 +6,9 @@ module ElmModule.Update exposing (update)
import Struct.Event
import Struct.Model
+import Update.AddPlayer
import Update.HandleServerReply
+import Update.RefreshBattles
import Update.StoreParams
--------------------------------------------------------------------------------
@@ -31,7 +33,13 @@ update event model =
(Struct.Event.SetUsername str) -> (model, Cmd.none)
(Struct.Event.SetID str) -> (model, Cmd.none)
(Struct.Event.SetURLPrefix str) -> (model, Cmd.none)
- (Struct.Event.SetFrequency val) -> (Update.StoreParams.apply_to model)
+ (Struct.Event.SetFrequency val) -> (model, Cmd.none)
+
+ Struct.Event.ShouldRefresh -> (Update.RefreshBattles.apply_to model)
+
+ Struct.Event.StoreParams -> (Update.StoreParams.apply_to model)
+
+ Struct.Event.AddPlayer -> (Update.AddPlayer.apply_to model)
(Struct.Event.Failed err) ->
(
diff --git a/src/ElmModule/View.elm b/src/ElmModule/View.elm
index 3f0a16f..946bf8e 100644
--- a/src/ElmModule/View.elm
+++ b/src/ElmModule/View.elm
@@ -4,6 +4,7 @@ module ElmModule.View exposing (view)
import Array
import Html
+import Html.Events
import Html.Attributes
-- Extension -------------------------------------------------------------------
@@ -27,7 +28,7 @@ view model =
[
(Html.Attributes.class "fullscreen-module")
]
- (
+ [
(
case model.error of
Nothing -> (Util.Html.nothing)
@@ -38,8 +39,33 @@ view model =
(Html.text (Struct.Error.to_string err))
]
)
+ ),
+ (Html.div
+ [
+ ]
+ (List.map (View.Player.get_html) (Array.toList model.players))
+ ),
+ (Html.div
+ [
+ ]
+ [
+ (Html.button
+ [
+ (Html.Events.onClick Struct.Event.AddPlayer)
+ ]
+ [
+ (Html.text "Add Player")
+ ]
+ ),
+ (Html.button
+ [
+ (Html.Events.onClick Struct.Event.StoreParams)
+ ]
+ [
+ (Html.text "Save Params")
+ ]
+ )
+ ]
)
- ::
- (List.map (View.Player.get_html) (Array.toList model.players))
- )
+ ]
)