diff --git a/src/Mtlstats/Control/EditPlayer.hs b/src/Mtlstats/Control/EditPlayer.hs index 7b1e047..46218ba 100644 --- a/src/Mtlstats/Control/EditPlayer.hs +++ b/src/Mtlstats/Control/EditPlayer.hs @@ -87,7 +87,12 @@ nameC = Controller } positionC :: Controller -positionC = undefined +positionC = Controller + { drawController = drawPrompt editPlayerPosPrompt + , handleController = \e -> do + promptHandler editPlayerPosPrompt e + return True + } ytdGoalsC :: Controller ytdGoalsC = undefined diff --git a/src/Mtlstats/Prompt/EditPlayer.hs b/src/Mtlstats/Prompt/EditPlayer.hs index bb439e3..376c9f9 100644 --- a/src/Mtlstats/Prompt/EditPlayer.hs +++ b/src/Mtlstats/Prompt/EditPlayer.hs @@ -22,6 +22,7 @@ along with this program. If not, see . module Mtlstats.Prompt.EditPlayer ( editPlayerNumPrompt , editPlayerNamePrompt + , editPlayerPosPrompt ) where import Control.Monad.Extra (whenJustM) @@ -42,6 +43,11 @@ editPlayerNamePrompt :: Prompt editPlayerNamePrompt = strPrompt "Player name: " $ editPlayer . (pName .~) +-- | Prompt to edit a player's position +editPlayerPosPrompt :: Prompt +editPlayerPosPrompt = strPrompt "Player position: " $ + editPlayer . (pPosition .~) + editPlayer :: (Player -> Player) -> Action () editPlayer f = whenJustM (gets (^.progMode.editPlayerStateL.epsSelectedPlayer)) $ \pid ->