switch from ncurses to brick #1

Merged
jlamothe merged 21 commits from brick into dev 2023-06-02 15:28:41 -04:00
2 changed files with 14 additions and 7 deletions
Showing only changes of commit 284a8c6725 - Show all commits

View File

@ -24,7 +24,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
module Mtlstats.Control.EditStandings (editStandingsC) where module Mtlstats.Control.EditStandings (editStandingsC) where
import Brick.Types (Widget) import Brick.Types (Widget)
import Brick.Widgets.Core (str, vBox) import Brick.Widgets.Core (vBox)
import Lens.Micro ((^.)) import Lens.Micro ((^.))
import Mtlstats.Format import Mtlstats.Format
@ -34,6 +34,7 @@ import Mtlstats.Prompt
import Mtlstats.Prompt.EditStandings import Mtlstats.Prompt.EditStandings
import Mtlstats.Types import Mtlstats.Types
import Mtlstats.Types.Menu import Mtlstats.Types.Menu
import Mtlstats.Util
-- | Controller for the edit standings menu -- | Controller for the edit standings menu
editStandingsC :: EditStandingsMode -> Controller editStandingsC :: EditStandingsMode -> Controller
@ -75,7 +76,10 @@ header s w = let
[ ( "HOME", valsFor home ) [ ( "HOME", valsFor home )
, ( "ROAD", valsFor away ) , ( "ROAD", valsFor away )
] ]
in vBox $ map str (table ++ [""]) ++ [w] in vBox
[ linesToWidget $ table ++ [""]
, w
]
valsFor :: GameStats -> [Int] valsFor :: GameStats -> [Int]
valsFor gs = valsFor gs =

View File

@ -103,7 +103,7 @@ verifyDataC :: Controller
verifyDataC = Controller verifyDataC = Controller
{ drawController = \s -> let { drawController = \s -> let
gs = s^.progMode.gameStateL gs = s^.progMode.gameStateL
in header s $ vBox $ map str $ in header s $ linesToWidget $
[""] ++ [""] ++
labelTable labelTable
[ ( "Date", gameDate gs ) [ ( "Date", gameDate gs )
@ -172,7 +172,7 @@ confirmGoalDataC = Controller
[ "" [ ""
, "Is the above information correct? (Y/N)" , "Is the above information correct? (Y/N)"
] ]
in vBox $ map str msg in linesToWidget msg
, handleController = \e -> do , handleController = \e -> do
case ynHandler e of case ynHandler e of
Just True -> modify recordGoalAssists Just True -> modify recordGoalAssists
@ -201,7 +201,7 @@ getPMinsC = Controller
reportC :: Controller reportC :: Controller
reportC = Controller reportC = Controller
{ drawController = viewport () Vertical . hCenter . vBox . map str . { drawController = viewport () Vertical . hCenter . linesToWidget .
displayReport reportCols displayReport reportCols
, handleController = \e -> do , handleController = \e -> do
scr <- use scroller scr <- use scroller
@ -239,8 +239,11 @@ monthHeader s w = let
, "NOVEMBER" , "NOVEMBER"
, "DECEMBER" , "DECEMBER"
] ]
in header s $ vBox $ map (hCenter . str) in header s $ vBox
(["MONTH:", ""] ++ table ++ [""]) ++ [w] [ linesToWidgetC $
["MONTH:", ""] ++ table ++ [""]
, w
]
gameGoal :: ProgState -> (Int, Int) gameGoal :: ProgState -> (Int, Int)
gameGoal s = gameGoal s =