place game number header above relevant prompts

This commit is contained in:
Jonathan Lamothe 2019-09-02 22:38:41 -04:00
parent 6136151614
commit 8dd4896f07
2 changed files with 14 additions and 9 deletions

View File

@ -95,7 +95,7 @@ gameMonthMenu = Menu "Month:" () $ map
-- | The game type menu (home/away)
gameTypeMenu :: Menu ()
gameTypeMenu = Menu "*** GAME TYPE ***" ()
gameTypeMenu = Menu "Game type:" ()
[ MenuItem '1' "Home Game" $
modify $ progMode.gameStateL.gameType ?~ HomeGame
, MenuItem '2' "Away Game" $

View File

@ -25,6 +25,7 @@ import Control.Monad (void)
import Lens.Micro ((^.))
import qualified UI.NCurses as C
import Mtlstats.Format
import Mtlstats.Menu
import Mtlstats.Prompt
import Mtlstats.Types
@ -40,18 +41,22 @@ draw s = do
MainMenu -> drawMenu mainMenu
NewSeason -> drawMenu newSeasonMenu
NewGame gs
| null $ gs^.gameYear -> drawPrompt gameYearPrompt s
| null $ gs^.gameMonth -> drawMenu gameMonthMenu
| null $ gs^.gameDay -> drawPrompt gameDayPrompt s
| null $ gs^.gameType -> drawMenu gameTypeMenu
| null $ gs^.otherTeam -> drawPrompt otherTeamPrompt s
| null $ gs^.homeScore -> drawPrompt homeScorePrompt s
| null $ gs^.awayScore -> drawPrompt awayScorePrompt s
| null $ gs^.overtimeFlag -> overtimePrompt
| null $ gs^.gameYear -> header s >> drawPrompt gameYearPrompt s
| null $ gs^.gameMonth -> header s >> drawMenu gameMonthMenu
| null $ gs^.gameDay -> header s >> drawPrompt gameDayPrompt s
| null $ gs^.gameType -> header s >> drawMenu gameTypeMenu
| null $ gs^.otherTeam -> header s >> drawPrompt otherTeamPrompt s
| null $ gs^.homeScore -> header s >> drawPrompt homeScorePrompt s
| null $ gs^.awayScore -> header s >> drawPrompt awayScorePrompt s
| null $ gs^.overtimeFlag -> header s >> overtimePrompt
| otherwise -> undefined
C.render
void $ C.setCursorMode cm
header :: ProgState -> C.Update ()
header s = C.drawString $
"*** GAME " ++ padNum 2 (s^.database.dbGames) ++ " ***\n"
overtimePrompt :: C.Update C.CursorMode
overtimePrompt = do
C.drawString "Did the game go into overtime? (Y/N)"