Merge pull request #8 from mtlstats/away-score

prompt for away team score
This commit is contained in:
Jonathan Lamothe 2019-08-24 20:21:15 -04:00 committed by GitHub
commit bb44598b64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View File

@ -48,4 +48,7 @@ handleEvent e = gets (view progMode) >>= \case
| null $ gs ^. homeScore -> do
promptHandler homeScorePrompt e
return True
| null $ gs ^. awayScore -> do
promptHandler awayScorePrompt e
return True
| otherwise -> undefined

View File

@ -25,7 +25,8 @@ module Mtlstats.Prompt (
promptHandler,
numPrompt,
-- * Individual prompts
homeScorePrompt
homeScorePrompt,
awayScorePrompt
) where
import Control.Monad (when)
@ -79,3 +80,7 @@ numPrompt pStr act = Prompt
homeScorePrompt :: Prompt
homeScorePrompt = numPrompt "Home score: " $
modify . (progMode . homeScoreL ?~)
awayScorePrompt :: Prompt
awayScorePrompt = numPrompt "Away score: " $
modify . (progMode . awayScoreL ?~)

View File

@ -42,6 +42,7 @@ draw s = do
NewGame gs
| null $ gs ^. gameType -> drawMenu gameTypeMenu
| null $ gs ^. homeScore -> drawPrompt homeScorePrompt s
| null $ gs ^. awayScore -> drawPrompt awayScorePrompt s
| otherwise -> undefined
C.render
void $ C.setCursorMode cm