implemented getPMinsC

This commit is contained in:
Jonathan Lamothe 2019-10-09 22:15:40 -04:00
parent afd2bac7b5
commit 1a481ab49d
2 changed files with 18 additions and 3 deletions

View File

@ -24,7 +24,7 @@ module Mtlstats.Control (dispatch) where
import Control.Monad (join, when)
import Control.Monad.Trans.State (gets, modify)
import Data.Char (toUpper)
import Data.Maybe (fromJust, isJust)
import Data.Maybe (fromJust, fromMaybe, isJust)
import Lens.Micro ((^.), (.~))
import Lens.Micro.Extras (view)
import qualified UI.NCurses as C
@ -254,7 +254,18 @@ pMinPlayerC = Controller
}
getPMinsC :: Controller
getPMinsC = undefined
getPMinsC = Controller
{ drawController = \s -> do
header s
C.drawString $ fromMaybe "" $ do
pid <- s^.progMode.gameStateL.selectedPlayer
player <- nth pid $ s^.database.dbPlayers
Just $ playerSummary player ++ "\n"
drawPrompt assignPMinsPrompt s
, handleController = \e -> do
promptHandler assignPMinsPrompt e
return True
}
reportC :: Controller
reportC = Controller

View File

@ -39,7 +39,8 @@ module Mtlstats.Prompt (
selectPlayerPrompt,
recordGoalPrompt,
recordAssistPrompt,
pMinPlayerPrompt
pMinPlayerPrompt,
assignPMinsPrompt
) where
import Control.Monad (when)
@ -242,5 +243,8 @@ pMinPlayerPrompt = selectPlayerPrompt
Nothing -> modify $ progMode.gameStateL.pMinsRecorded .~ True
Just n -> modify $ progMode.gameStateL.selectedPlayer ?~ n
assignPMinsPrompt :: Prompt
assignPMinsPrompt = undefined
drawSimplePrompt :: String -> ProgState -> C.Update ()
drawSimplePrompt pStr s = C.drawString $ pStr ++ s^.inputBuffer