| summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/background')
| -rw-r--r-- | src/background/src/Action/Ports.elm | 4 | ||||
| -rw-r--r-- | src/background/src/ElmModule/View.elm | 54 | ||||
| -rw-r--r-- | src/background/src/View/Header.elm | 79 | ||||
| -rw-r--r-- | src/background/src/View/Player.elm | 97 |
4 files changed, 3 insertions, 231 deletions
diff --git a/src/background/src/Action/Ports.elm b/src/background/src/Action/Ports.elm index 4d83077..9222b08 100644 --- a/src/background/src/Action/Ports.elm +++ b/src/background/src/Action/Ports.elm @@ -1,4 +1,4 @@ port module Action.Ports exposing (..) -port store_params : (Int, String) -> (Cmd msg) -port reset_params : () -> (Cmd msg) +port read_params : () -> (Cmd msg) +port store_results : (String) -> (Cmd msg) diff --git a/src/background/src/ElmModule/View.elm b/src/background/src/ElmModule/View.elm index 946bf8e..32a139f 100644 --- a/src/background/src/ElmModule/View.elm +++ b/src/background/src/ElmModule/View.elm @@ -1,20 +1,13 @@ 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 ----------------------------------------------------------------------- -------------------------------------------------------------------------------- @@ -23,49 +16,4 @@ import View.Player -- 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") - ] - ) - ] - ) - ] - ) +view model = (Util.Html.nothing) diff --git a/src/background/src/View/Header.elm b/src/background/src/View/Header.elm deleted file mode 100644 index fd8e693..0000000 --- a/src/background/src/View/Header.elm +++ /dev/null @@ -1,79 +0,0 @@ -module View.Header exposing (get_html) - --- Elm ------------------------------------------------------------------------- -import Html -import Html.Attributes - --- Map ------------------------------------------------------------------- -import Struct.Event - --------------------------------------------------------------------------------- --- LOCAL ----------------------------------------------------------------------- --------------------------------------------------------------------------------- -link_html : String -> String -> Bool -> (Html.Html Struct.Event.Type) -link_html src label is_active = - (Html.a - [ - (Html.Attributes.href src) - ] - [ - ( - if (is_active) - then (Html.text label) - else (Html.s [] [(Html.text label)]) - ) - ] - ) - -navigation_html : (Html.Html Struct.Event.Type) -navigation_html = - (Html.nav - [] - [ - (link_html "/about.html" "About" True), - (link_html "/news/" "News" False), - (link_html "/community/" "Community" False), - (link_html "/login/?action=disconnect" "Disconnect" True) - ] - ) - --------------------------------------------------------------------------------- --- EXPORTED -------------------------------------------------------------------- --------------------------------------------------------------------------------- -get_html : (Html.Html Struct.Event.Type) -get_html = - (Html.header - [] - [ - (Html.div - [ - (Html.Attributes.class "main-server-logo") - ] - [ - (Html.a - [ - (Html.Attributes.href "http://127.0.0.1") - ] - [ - (Html.img - [ - (Html.Attributes.src "/asset/svg/to-logo-no-bg.svg") - ] - [ - ] - ) - ] - ) - ] - ), - (Html.div - [ - (Html.Attributes.class "main-server-version") - ] - [ - (Html.text "Latest Dev. Build (Mon, 10 Sep 2018 10:30:17 +0000)") - ] - ), - (navigation_html) - ] - ) diff --git a/src/background/src/View/Player.elm b/src/background/src/View/Player.elm deleted file mode 100644 index 07dc292..0000000 --- a/src/background/src/View/Player.elm +++ /dev/null @@ -1,97 +0,0 @@ -module View.Player exposing (get_html) - --- Elm ------------------------------------------------------------------------- -import Html -import Html.Attributes --- import Html.Events - --- Extension ------------------------------------------------------------------- -import Struct.BattleSummary -import Struct.Event -import Struct.Player - --------------------------------------------------------------------------------- --- LOCAL ----------------------------------------------------------------------- --------------------------------------------------------------------------------- -get_item_html : ( - String -> - String -> - Struct.BattleSummary.Type -> - (Html.Html Struct.Event.Type) - ) -get_item_html query_url additional_class item = - (Html.a - [ - (Html.Attributes.class additional_class), - (Html.Attributes.href - ( - query_url - ++ "/battle/?id=" - ++ (Struct.BattleSummary.get_id item) - ) - ) - ] - [ - (Html.div - [ - (Html.Attributes.class "battle-summary-name") - ] - [ - (Html.text (Struct.BattleSummary.get_name item)) - ] - ), - (Html.div - [ - (Html.Attributes.class "battle-summary-date") - ] - [ - (Html.text (Struct.BattleSummary.get_last_edit item)) - ] - ) - ] - ) - --------------------------------------------------------------------------------- --- EXPORTED -------------------------------------------------------------------- --------------------------------------------------------------------------------- -get_html : Struct.Player.Type -> (Html.Html Struct.Event.Type) -get_html player = - let - query_url = (Struct.Player.get_query_url player) - in - (Html.div - [ - (Html.Attributes.class "player-summary") - ] - [ - (Html.div - [ - (Html.Attributes.class "player-summary-listing-header") - ] - [ - (Html.text (Struct.Player.get_username player)) - ] - ), - (Html.div - [ - (Html.Attributes.class "player-summary-listing-body") - ] - ( - (List.map - (get_item_html query_url "campaign-link") - (Struct.Player.get_campaigns player) - ) - ++ - (List.map - (get_item_html query_url "invasion-link") - (Struct.Player.get_invasions player) - ) - ++ - (List.map - (get_item_html query_url "event-link") - (Struct.Player.get_events player) - ) - ) - ) - ] - ) |


