Skip to content

Commit

Permalink
Add quick tab switching for see-also messages in rules.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lattyware committed Dec 29, 2020
1 parent d86a986 commit 5baed29
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 20 deletions.
4 changes: 2 additions & 2 deletions client/src/elm/MassiveDecks/Pages/Lobby/Configure.elm
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,8 @@ all wrap config =
, editor = Editor.group "configure-all" Nothing False False
, children =
[ name |> Configurable.wrap identity (.name >> Just) (\v p -> { p | name = v })
, Rules.all |> Configurable.wrap RulesId (.rules >> Just) (\v p -> { p | rules = v })
, Stages.all
, Rules.all wrap |> Configurable.wrap RulesId (.rules >> Just) (\v p -> { p | rules = v })
, Stages.all wrap
|> Configurable.wrap StagesId (.stages >> Just) (\v p -> { p | stages = v })
|> Configurable.wrap identity (.rules >> Just) (\v p -> { p | rules = v })
, Privacy.all (SetPasswordVisibility >> wrap)
Expand Down
7 changes: 4 additions & 3 deletions client/src/elm/MassiveDecks/Pages/Lobby/Configure/Rules.elm
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@ import MassiveDecks.Pages.Lobby.Configure.Configurable as Configurable
import MassiveDecks.Pages.Lobby.Configure.Configurable.Editor as Editor
import MassiveDecks.Pages.Lobby.Configure.Configurable.Model exposing (Configurable)
import MassiveDecks.Pages.Lobby.Configure.Configurable.Validator as Validator
import MassiveDecks.Pages.Lobby.Configure.Messages exposing (Msg)
import MassiveDecks.Pages.Lobby.Configure.Rules.HouseRules as HouseRules
import MassiveDecks.Pages.Lobby.Configure.Rules.Model exposing (..)
import MassiveDecks.Strings as Strings


all : Configurable Id Rules model msg
all =
all : (Msg -> msg) -> Configurable Id Rules model msg
all wrap =
Configurable.group
{ id = All
, editor = Editor.group "rules" Nothing False False
, children =
[ gameRules
, HouseRules.all |> Configurable.wrap HouseRulesId (.houseRules >> Just) (\v p -> { p | houseRules = v })
, HouseRules.all wrap |> Configurable.wrap HouseRulesId (.houseRules >> Just) (\v p -> { p | houseRules = v })
]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import MassiveDecks.Game.Rules as Rules
import MassiveDecks.Pages.Lobby.Configure.Configurable as Configurable
import MassiveDecks.Pages.Lobby.Configure.Configurable.Editor as Editor
import MassiveDecks.Pages.Lobby.Configure.Configurable.Model exposing (Configurable)
import MassiveDecks.Pages.Lobby.Configure.Messages exposing (Msg)
import MassiveDecks.Pages.Lobby.Configure.Rules.HouseRules.ComedyWriter as ComedyWriter
import MassiveDecks.Pages.Lobby.Configure.Rules.HouseRules.CzarChoices as CzarChoices
import MassiveDecks.Pages.Lobby.Configure.Rules.HouseRules.HappyEnding as HappyEnding
Expand All @@ -15,8 +16,8 @@ import MassiveDecks.Pages.Lobby.Configure.Rules.HouseRules.Reboot as Reboot
import MassiveDecks.Strings as Strings


all : Configurable Id Rules.HouseRules model msg
all =
all : (Msg -> msg) -> Configurable Id Rules.HouseRules model msg
all wrap =
Configurable.group
{ id = All
, editor = Editor.group "house-rules" (Just Strings.HouseRulesTitle) False False
Expand All @@ -27,6 +28,6 @@ all =
, ComedyWriter.all |> Configurable.wrap ComedyWriterId (.comedyWriter >> Just) (\v p -> { p | comedyWriter = v })
, NeverHaveIEver.all |> Configurable.wrap NeverHaveIEverId (.neverHaveIEver >> Just) (\v p -> { p | neverHaveIEver = v })
, HappyEnding.all |> Configurable.wrap HappyEndingId (.happyEnding >> Just) (\v p -> { p | happyEnding = v })
, CzarChoices.all |> Configurable.wrap CzarChoicesId (.czarChoices >> Just) (\v p -> { p | czarChoices = v })
, CzarChoices.all wrap |> Configurable.wrap CzarChoicesId (.czarChoices >> Just) (\v p -> { p | czarChoices = v })
]
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
module MassiveDecks.Pages.Lobby.Configure.Rules.HouseRules.CzarChoices exposing (all)

import FontAwesome.Solid as Icon
import MassiveDecks.Components.Form.Message as Message
import MassiveDecks.Game.Rules as Rules
import MassiveDecks.Pages.Lobby.Configure.Configurable as Configurable
import MassiveDecks.Pages.Lobby.Configure.Configurable.Editor as Editor
import MassiveDecks.Pages.Lobby.Configure.Configurable.Model exposing (Configurable)
import MassiveDecks.Pages.Lobby.Configure.Configurable.Validator as Validator
import MassiveDecks.Pages.Lobby.Configure.Messages exposing (Msg(..))
import MassiveDecks.Pages.Lobby.Configure.Model exposing (Tab(..))
import MassiveDecks.Pages.Lobby.Configure.Rules.HouseRules.CzarChoices.Model exposing (..)
import MassiveDecks.Strings as Strings


all : Configurable Id (Maybe Rules.CzarChoices) model msg
all =
all : (Msg -> msg) -> Configurable Id (Maybe Rules.CzarChoices) model msg
all wrap =
Configurable.group
{ id = All
, editor = Editor.group "czar-choices" Nothing False False
, children =
[ enabled |> Configurable.wrapAsToggle default
[ enabled wrap |> Configurable.wrapAsToggle default
, children |> Configurable.wrapMaybe
]
}
Expand All @@ -29,16 +32,17 @@ default =
}


enabled : Configurable Id Bool model msg
enabled =
enabled : (Msg -> msg) -> Configurable Id Bool model msg
enabled wrap =
Configurable.value
{ id = Enabled
, editor = Editor.bool Strings.HouseRuleCzarChoices
, validator = Validator.none
, messages =
always
[ Message.info Strings.HouseRuleCzarChoicesDescription
, Message.info (Strings.SeeAlso { rule = Strings.DuringTitle })
, Message.infoWithFix (Strings.SeeAlso { rule = Strings.DuringTitle })
[ { description = Strings.ConfigureTimeLimits, icon = Icon.eye, action = ChangeTab Stages |> wrap } ]
]
}

Expand Down
16 changes: 10 additions & 6 deletions client/src/elm/MassiveDecks/Pages/Lobby/Configure/Stages.elm
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
module MassiveDecks.Pages.Lobby.Configure.Stages exposing (all)

import FontAwesome.Solid as Icon
import MassiveDecks.Components.Form.Message as Message
import MassiveDecks.Game.Rules as Rules
import MassiveDecks.Pages.Lobby.Configure.Configurable as Configurable
import MassiveDecks.Pages.Lobby.Configure.Configurable.Editor as Editor
import MassiveDecks.Pages.Lobby.Configure.Configurable.Model exposing (Configurable)
import MassiveDecks.Pages.Lobby.Configure.Configurable.Validator as Validator
import MassiveDecks.Pages.Lobby.Configure.Messages exposing (Msg(..))
import MassiveDecks.Pages.Lobby.Configure.Model exposing (Tab(..))
import MassiveDecks.Pages.Lobby.Configure.Stages.Model exposing (..)
import MassiveDecks.Strings as Strings exposing (MdString)

Expand All @@ -15,14 +18,14 @@ defaultStage =
{ duration = Nothing, after = 5 }


all : Configurable Id Rules.Stages model msg
all =
all : (Msg -> msg) -> Configurable Id Rules.Stages model msg
all wrap =
Configurable.group
{ id = All
, editor = Editor.group "time-limits" (Just Strings.ConfigureTimeLimits) False False
, children =
[ mode |> Configurable.wrap identity (.mode >> Just) (\v p -> { p | mode = v })
, starting |> Configurable.wrap identity (.starting >> Just) (\v p -> { p | starting = v })
, starting wrap |> Configurable.wrap identity (.starting >> Just) (\v p -> { p | starting = v })
, alwaysStage "playing" Strings.Playing Strings.PlayingTimeLimitDescription Strings.PlayingAfterDescription Playing
|> Configurable.wrap identity (.playing >> Just) (\v p -> { p | playing = v })
, toggledStage "revealing" Strings.Revealing Strings.RevealingTimeLimitDescription Strings.RevealingAfterDescription Revealing
Expand Down Expand Up @@ -68,8 +71,8 @@ toggledStage id stageName duringDescription afterDescription s =
}


starting : Configurable Id (Maybe Int) model msg
starting =
starting : (Msg -> msg) -> Configurable Id (Maybe Int) model msg
starting wrap =
Configurable.group
{ id = StartingContainer
, editor = Editor.group "starting-time-limits" (Just Strings.Starting) False False
Expand All @@ -81,7 +84,8 @@ starting =
, messages =
always
[ Message.info Strings.StartingTimeLimitDescription
, Message.info (Strings.SeeAlso { rule = Strings.HouseRuleCzarChoices })
, Message.infoWithFix (Strings.SeeAlso { rule = Strings.HouseRuleCzarChoices })
[ { description = Strings.ConfigureRules, icon = Icon.eye, action = Rules |> ChangeTab |> wrap } ]
]
}
]
Expand Down

0 comments on commit 5baed29

Please sign in to comment.