make player/goalie edit return to edit menu on completion

This commit is contained in:
Jonathan Lamothe 2019-12-17 22:47:17 -05:00
parent 235dd4e611
commit 3aedd01b08
2 changed files with 10 additions and 8 deletions

View File

@ -26,19 +26,19 @@ module Mtlstats.Menu.EditGoalie
) where ) where
import Control.Monad.Trans.State (modify) import Control.Monad.Trans.State (modify)
import Data.Maybe (maybe)
import Lens.Micro ((.~)) import Lens.Micro ((.~))
import Mtlstats.Actions
import Mtlstats.Types import Mtlstats.Types
import Mtlstats.Types.Menu import Mtlstats.Types.Menu
-- | The 'Goalie' edit menu -- | The 'Goalie' edit menu
editGoalieMenu :: Menu () editGoalieMenu :: Menu ()
editGoalieMenu = Menu "*** EDIT GOALTENDER ***" () $ map editGoalieMenu = Menu "*** EDIT GOALTENDER ***" () $ map
(\(key, label, val) -> MenuItem key label $ modify $ maybe (\(ch, label, mode) -> MenuItem ch label $
(progMode .~ MainMenu) modify $ case mode of
(progMode.editGoalieStateL.egsMode .~) Nothing -> edit
val) Just m -> progMode.editGoalieStateL.egsMode .~ m)
-- key, label, value -- key, label, value
[ ( '1', "Edit number", Just EGNumber ) [ ( '1', "Edit number", Just EGNumber )
, ( '2', "Edit name", Just EGName ) , ( '2', "Edit name", Just EGName )

View File

@ -28,15 +28,17 @@ module Mtlstats.Menu.EditPlayer
import Control.Monad.Trans.State (modify) import Control.Monad.Trans.State (modify)
import Lens.Micro ((.~)) import Lens.Micro ((.~))
import Mtlstats.Actions
import Mtlstats.Types import Mtlstats.Types
import Mtlstats.Types.Menu import Mtlstats.Types.Menu
-- | The 'Player' edit menu -- | The 'Player' edit menu
editPlayerMenu :: Menu () editPlayerMenu :: Menu ()
editPlayerMenu = Menu "*** EDIT PLAYER ***" () $ map editPlayerMenu = Menu "*** EDIT PLAYER ***" () $ map
(\(ch, label, mode) -> MenuItem ch label $ case mode of (\(ch, label, mode) -> MenuItem ch label $
Nothing -> modify $ progMode .~ MainMenu modify $ case mode of
Just m -> modify $ progMode.editPlayerStateL.epsMode .~ m) Nothing -> edit
Just m -> progMode.editPlayerStateL.epsMode .~ m)
-- key, label, value -- key, label, value
[ ( '1', "Edit number", Just EPNumber ) [ ( '1', "Edit number", Just EPNumber )
, ( '2', "Edit name", Just EPName ) , ( '2', "Edit name", Just EPName )