aboutsummaryrefslogtreecommitdiff
blob: c5c4eeeae00b0b0a266179a3c63b6a4cd57f2acb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
module View.MainMenu exposing (get_html)

-- Elm -------------------------------------------------------------------------
import Html
import Html.Attributes
import Html.Events

-- Battlemap -------------------------------------------------------------------
import Struct.Error
import Struct.Event
import Struct.Model
import Struct.UI

import Util.Html

import View.SubMenu.Characters
import View.SubMenu.Settings
import View.SubMenu.Status
import View.SubMenu.Timeline

--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
get_menu_button_html : (
      (Maybe Struct.UI.Tab) ->
      Struct.UI.Tab ->
      (Html.Html Struct.Event.Type)
   )
get_menu_button_html selected_tab tab =
   (Html.button
      (
         if ((Just tab) == selected_tab)
         then
            [ (Html.Attributes.disabled True) ]
         else
            [ (Html.Events.onClick (Struct.Event.TabSelected tab)) ]
      )
      [ (Html.text (Struct.UI.to_string tab)) ]
   )

--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type)
get_html model =
   (Html.div
      [
         (Html.Attributes.class "battlemap-main-menu")
      ]
      (List.map
         (get_menu_button_html (Struct.UI.try_getting_displayed_tab model.ui))
         (Struct.UI.get_all_tabs)
      )
   )