switch from ncurses to brick #1
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user