| summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/ElmModule')
| -rw-r--r-- | src/ElmModule/Init.elm | 29 | ||||
| -rw-r--r-- | src/ElmModule/Subscriptions.elm | 17 | ||||
| -rw-r--r-- | src/ElmModule/Update.elm | 51 | ||||
| -rw-r--r-- | src/ElmModule/View.elm | 71 |
4 files changed, 0 insertions, 168 deletions
diff --git a/src/ElmModule/Init.elm b/src/ElmModule/Init.elm deleted file mode 100644 index 65d31b7..0000000 --- a/src/ElmModule/Init.elm +++ /dev/null @@ -1,29 +0,0 @@ -module ElmModule.Init exposing (init) - --- Elm ------------------------------------------------------------------------- -import Delay - -import Time - --- Extension ------------------------------------------------------------------- -import Struct.Event -import Struct.Flags -import Struct.Model - --------------------------------------------------------------------------------- --- LOCAL ----------------------------------------------------------------------- --------------------------------------------------------------------------------- - --------------------------------------------------------------------------------- --- EXPORTED -------------------------------------------------------------------- --------------------------------------------------------------------------------- -init : Struct.Flags.Type -> (Struct.Model.Type, (Cmd Struct.Event.Type)) -init flags = - ( - (Struct.Model.new flags), - (Delay.after - (toFloat (Struct.Flags.get_frequency flags)) - (Time.minute) - Struct.Event.ShouldRefresh - ) - ) diff --git a/src/ElmModule/Subscriptions.elm b/src/ElmModule/Subscriptions.elm deleted file mode 100644 index e9b557e..0000000 --- a/src/ElmModule/Subscriptions.elm +++ /dev/null @@ -1,17 +0,0 @@ -module ElmModule.Subscriptions exposing (..) - --- Elm ------------------------------------------------------------------------- - --- Main Menu ------------------------------------------------------------------- -import Struct.Model -import Struct.Event - --------------------------------------------------------------------------------- --- LOCAL ----------------------------------------------------------------------- --------------------------------------------------------------------------------- - --------------------------------------------------------------------------------- --- EXPORTED -------------------------------------------------------------------- --------------------------------------------------------------------------------- -subscriptions : Struct.Model.Type -> (Sub Struct.Event.Type) -subscriptions model = Sub.none diff --git a/src/ElmModule/Update.elm b/src/ElmModule/Update.elm deleted file mode 100644 index 9e162fe..0000000 --- a/src/ElmModule/Update.elm +++ /dev/null @@ -1,51 +0,0 @@ -module ElmModule.Update exposing (update) - --- Elm ------------------------------------------------------------------------- - --- Main Menu ------------------------------------------------------------------- -import Struct.Event -import Struct.Model - -import Update.AddPlayer -import Update.HandleServerReply -import Update.RefreshBattles -import Update.StoreParams - --------------------------------------------------------------------------------- --- LOCAL ----------------------------------------------------------------------- --------------------------------------------------------------------------------- - --------------------------------------------------------------------------------- --- EXPORTED -------------------------------------------------------------------- --------------------------------------------------------------------------------- -update : ( - Struct.Event.Type -> - Struct.Model.Type -> - (Struct.Model.Type, (Cmd Struct.Event.Type)) - ) -update event model = - let - new_model = (Struct.Model.clear_error model) - in - case event of - Struct.Event.None -> (model, Cmd.none) - - (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) -> (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) -> - ( - (Struct.Model.invalidate err new_model), - Cmd.none - ) - - (Struct.Event.ServerReplied result) -> - (Update.HandleServerReply.apply_to model result) diff --git a/src/ElmModule/View.elm b/src/ElmModule/View.elm deleted file mode 100644 index 946bf8e..0000000 --- a/src/ElmModule/View.elm +++ /dev/null @@ -1,71 +0,0 @@ -module ElmModule.View exposing (view) - --- Elm ------------------------------------------------------------------------- -import Array - -import Html -import Html.Events -import Html.Attributes - --- Extension ------------------------------------------------------------------- -import Util.Html - -import Struct.Error -import Struct.Event -import Struct.Model - -import View.Player --------------------------------------------------------------------------------- --- LOCAL ----------------------------------------------------------------------- --------------------------------------------------------------------------------- - --------------------------------------------------------------------------------- --- EXPORTED -------------------------------------------------------------------- --------------------------------------------------------------------------------- -view : Struct.Model.Type -> (Html.Html Struct.Event.Type) -view model = - (Html.div - [ - (Html.Attributes.class "fullscreen-module") - ] - [ - ( - case model.error of - Nothing -> (Util.Html.nothing) - (Just err) -> - (Html.div - [] - [ - (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") - ] - ) - ] - ) - ] - ) |


