aboutsummaryrefslogtreecommitdiff
blob: 10737353a44d60303af71cc83697ac7bf9c83d6a (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
55
56
57
58
59
60
61
62
63
64
65
66
module View.SideBar.TabMenu.Timeline exposing (get_html)

-- Elm -------------------------------------------------------------------------
import Array

import Html
import Html.Attributes
--import Html.Events
import Html.Lazy

-- Battlemap -------------------------------------------------------------------
import Struct.Event
import Struct.TurnResult
import Struct.Model

import View.SideBar.TabMenu.Timeline.Attack
import View.SideBar.TabMenu.Timeline.Movement
import View.SideBar.TabMenu.Timeline.WeaponSwitch

--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
get_turn_result_html : (
      Struct.Model.Type ->
      Struct.TurnResult.Type ->
      (Html.Html Struct.Event.Type)
   )
get_turn_result_html model turn_result =
   case turn_result of
      (Struct.TurnResult.Moved movement) ->
         (View.SideBar.TabMenu.Timeline.Movement.get_html model movement)

      (Struct.TurnResult.Attacked attack) ->
         (View.SideBar.TabMenu.Timeline.Attack.get_html model attack)

      (Struct.TurnResult.SwitchedWeapon weapon_switch) ->
         (View.SideBar.TabMenu.Timeline.WeaponSwitch.get_html
            model
            weapon_switch
         )

true_get_html : (
      Struct.Model.Type ->
      (Array.Array Struct.TurnResult.Type) ->
      (Html.Html Struct.Event.Type)
   )
true_get_html model turn_results =
   (Html.div
      [
         (Html.Attributes.class "battlemap-tabmenu-content"),
         (Html.Attributes.class "battlemap-tabmenu-timeline-tab")
      ]
      (Array.toList
         (Array.map
            (get_turn_result_html model)
            turn_results
         )
      )
   )

--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type)
get_html model =
   (Html.Lazy.lazy (true_get_html model) model.timeline)