implemented editPlayerNamePrompt

This commit is contained in:
Jonathan Lamothe 2019-11-01 06:22:48 -04:00
parent 911a61ba57
commit 5bf5a605aa

View File

@ -34,12 +34,17 @@ import Mtlstats.Util
-- | Prompt to edit a player's number
editPlayerNumPrompt :: Prompt
editPlayerNumPrompt = numPrompt "Player number: " $ \n ->
whenJustM (gets (^.progMode.editPlayerStateL.epsSelectedPlayer)) $ \pid ->
modify
$ (database.dbPlayers %~ modifyNth pid (pNumber .~ n))
. (progMode.editPlayerStateL.epsMode .~ EPMenu)
editPlayerNumPrompt = numPrompt "Player number: " $
editPlayer . (pNumber .~)
-- | Prompt to edit a player's name
editPlayerNamePrompt :: Prompt
editPlayerNamePrompt = undefined
editPlayerNamePrompt = strPrompt "Player name: " $
editPlayer . (pName .~)
editPlayer :: (Player -> Player) -> Action ()
editPlayer f =
whenJustM (gets (^.progMode.editPlayerStateL.epsSelectedPlayer)) $ \pid ->
modify
$ (database.dbPlayers %~ modifyNth pid f)
. (progMode.editPlayerStateL.epsMode .~ EPMenu)