aboutsummaryrefslogtreecommitdiff
blob: 8a5291ea49df32494c50cbc737ded4ab90b56542 (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
module Update.SelectTab exposing (apply_to)
-- Elm -------------------------------------------------------------------------

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

--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
apply_to : (
      Struct.Model.Type ->
      Struct.UI.Tab ->
      (Struct.Model.Type, (Cmd Struct.Event.Type))
   )
apply_to model tab =
   if ((Struct.UI.try_getting_displayed_tab model.ui) == (Just tab))
   then
      (
         {model | ui = (Struct.UI.reset_displayed_tab model.ui)},
         Cmd.none
      )
   else
      (
         {model | ui = (Struct.UI.set_displayed_tab model.ui tab)},
         Cmd.none
      )