control flow branch for reading database

This commit is contained in:
Jonathan Lamothe
2020-03-11 03:20:38 -04:00
parent ffa241c1f7
commit 87336dcd1d
2 changed files with 13 additions and 6 deletions

View File

@@ -39,7 +39,7 @@ import Mtlstats.Types
dispatch :: ProgState -> Controller dispatch :: ProgState -> Controller
dispatch s = case s^.progMode of dispatch s = case s^.progMode of
TitleScreen -> titleScreenC TitleScreen -> titleScreenC
MainMenu -> mainMenuC MainMenu -> mainMenuC s
NewSeason flag -> newSeasonC flag NewSeason flag -> newSeasonC flag
NewGame gs -> newGameC gs NewGame gs -> newGameC gs
EditMenu -> editMenuC EditMenu -> editMenuC
@@ -49,11 +49,13 @@ dispatch s = case s^.progMode of
EditGoalie egs -> editGoalieC egs EditGoalie egs -> editGoalieC egs
(EditStandings esm) -> editStandingsC esm (EditStandings esm) -> editStandingsC esm
mainMenuC :: Controller mainMenuC :: ProgState -> Controller
mainMenuC = Controller mainMenuC s = if null $ s^.dbName
{ drawController = const $ drawMenu mainMenu then promptController getDBPrompt
, handleController = menuHandler mainMenu else Controller
} { drawController = const $ drawMenu mainMenu
, handleController = menuHandler mainMenu
}
newSeasonC :: Bool -> Controller newSeasonC :: Bool -> Controller
newSeasonC False = promptController newSeasonPrompt newSeasonC False = promptController newSeasonPrompt

View File

@@ -34,6 +34,7 @@ module Mtlstats.Prompt (
numPromptWithFallback, numPromptWithFallback,
selectPrompt, selectPrompt,
-- * Individual prompts -- * Individual prompts
getDBPrompt,
newSeasonPrompt, newSeasonPrompt,
playerNumPrompt, playerNumPrompt,
playerNamePrompt, playerNamePrompt,
@@ -224,6 +225,10 @@ selectPrompt params = Prompt
_ -> return () _ -> return ()
} }
-- | Prompts for the database to load
getDBPrompt :: Prompt
getDBPrompt = undefined
-- | Prompts for a new player's number -- | Prompts for a new player's number
playerNumPrompt :: Prompt playerNumPrompt :: Prompt
playerNumPrompt = numPrompt "Player number: " $ playerNumPrompt = numPrompt "Player number: " $