broke YTD and lifetime menus off from player edit menu

This commit is contained in:
Jonathan Lamothe 2019-11-18 22:11:17 -05:00
parent 9b9feefa4f
commit d7879a92af
2 changed files with 39 additions and 13 deletions

View File

@ -67,10 +67,10 @@ positionC :: Controller
positionC = promptController editPlayerPosPrompt positionC = promptController editPlayerPosPrompt
ytdC :: Controller ytdC :: Controller
ytdC = undefined ytdC = menuControllerWith header editPlayerYtdMenu
lifetimeC :: Controller lifetimeC :: Controller
lifetimeC = undefined lifetimeC = menuControllerWith header editPlayerLtMenu
ytdGoalsC :: Controller ytdGoalsC :: Controller
ytdGoalsC = promptController editPlayerYtdGoalsPrompt ytdGoalsC = promptController editPlayerYtdGoalsPrompt

View File

@ -21,6 +21,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
module Mtlstats.Menu.EditPlayer module Mtlstats.Menu.EditPlayer
( editPlayerMenu ( editPlayerMenu
, editPlayerYtdMenu
, editPlayerLtMenu
) where ) where
import Control.Monad.Trans.State (modify) import Control.Monad.Trans.State (modify)
@ -29,20 +31,44 @@ import Lens.Micro ((.~))
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 $ case mode of
Nothing -> modify $ progMode .~ MainMenu Nothing -> modify $ progMode .~ MainMenu
Just m -> modify $ progMode.editPlayerStateL.epsMode .~ m) Just m -> modify $ progMode.editPlayerStateL.epsMode .~ m)
[ ( '1', "Change number", Just EPNumber ) -- key, label, value
, ( '2', "Change name", Just EPName ) [ ( '1', "Edit number", Just EPNumber )
, ( '3', "Change position", Just EPPosition ) , ( '2', "Edit name", Just EPName )
, ( '4', "YTD goals", Just EPYtdGoals ) , ( '3', "Edit position", Just EPPosition )
, ( '5', "YTD assists", Just EPYtdAssists ) , ( '4', "Edit YTD stats", Just EPYtd )
, ( '6', "YTD penalty mins", Just EPYtdPMin ) , ( '5', "Edit lifetime stats", Just EPLifetime )
, ( '7', "Lifetime goals", Just EPLtGoals ) , ( 'R', "Finished editing", Nothing )
, ( '8', "Lifetime assists", Just EPLtAssists )
, ( '9', "Lifetime penalty mins", Just EPLtPMin )
, ( '0', "Finished editing", Nothing )
] ]
-- | The 'Player' YTD stats edit menu
editPlayerYtdMenu :: Menu ()
editPlayerYtdMenu = editMenu
"*** EDIT PLAYER YEAR-TO-DATE ***"
-- key, label, value
[ ( '1', "Edit YTD goals", EPYtdGoals )
, ( '2', "Edit YTD assists", EPYtdAssists )
, ( '3', "Edit YTD penalty mins", EPYtdPMin )
, ( 'R', "Return to player edit menu", EPMenu )
]
-- | The 'Player' lifetime stats edit menu
editPlayerLtMenu :: Menu ()
editPlayerLtMenu = editMenu
"*** EDIT PLAYER LIFETIME ***"
-- key, label, value
[ ( '1', "Edit lifetime goals", EPLtGoals )
, ( '2', "Edit lifetime assits", EPLtAssists )
, ( '3', "Edit lifetime penalty mins", EPLtPMin )
, ( 'R', "Return to edit player menu", EPMenu )
]
editMenu :: String -> [(Char, String, EditPlayerMode)] -> Menu ()
editMenu title = Menu title () . map
(\(key, label, val) -> MenuItem key label $
modify $ progMode.editPlayerStateL.epsMode .~ val)