switch from ncurses to brick #1

Merged
jlamothe merged 21 commits from brick into dev 2023-06-02 15:28:41 -04:00
3 changed files with 6 additions and 6 deletions
Showing only changes of commit 886cf0b243 - Show all commits

View File

@ -26,14 +26,13 @@ import Brick.Main (App (..), halt, showFirstCursor)
import Brick.Types (BrickEvent (VtyEvent), Widget)
import Brick.Util (on)
import Brick.Widgets.Core (fill)
import Control.Monad.State.Class (gets)
import Graphics.Vty.Attributes.Color (blue, white)
import Graphics.Vty.Input.Events
( Event (EvKey)
, Modifier (MCtrl)
, Key (KChar)
)
import Lens.Micro (to)
import Lens.Micro.Mtl (use)
import Mtlstats.Control
import Mtlstats.Types
@ -57,7 +56,7 @@ draw s =
handler :: Handler ()
handler (VtyEvent (EvKey (KChar 'c') [MCtrl])) = halt
handler e = do
c <- use (to dispatch)
c <- gets dispatch
handleController c e
myAttrMap :: AttrMap

View File

@ -24,6 +24,7 @@ module Mtlstats.Control.CreateGoalie (createGoalieC) where
import Brick.Widgets.Core (str)
import Control.Monad.State.Class (gets, modify)
import Lens.Micro ((^.), (.~), (?~), (%~), to)
import Lens.Micro.Mtl ((.=))
import Mtlstats.Actions
import Mtlstats.Format
@ -63,7 +64,7 @@ getActiveFlagC :: Controller
getActiveFlagC = Controller
{ drawController = const $ str "Is this goalie active? (Y/N)"
, handleController = \e ->
modify $ progMode.createGoalieStateL.cgsActiveFlag .~ ynHandler e
progMode.createGoalieStateL.cgsActiveFlag .= ynHandler e
}
confirmCreateGoalieC :: Controller

View File

@ -24,7 +24,7 @@ module Mtlstats.Control.CreatePlayer (createPlayerC) where
import Brick.Widgets.Core (str)
import Control.Monad.State.Class (gets, modify)
import Lens.Micro ((^.), (.~), (?~), (%~), to)
import Lens.Micro.Mtl ((.=))
import Lens.Micro.Mtl ((.=), use)
import Mtlstats.Actions
import Mtlstats.Format
@ -85,7 +85,7 @@ confirmCreatePlayerC = Controller
, "Create player: are you sure? (Y/N)"
]
, handleController = \e -> do
cps <- gets (^.progMode.createPlayerStateL)
cps <- use $ progMode.createPlayerStateL
let
success = cps^.cpsSuccessCallback
failure = cps^.cpsFailureCallback