changed menu style

...to be closer to the original program's menu style
This commit is contained in:
Jonathan Lamothe 2020-01-22 20:59:09 -05:00
parent 4c7a756c5e
commit 72b6f05700
6 changed files with 96 additions and 96 deletions

View File

@ -102,56 +102,56 @@ menuHandler m _ = return $ m^.menuDefault
-- | The main menu
mainMenu :: Menu Bool
mainMenu = Menu "*** MAIN MENU ***" True
[ MenuItem '1' "New Season" $
mainMenu = Menu "MASTER MENU" True
[ MenuItem 'A' "NEW SEASON" $
modify startNewSeason >> return True
, MenuItem '2' "New Game" $
, MenuItem 'B' "NEW GAME" $
modify startNewGame >> return True
, MenuItem '3' "Edit" $
, MenuItem 'C' "EDIT MENU" $
modify edit >> return True
, MenuItem 'X' "Exit" $
, MenuItem 'E' "EXIT" $
saveDatabase dbFname >> return False
]
-- | The new season menu
newSeasonMenu :: Menu ()
newSeasonMenu = Menu "*** SEASON TYPE ***" ()
[ MenuItem 'R' "Regular Season" $ modify
newSeasonMenu = Menu "SEASON TYPE" ()
[ MenuItem 'R' "REGULAR SEASON" $ modify
$ resetYtd
. clearRookies
. resetStandings
. startNewGame
, MenuItem 'P' "Playoffs" $ modify
, MenuItem 'P' "PLAYOFFS" $ modify
$ resetStandings
. startNewGame
]
-- | Requests the month in which the game took place
gameMonthMenu :: Menu ()
gameMonthMenu = Menu "Month:" () $ map
gameMonthMenu = Menu "MONTH:" () $ map
(\(ch, name, val) ->
MenuItem ch name $
modify $ progMode.gameStateL.gameMonth ?~ val)
[ ( 'A', "January", 1 )
, ( 'B', "February", 2 )
, ( 'C', "March", 3 )
, ( 'D', "April", 4 )
, ( 'E', "May", 5 )
, ( 'F', "June", 6 )
, ( 'G', "July", 7 )
, ( 'H', "August", 8 )
, ( 'I', "September", 9 )
, ( 'J', "October", 10 )
, ( 'K', "November", 11 )
, ( 'L', "December", 12 )
[ ( 'A', "JANUARY", 1 )
, ( 'B', "FEBRUARY", 2 )
, ( 'C', "MARCH", 3 )
, ( 'D', "APRIL", 4 )
, ( 'E', "MAY", 5 )
, ( 'F', "JUNE", 6 )
, ( 'G', "JULY", 7 )
, ( 'H', "AUGUST", 8 )
, ( 'I', "SEPTEMBER", 9 )
, ( 'J', "OCTOBER", 10 )
, ( 'K', "NOVEMBER", 11 )
, ( 'L', "DECEMBER", 12 )
]
-- | The game type menu (home/away)
gameTypeMenu :: Menu ()
gameTypeMenu = Menu "Game type:" ()
[ MenuItem '1' "Home Game" $
gameTypeMenu = Menu "GAME TYPE:" ()
[ MenuItem 'H' "HOME GAME" $
modify $ progMode.gameStateL.gameType ?~ HomeGame
, MenuItem '2' "Away Game" $
, MenuItem 'A' "AWAY GAME" $
modify $ progMode.gameStateL.gameType ?~ AwayGame
]
@ -172,17 +172,17 @@ gameGoalieMenu s = let
-- | The edit menu
editMenu :: Menu ()
editMenu = Menu "*** EDIT ***" ()
[ MenuItem '1' "Create Player" $
editMenu = Menu "EDIT MENU" ()
[ MenuItem 'A' "CREATE PLAYER" $
modify createPlayer
, MenuItem '2' "Create Goalie" $
, MenuItem 'B' "CREATE GOALIE" $
modify createGoalie
, MenuItem '3' "Edit Player" $
, MenuItem 'C' "EDIT PLAYER" $
modify editPlayer
, MenuItem '4' "Edit Goalie" $
, MenuItem 'D' "EDIT GOALIE" $
modify editGoalie
, MenuItem '5' "Edit Standings" $
, MenuItem 'E' "EDIT STANDINGS" $
modify editStandings
, MenuItem 'R' "Return to Main Menu" $
, MenuItem 'R' "RETURN TO MAIN MENU" $
modify backHome
]

View File

@ -34,17 +34,17 @@ import Mtlstats.Types.Menu
-- | The 'Goalie' edit menu
editGoalieMenu :: Menu ()
editGoalieMenu = Menu "*** EDIT GOALTENDER ***" () $ map
editGoalieMenu = Menu "EDIT GOALTENDER" () $ map
(\(ch, label, action) -> MenuItem ch label $ modify action)
-- key, label, value
[ ( '1', "Edit number", set EGNumber )
, ( '2', "Edit name", set EGName )
, ( '3', "Toggle rookie flag", toggleRookie )
, ( '4', "Toggle active flag", toggleActive )
, ( '5', "Edit YTD stats", set EGYtd )
, ( '6', "Edit Lifetime stats", set EGLifetime )
, ( 'R', "Return to Edit Menu", edit )
[ ( 'A', "EDIT NUMBER", set EGNumber )
, ( 'B', "EDIT NAME", set EGName )
, ( 'C', "TOGGLE ROOKIE FLAG", toggleRookie )
, ( 'D', "TOGGLE ACTIVE FLAG", toggleActive )
, ( 'E', "EDIT YTD STATS", set EGYtd )
, ( 'F', "EDIT LIFETIME STATS", set EGLifetime )
, ( 'R', "RETURN TO EDIT MENU", edit )
]
where
@ -54,33 +54,33 @@ editGoalieMenu = Menu "*** EDIT GOALTENDER ***" () $ map
-- | The 'Goalie' YTD edit menu
editGoalieYtdMenu :: Menu ()
editGoalieYtdMenu = editMenu "*** EDIT GOALTENDER YEAR-TO-DATE ***"
editGoalieYtdMenu = editMenu "EDIT GOALTENDER YEAR-TO-DATE"
-- key, label, value
[ ( '1', "Edit all YTD stats", EGYtdGames True )
, ( '2', "Edit YTD games", EGYtdGames False )
, ( '3', "Edit YTD minutes", EGYtdMins False )
, ( '4', "Edit YTD goals", EGYtdGoals False )
, ( '5', "Edit YTD shutouts", EGYtdShutouts False )
, ( '6', "Edit YTD wins", EGYtdWins False )
, ( '7', "Edit YTD losses", EGYtdLosses False )
, ( '8', "Edit YTD ties", EGYtdTies )
, ( 'R', "Return to edit menu", EGMenu )
[ ( 'A', "EDIT ALL YTD STATS", EGYtdGames True )
, ( 'B', "EDIT YTD GAMES", EGYtdGames False )
, ( 'C', "EDIT YTD MINUTES", EGYtdMins False )
, ( 'D', "EDIT YTD GOALS", EGYtdGoals False )
, ( 'E', "EDIT YTD SHUTOUTS", EGYtdShutouts False )
, ( 'F', "EDIT YTD WINS", EGYtdWins False )
, ( 'G', "EDIT YTD LOSSES", EGYtdLosses False )
, ( 'H', "EDIT YTD TIES", EGYtdTies )
, ( 'R', "RETURN TO EDIT MENU", EGMenu )
]
-- | The 'Goalie' lifetime edit menu
editGoalieLtMenu :: Menu ()
editGoalieLtMenu = editMenu
"*** EDIT GOALTENDER LIFETIME ***"
"EDIT GOALTENDER LIFETIME"
-- key, label, value
[ ( '1', "Edit all lifetime stats", EGLtGames True )
, ( '2', "Edit lifetime games", EGLtGames False )
, ( '3', "Edit lifetime minutes", EGLtMins False )
, ( '4', "Edit lifetime goals", EGLtGoals False )
, ( '5', "Edit lifetime shutouts", EGLtShutouts False )
, ( '6', "Edit lifetime wins", EGLtWins False )
, ( '7', "Edit lifetime losses", EGLtLosses False )
, ( '8', "Edit lifetime ties", EGLtTies )
, ( 'R', "Return to edit menu", EGMenu )
[ ( 'A', "EDIT ALL LIFETIME STATS", EGLtGames True )
, ( 'B', "EDIT LIFETIME GAMES", EGLtGames False )
, ( 'C', "EDIT LIFETIME MINUTES", EGLtMins False )
, ( 'D', "EDIT LIFETIME GOALS", EGLtGoals False )
, ( 'E', "EDIT LIFETIME SHUTOUTS", EGLtShutouts False )
, ( 'F', "EDIT LIFETIME WINS", EGLtWins False )
, ( 'G', "EDIT LIFETIME LOSSES", EGLtLosses False )
, ( 'H', "EDIT LIFETIME TIES", EGLtTies )
, ( 'R', "RETURN TO EDIT MENU", EGMenu )
]
editMenu :: String -> [(Char, String, EditGoalieMode)] -> Menu ()

View File

@ -34,18 +34,18 @@ import Mtlstats.Types.Menu
-- | The 'Player' edit menu
editPlayerMenu :: Menu ()
editPlayerMenu = Menu "*** EDIT PLAYER ***" () $ map
editPlayerMenu = Menu "EDIT PLAYER" () $ map
(\(ch, label, action) -> MenuItem ch label $ modify action)
-- key, label, value
[ ( '1', "Edit number", set EPNumber )
, ( '2', "Edit name", set EPName )
, ( '3', "Edit position", set EPPosition )
, ( '4', "Toggle rookie flag", toggleRookie )
, ( '5', "Toggle active flag", toggleActive )
, ( '6', "Edit YTD stats", set EPYtd )
, ( '7', "Edit lifetime stats", set EPLifetime )
, ( 'R', "Return to Edit Menu", edit )
[ ( 'A', "EDIT NUMBER", set EPNumber )
, ( 'B', "EDIT NAME", set EPName )
, ( 'C', "EDIT POSITION", set EPPosition )
, ( 'D', "TOGGLE ROOKIE FLAG", toggleRookie )
, ( 'E', "TOGGLE ACTIVE FLAG", toggleActive )
, ( 'F', "EDIT YTD STATS", set EPYtd )
, ( 'G', "EDIT LIFETIME STATS", set EPLifetime )
, ( 'R', "RETURN TO EDIT MENU", edit )
]
where
@ -56,25 +56,25 @@ editPlayerMenu = Menu "*** EDIT PLAYER ***" () $ map
-- | The 'Player' YTD stats edit menu
editPlayerYtdMenu :: Menu ()
editPlayerYtdMenu = editMenu
"*** EDIT PLAYER YEAR-TO-DATE ***"
"EDIT PLAYER YEAR-TO-DATE"
-- key, label, value
[ ( '1', "Edit all YTD stats", EPYtdGoals True )
, ( '2', "Edit YTD goals", EPYtdGoals False )
, ( '3', "Edit YTD assists", EPYtdAssists False )
, ( '4', "Edit YTD penalty mins", EPYtdPMin )
, ( 'R', "Return to player edit menu", EPMenu )
[ ( 'A', "EDIT ALL YTD STATS", EPYtdGoals True )
, ( 'B', "EDIT YTD GOALS", EPYtdGoals False )
, ( 'C', "EDIT YTD ASSISTS", EPYtdAssists False )
, ( 'D', "EDIT YTD PENALTY MINS", EPYtdPMin )
, ( 'R', "RETURN TO PLAYER EDIT MENU", EPMenu )
]
-- | The 'Player' lifetime stats edit menu
editPlayerLtMenu :: Menu ()
editPlayerLtMenu = editMenu
"*** EDIT PLAYER LIFETIME ***"
"EDIT PLAYER LIFETIME"
-- key, label, value
[ ( '1', "Edit all lifetime stats", EPLtGoals True )
, ( '2', "Edit lifetime goals", EPLtGoals False )
, ( '3', "Edit lifetime assits", EPLtAssists False )
, ( '4', "Edit lifetime penalty mins", EPLtPMin )
, ( 'R', "Return to edit player menu", EPMenu )
[ ( 'A', "EDIT ALL LIFETIME STATS", EPLtGoals True )
, ( 'B', "EDIT LIFETIME GOALS", EPLtGoals False )
, ( 'C', "EDIT LIFETIME ASSITS", EPLtAssists False )
, ( 'D', "EDIT LIFETIME PENALTY MINS", EPLtPMin )
, ( 'R', "RETURN TO EDIT PLAYER MENU", EPMenu )
]
editMenu :: String -> [(Char, String, EditPlayerMode)] -> Menu ()

View File

@ -32,12 +32,12 @@ import Mtlstats.Actions.EditStandings
import Mtlstats.Types.Menu
editStandingsMenu :: Menu ()
editStandingsMenu = Menu "*** EDIT STANDINGS ***" ()
[ MenuItem '1' "Edit home standings" $
editStandingsMenu = Menu "EDIT STANDINGS" ()
[ MenuItem 'A' "EDIT HOME STANDINGS" $
modify editHomeStandings
, MenuItem '2' "Edit road standings" $
, MenuItem 'B' "EDIT ROAD STANDINGS" $
modify editAwayStandings
, MenuItem 'R' "Return to main menu" $
, MenuItem 'R' "RETURN TO MAIN MENU" $
modify backHome
]
@ -48,17 +48,17 @@ editAwayStandingsMenu :: Menu ()
editAwayStandingsMenu = subMenu "ROAD"
subMenu :: String -> Menu ()
subMenu str = Menu ("*** " ++ str ++ " STANDINGS ***") ()
[ MenuItem '1' "Edit wins" $
subMenu str = Menu (str ++ " STANDINGS") ()
[ MenuItem 'W' "EDIT WINS" $
modify editWins
, MenuItem '2' "Edit losses" $
, MenuItem 'L' "EDIT LOSSES" $
modify editLosses
, MenuItem '3' "Edit overtime games" $
, MenuItem 'O' "EDIT OVERTIME GAMES" $
modify editOvertime
, MenuItem '4' "Edit goals for" $
, MenuItem 'F' "EDIT GOALS FOR" $
modify editGoalsFor
, MenuItem '5' "Edit goals against" $
, MenuItem 'A' "EDIT GOALS AGAINST" $
modify editGoalsAgainst
, MenuItem 'R' "Return to edit standings menu" $
, MenuItem 'R' "RETURN TO EDIT STANDINGS MENU" $
modify editStandings
]

View File

@ -65,8 +65,8 @@ makeLenses ''Menu
makeLenses ''MenuItem
instance Show (Menu a) where
show m = m ^. menuTitle ++ "\n" ++ items
show m = m ^. menuTitle ++ "\n\n" ++ items
where items = unlines $ map show $ m ^. menuItems
instance Show (MenuItem a) where
show i = [i ^. miKey] ++ ") " ++ i ^. miDescription
show i = [i ^. miKey] ++ ": " ++ i ^. miDescription

View File

@ -41,7 +41,7 @@ showSpec = describe "show" $
, MenuItem '2' "Item 2" $ return ()
]
expected =
"Foo\n\
\1) Item 1\n\
\2) Item 2\n"
"Foo\n\n\
\1: Item 1\n\
\2: Item 2\n"
in show menu `shouldBe` expected