summaryrefslogtreecommitdiff |
diff options
author | nsensfel <SpamShield0@noot-noot.org> | 2018-12-03 18:59:17 +0100 |
---|---|---|
committer | nsensfel <SpamShield0@noot-noot.org> | 2018-12-03 18:59:17 +0100 |
commit | 8c65210ef929af6d4f3451328ec8d97cffcd91f4 (patch) | |
tree | 269075263be438b9a87b17bcac08b5185ce3558b | |
parent | eb9812b0bb2c32e4ae2fac7fe9db09329aec9975 (diff) |
...
-rw-r--r-- | src/main-menu/src/View/CurrentTab.elm | 9 | ||||
-rw-r--r-- | src/main-menu/src/View/Tab/NewInvasion.elm | 123 |
2 files changed, 126 insertions, 6 deletions
diff --git a/src/main-menu/src/View/CurrentTab.elm b/src/main-menu/src/View/CurrentTab.elm index efc3e37..a6c367d 100644 --- a/src/main-menu/src/View/CurrentTab.elm +++ b/src/main-menu/src/View/CurrentTab.elm @@ -15,6 +15,8 @@ import View.Invasions import View.MapListing import View.Roster +import View.Tab.NewInvasion + -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- @@ -48,9 +50,4 @@ get_html : (Struct.Model.Type -> (Html.Html Struct.Event.Type)) get_html model = case (Struct.UI.get_current_tab model.ui) of Struct.UI.DefaultTab -> (default_tab model) - Struct.UI.NewInvasionTab -> - (Html.main_ - [ - ] - [] - ) + Struct.UI.NewInvasionTab -> (View.Tab.NewInvasion.get_html model) diff --git a/src/main-menu/src/View/Tab/NewInvasion.elm b/src/main-menu/src/View/Tab/NewInvasion.elm new file mode 100644 index 0000000..1961174 --- /dev/null +++ b/src/main-menu/src/View/Tab/NewInvasion.elm @@ -0,0 +1,123 @@ +module View.Tab.NewInvasion exposing (get_html) + +-- Elm ------------------------------------------------------------------------- +import Html +import Html.Attributes + +-- Main Menu ------------------------------------------------------------------- +import Struct.Event +import Struct.Model +import Struct.Player +import Struct.UI +import Struct.InvasionRequest +import Struct.BattleSummary + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- +select_category_html : (Html.Html Struct.Event.Type) +select_category_html = + (Html.div + [ + ] + [ + (Html.div + [ + ] + [ + (Html.text "New Offensive") + ] + ), + (Html.div + [ + ] + [ + (Html.text "New Defense") + ] + ) + ] + ) + +select_size_html : Struct.InvasionRequest.Size -> (Html.Html Struct.Event.Type) +select_size_html max_size = + (Html.div + [ + ] + [ + (Html.div + [ + ] + [ + (Html.text "Small") + ] + ), + (Html.div + [ + ] + [ + (Html.text "Medium") + ] + ), + (Html.div + [ + ] + [ + (Html.text "Large") + ] + ) + ] + ) + +select_map_html : (Html.Html Struct.Event.Type) +select_map_html = + (Html.div + [ + ] + [ + (Html.text "Map Selection") + ] + ) + + +get_actual_html : Struct.InvasionRequest.Type -> (Html.Html Struct.Event.Type) +get_actual_html inv_req = + case (Struct.InvasionRequest.get_category inv_req) of + Struct.BattleSummary.InvasionEither -> (select_category_html) + Struct.BattleSummary.InvasionAttack -> + ( + case (Struct.InvasionRequest.get_size inv_req) of + -- TODO: use roster size as upper limit. + Nothing -> (select_size_html Struct.InvasionRequest.Large) + _ -> + -- TODO: Should not happen, let the user go ahead by providing + -- a link. + (Html.text "Error.") + ) + Struct.BattleSummary.InvasionDefend -> + ( + case (Struct.InvasionRequest.get_map_id inv_req) of + -- FIXME: Requires model. + "" -> (select_map_html) + _ -> + case (Struct.InvasionRequest.get_size inv_req) of + Nothing -> + -- TODO: use min(RosterSize, MapSize) as upper limit. + (select_size_html Struct.InvasionRequest.Large) + _ -> + -- TODO: Should not happen, let the user go ahead by + -- providing a link. + (Html.text "Error.") + ) + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type) +get_html model = + case (Struct.UI.get_action model.ui) of + Struct.UI.None -> + -- TODO: explain & let the user go back to the main menu. + (Html.text "Error.") + + (Struct.UI.NewInvasion inv_req) -> + (get_actual_html inv_req) |