summaryrefslogtreecommitdiff
blob: 6cf853cffef4229d9013e559fb974f53feef407e (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
module Struct.UI exposing
   (
      Type,
      Tab(..),
      default,
      -- Tab
      try_getting_displayed_tab,
      set_displayed_tab,
      reset_displayed_tab,
      to_string
   )

-- Main Menu -------------------------------------------------------------------

--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
--------------------------------------------------------------------------------
type Tab =
   CampaignsTab
   | InvasionsTab
   | EventsTab
   | CharactersTab
   | MapsEditorTab
   | AccountTab

type alias Type =
   {
      displayed_tab : (Maybe Tab)
   }

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

--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
default : Type
default =
   {
      displayed_tab = Nothing
   }

-- Tab -------------------------------------------------------------------------
try_getting_displayed_tab : Type -> (Maybe Tab)
try_getting_displayed_tab ui = ui.displayed_tab

set_displayed_tab : Tab -> Type -> Type
set_displayed_tab tab ui = {ui | displayed_tab = (Just tab)}

reset_displayed_tab : Type -> Type
reset_displayed_tab ui = {ui | displayed_tab = Nothing}

to_string : Tab -> String
to_string tab =
   case tab of
      CampaignsTab -> "Campaigns"
      InvasionsTab -> "Invasions"
      EventsTab -> "Events"
      CharactersTab -> "Character Editor"
      MapsEditorTab -> "Map Editor"
      AccountTab -> "Account Settings"