diff --git a/client/src/elm/MassiveDecks/Pages/Lobby/Configure.elm b/client/src/elm/MassiveDecks/Pages/Lobby/Configure.elm index 139cac83..b2a18319 100644 --- a/client/src/elm/MassiveDecks/Pages/Lobby/Configure.elm +++ b/client/src/elm/MassiveDecks/Pages/Lobby/Configure.elm @@ -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) diff --git a/client/src/elm/MassiveDecks/Pages/Lobby/Configure/Rules.elm b/client/src/elm/MassiveDecks/Pages/Lobby/Configure/Rules.elm index 0d7dde00..9d8c171e 100644 --- a/client/src/elm/MassiveDecks/Pages/Lobby/Configure/Rules.elm +++ b/client/src/elm/MassiveDecks/Pages/Lobby/Configure/Rules.elm @@ -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 }) ] } diff --git a/client/src/elm/MassiveDecks/Pages/Lobby/Configure/Rules/HouseRules.elm b/client/src/elm/MassiveDecks/Pages/Lobby/Configure/Rules/HouseRules.elm index 8657ecc1..25866855 100644 --- a/client/src/elm/MassiveDecks/Pages/Lobby/Configure/Rules/HouseRules.elm +++ b/client/src/elm/MassiveDecks/Pages/Lobby/Configure/Rules/HouseRules.elm @@ -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 @@ -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 @@ -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 }) ] } diff --git a/client/src/elm/MassiveDecks/Pages/Lobby/Configure/Rules/HouseRules/CzarChoices.elm b/client/src/elm/MassiveDecks/Pages/Lobby/Configure/Rules/HouseRules/CzarChoices.elm index a9a01640..313b41b3 100644 --- a/client/src/elm/MassiveDecks/Pages/Lobby/Configure/Rules/HouseRules/CzarChoices.elm +++ b/client/src/elm/MassiveDecks/Pages/Lobby/Configure/Rules/HouseRules/CzarChoices.elm @@ -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 ] } @@ -29,8 +32,8 @@ 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 @@ -38,7 +41,8 @@ enabled = , 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 } ] ] } diff --git a/client/src/elm/MassiveDecks/Pages/Lobby/Configure/Stages.elm b/client/src/elm/MassiveDecks/Pages/Lobby/Configure/Stages.elm index 6a8c9ef2..f8015b31 100644 --- a/client/src/elm/MassiveDecks/Pages/Lobby/Configure/Stages.elm +++ b/client/src/elm/MassiveDecks/Pages/Lobby/Configure/Stages.elm @@ -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) @@ -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 @@ -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 @@ -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 } ] ] } ]