minor stylistic edits
This commit is contained in:
parent
01457dbe6f
commit
17b3f9a03e
|
@ -24,6 +24,7 @@ module Mtlstats.Control.CreatePlayer (createPlayerC) where
|
||||||
import Brick.Widgets.Core (str)
|
import Brick.Widgets.Core (str)
|
||||||
import Control.Monad.State.Class (gets, modify)
|
import Control.Monad.State.Class (gets, modify)
|
||||||
import Lens.Micro ((^.), (.~), (?~), (%~), to)
|
import Lens.Micro ((^.), (.~), (?~), (%~), to)
|
||||||
|
import Lens.Micro.Mtl ((.=))
|
||||||
|
|
||||||
import Mtlstats.Actions
|
import Mtlstats.Actions
|
||||||
import Mtlstats.Format
|
import Mtlstats.Format
|
||||||
|
@ -66,7 +67,7 @@ getActiveFlagC :: Controller
|
||||||
getActiveFlagC = Controller
|
getActiveFlagC = Controller
|
||||||
{ drawController = const $ str "Is the player active? (Y/N)"
|
{ drawController = const $ str "Is the player active? (Y/N)"
|
||||||
, handleController = \e ->
|
, handleController = \e ->
|
||||||
modify $ progMode.createPlayerStateL.cpsActiveFlag .~ ynHandler e
|
progMode.createPlayerStateL.cpsActiveFlag .= ynHandler e
|
||||||
}
|
}
|
||||||
|
|
||||||
confirmCreatePlayerC :: Controller
|
confirmCreatePlayerC :: Controller
|
||||||
|
|
|
@ -25,9 +25,10 @@ module Mtlstats.Control.EditGoalie (editGoalieC) where
|
||||||
|
|
||||||
import Brick.Types (Widget)
|
import Brick.Types (Widget)
|
||||||
import Brick.Widgets.Core (str, vBox)
|
import Brick.Widgets.Core (str, vBox)
|
||||||
import Control.Monad.State.Class (gets, modify)
|
import Control.Monad.State.Class (modify)
|
||||||
import Data.Maybe (fromMaybe)
|
import Data.Maybe (fromMaybe)
|
||||||
import Lens.Micro ((^.), (.~), (%~))
|
import Lens.Micro ((^.), (.~), (%~))
|
||||||
|
import Lens.Micro.Mtl (use)
|
||||||
|
|
||||||
import Mtlstats.Actions
|
import Mtlstats.Actions
|
||||||
import Mtlstats.Handlers
|
import Mtlstats.Handlers
|
||||||
|
@ -99,7 +100,7 @@ deleteC _ = Controller
|
||||||
in str $ hdr ++ "Are you sure you want to delete this goalie? (Y/N)"
|
in str $ hdr ++ "Are you sure you want to delete this goalie? (Y/N)"
|
||||||
, handleController = \e -> case ynHandler e of
|
, handleController = \e -> case ynHandler e of
|
||||||
Just True -> do
|
Just True -> do
|
||||||
gets (^.progMode.editGoalieStateL.egsSelectedGoalie) >>= mapM_
|
use (progMode.editGoalieStateL.egsSelectedGoalie) >>= mapM_
|
||||||
(\gid -> modify $ database.dbGoalies %~ dropNth gid)
|
(\gid -> modify $ database.dbGoalies %~ dropNth gid)
|
||||||
modify edit
|
modify edit
|
||||||
Just False -> modify $ progMode.editGoalieStateL.egsMode .~ EGMenu
|
Just False -> modify $ progMode.editGoalieStateL.egsMode .~ EGMenu
|
||||||
|
|
|
@ -23,9 +23,10 @@ module Mtlstats.Control.EditPlayer (editPlayerC) where
|
||||||
|
|
||||||
import Brick.Types (Widget)
|
import Brick.Types (Widget)
|
||||||
import Brick.Widgets.Core (emptyWidget, str, vBox)
|
import Brick.Widgets.Core (emptyWidget, str, vBox)
|
||||||
import Control.Monad.State.Class (gets, modify)
|
import Control.Monad.State.Class (modify)
|
||||||
import Data.Maybe (fromMaybe)
|
import Data.Maybe (fromMaybe)
|
||||||
import Lens.Micro ((^.), (.~), (%~))
|
import Lens.Micro ((^.), (.~), (%~))
|
||||||
|
import Lens.Micro.Mtl (use)
|
||||||
|
|
||||||
import Mtlstats.Actions
|
import Mtlstats.Actions
|
||||||
import Mtlstats.Handlers
|
import Mtlstats.Handlers
|
||||||
|
@ -90,7 +91,7 @@ deleteC _ = Controller
|
||||||
in str $ hdr ++ "Are you sure you want to delete this player? (Y/N)"
|
in str $ hdr ++ "Are you sure you want to delete this player? (Y/N)"
|
||||||
, handleController = \e -> case ynHandler e of
|
, handleController = \e -> case ynHandler e of
|
||||||
Just True -> do
|
Just True -> do
|
||||||
gets (^.progMode.editPlayerStateL.epsSelectedPlayer) >>= mapM_
|
use (progMode.editPlayerStateL.epsSelectedPlayer) >>= mapM_
|
||||||
(\pid -> modify $ database.dbPlayers %~ dropNth pid)
|
(\pid -> modify $ database.dbPlayers %~ dropNth pid)
|
||||||
modify edit
|
modify edit
|
||||||
Just False -> modify $ progMode.editPlayerStateL.epsMode .~ EPMenu
|
Just False -> modify $ progMode.editPlayerStateL.epsMode .~ EPMenu
|
||||||
|
|
|
@ -37,7 +37,7 @@ import Graphics.Vty.Input.Events
|
||||||
, Key (KDown, KHome, KEnter, KUp)
|
, Key (KDown, KHome, KEnter, KUp)
|
||||||
)
|
)
|
||||||
import Lens.Micro ((^.), (.~))
|
import Lens.Micro ((^.), (.~))
|
||||||
import Lens.Micro.Mtl (use)
|
import Lens.Micro.Mtl ((.=), use)
|
||||||
|
|
||||||
import Mtlstats.Actions
|
import Mtlstats.Actions
|
||||||
import Mtlstats.Actions.NewGame
|
import Mtlstats.Actions.NewGame
|
||||||
|
@ -96,7 +96,7 @@ overtimeFlagC = Controller
|
||||||
{ drawController = \s -> header s $
|
{ drawController = \s -> header s $
|
||||||
str "Did the game go into overtime? (Y/N)"
|
str "Did the game go into overtime? (Y/N)"
|
||||||
, handleController = \e ->
|
, handleController = \e ->
|
||||||
modify $ progMode.gameStateL.overtimeFlag .~ ynHandler e
|
progMode.gameStateL.overtimeFlag .= ynHandler e
|
||||||
}
|
}
|
||||||
|
|
||||||
verifyDataC :: Controller
|
verifyDataC :: Controller
|
||||||
|
|
|
@ -77,9 +77,9 @@ promptHandler p (VtyEvent (EvKey KEnter [])) = do
|
||||||
editorW %= clearEditor
|
editorW %= clearEditor
|
||||||
promptAction p val
|
promptAction p val
|
||||||
promptHandler p (VtyEvent (EvKey (KChar c) [])) =
|
promptHandler p (VtyEvent (EvKey (KChar c) [])) =
|
||||||
modify $ editorW %~ promptProcessChar p c
|
editorW %= promptProcessChar p c
|
||||||
promptHandler _ (VtyEvent (EvKey KBS [])) =
|
promptHandler _ (VtyEvent (EvKey KBS [])) =
|
||||||
modify (editorW.editContentsL %~ deletePrevChar)
|
editorW.editContentsL %= deletePrevChar
|
||||||
promptHandler p (VtyEvent (EvKey k m)) =
|
promptHandler p (VtyEvent (EvKey k m)) =
|
||||||
promptSpecialKey p k m
|
promptSpecialKey p k m
|
||||||
promptHandler _ _ = return ()
|
promptHandler _ _ = return ()
|
||||||
|
@ -243,7 +243,7 @@ selectPrompt params = Prompt
|
||||||
results = spSearch params sStr db
|
results = spSearch params sStr db
|
||||||
when (n < maxFunKeys) $
|
when (n < maxFunKeys) $
|
||||||
whenJust (nth n results) $ \(sel, _) -> do
|
whenJust (nth n results) $ \(sel, _) -> do
|
||||||
modify $ editorW %~ clearEditor
|
editorW %= clearEditor
|
||||||
spCallback params $ Just sel
|
spCallback params $ Just sel
|
||||||
_ -> return ()
|
_ -> return ()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user