From 8dd4896f072e70113afeaf9c52b97574fc8116b4 Mon Sep 17 00:00:00 2001 From: Jonathan Lamothe Date: Mon, 2 Sep 2019 22:38:41 -0400 Subject: [PATCH] place game number header above relevant prompts --- src/Mtlstats/Menu.hs | 2 +- src/Mtlstats/UI.hs | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/Mtlstats/Menu.hs b/src/Mtlstats/Menu.hs index e470a37..712019b 100644 --- a/src/Mtlstats/Menu.hs +++ b/src/Mtlstats/Menu.hs @@ -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" $ diff --git a/src/Mtlstats/UI.hs b/src/Mtlstats/UI.hs index 5ded87c..1b1977e 100644 --- a/src/Mtlstats/UI.hs +++ b/src/Mtlstats/UI.hs @@ -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)"