From 9ba91f1f0171ef23ebc0f52b0210cf2e0c17ea86 Mon Sep 17 00:00:00 2001 From: Jonathan Lamothe Date: Sun, 25 Aug 2019 10:04:37 -0400 Subject: [PATCH] prompt for other team --- src/Mtlstats/Events.hs | 3 +++ src/Mtlstats/Prompt.hs | 5 +++++ src/Mtlstats/UI.hs | 1 + 3 files changed, 9 insertions(+) diff --git a/src/Mtlstats/Events.hs b/src/Mtlstats/Events.hs index 52ad1cc..feeff2a 100644 --- a/src/Mtlstats/Events.hs +++ b/src/Mtlstats/Events.hs @@ -45,6 +45,9 @@ handleEvent e = gets (view progMode) >>= \case | null $ gs ^. gameType -> do menuHandler gameTypeMenu e return True + | null $ gs ^. otherTeam -> do + promptHandler otherTeamPrompt e + return True | null $ gs ^. homeScore -> do promptHandler homeScorePrompt e return True diff --git a/src/Mtlstats/Prompt.hs b/src/Mtlstats/Prompt.hs index cd66019..e979ceb 100644 --- a/src/Mtlstats/Prompt.hs +++ b/src/Mtlstats/Prompt.hs @@ -26,6 +26,7 @@ module Mtlstats.Prompt ( strPrompt, numPrompt, -- * Individual prompts + otherTeamPrompt, homeScorePrompt, awayScorePrompt ) where @@ -92,6 +93,10 @@ numPrompt pStr act = Prompt , promptFunctionKey = const $ return () } +otherTeamPrompt :: Prompt +otherTeamPrompt = strPrompt "Other team: " $ + modify . (progMode . otherTeamL .~) + homeScorePrompt :: Prompt homeScorePrompt = numPrompt "Home score: " $ modify . (progMode . homeScoreL ?~) diff --git a/src/Mtlstats/UI.hs b/src/Mtlstats/UI.hs index 42d296f..95940f2 100644 --- a/src/Mtlstats/UI.hs +++ b/src/Mtlstats/UI.hs @@ -41,6 +41,7 @@ draw s = do NewSeason -> drawMenu newSeasonMenu NewGame gs | null $ gs ^. gameType -> drawMenu gameTypeMenu + | null $ gs ^. otherTeam -> drawPrompt otherTeamPrompt s | null $ gs ^. homeScore -> drawPrompt homeScorePrompt s | null $ gs ^. awayScore -> drawPrompt awayScorePrompt s | otherwise -> undefined