From 3c9b7dd9897cb050043175f814d16001d9f1cbe6 Mon Sep 17 00:00:00 2001 From: Jonathan Lamothe Date: Tue, 12 Nov 2019 09:48:15 -0500 Subject: [PATCH] broke Mtlstats.Menu.EditGoalie module off from Mtlstats.Menu --- src/Mtlstats/Control/EditGoalie.hs | 1 + src/Mtlstats/Menu.hs | 5 ---- src/Mtlstats/Menu/EditGoalie.hs | 44 ++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 src/Mtlstats/Menu/EditGoalie.hs diff --git a/src/Mtlstats/Control/EditGoalie.hs b/src/Mtlstats/Control/EditGoalie.hs index 97e538e..12f2fa6 100644 --- a/src/Mtlstats/Control/EditGoalie.hs +++ b/src/Mtlstats/Control/EditGoalie.hs @@ -27,6 +27,7 @@ import Lens.Micro ((^.)) import UI.NCurses as C import Mtlstats.Menu +import Mtlstats.Menu.EditGoalie import Mtlstats.Prompt import Mtlstats.Prompt.EditGoalie import Mtlstats.Types diff --git a/src/Mtlstats/Menu.hs b/src/Mtlstats/Menu.hs index b812ae2..4967b2a 100644 --- a/src/Mtlstats/Menu.hs +++ b/src/Mtlstats/Menu.hs @@ -31,7 +31,6 @@ module Mtlstats.Menu ( gameMonthMenu, gameTypeMenu, editPlayerMenu, - editGoalieMenu, gameGoalieMenu ) where @@ -172,10 +171,6 @@ editPlayerMenu = Menu "*** EDIT PLAYER ***" () $ map , ( '0', "Finished editing", Nothing ) ] --- | The 'Goalie' edit menu -editGoalieMenu :: Menu () -editGoalieMenu = undefined - -- | Game goalie selection menu gameGoalieMenu :: ProgState -> Menu () gameGoalieMenu s = let diff --git a/src/Mtlstats/Menu/EditGoalie.hs b/src/Mtlstats/Menu/EditGoalie.hs new file mode 100644 index 0000000..d685255 --- /dev/null +++ b/src/Mtlstats/Menu/EditGoalie.hs @@ -0,0 +1,44 @@ +{- | + +mtlstats +Copyright (C) 2019 Rhéal Lamothe + + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +-} + +module Mtlstats.Menu.EditGoalie (editGoalieMenu) where + +import Control.Monad.Trans.State (modify) +import Data.Maybe (maybe) +import Lens.Micro ((.~)) + +import Mtlstats.Types +import Mtlstats.Types.Menu + +-- | The 'Goalie' edit menu +editGoalieMenu :: Menu () +editGoalieMenu = Menu "*** EDIT GOALTENDER ***" () $ map + (\(key, label, val) -> MenuItem key label $ modify $ maybe + (progMode .~ MainMenu) + (progMode.editGoalieStateL.egsMode .~) + val) + -- key, label, value + [ ( '1', "Edit number", Just EGNumber ) + , ( '2', "Edit name", Just EGName ) + , ( '3', "Edit YTD stats", Just EGYtd ) + , ( '4', "Edit Lifetime stats", Just EGLifetime ) + , ( 'R', "Return to Main Menu", Nothing ) + ]