diff --git a/src/Hamming/App.hs b/src/Hamming/App.hs index 70fcaeb..4bdb145 100644 --- a/src/Hamming/App.hs +++ b/src/Hamming/App.hs @@ -27,22 +27,25 @@ License along with this program. If not, see module Hamming.App (mainApp, initialState) where import Brick.AttrMap (forceAttrMap) -import Brick.Main (App (..), neverShowCursor) +import Brick.Main (App (..), halt, neverShowCursor) +import Brick.Types (BrickEvent, EventM, Widget) import Brick.Util (style) -import Control.Monad.State.Class (gets) import Hamming.App.Types mainApp :: App AppState () () mainApp = App - { appDraw = \s -> drawFunc (router s) s + { appDraw = drawFunc , appChooseCursor = neverShowCursor - , appHandleEvent = \e -> gets router >>= flip eventHandler e + , appHandleEvent = eventHandler , appStartEvent = return () , appAttrMap = const $ forceAttrMap $ style 0 } -router :: AppState -> Route -router = undefined +drawFunc :: AppState -> [Widget ()] +drawFunc = const [] + +eventHandler :: BrickEvent () () -> EventM () AppState () +eventHandler = const halt --jl diff --git a/src/Hamming/App/Types.hs b/src/Hamming/App/Types.hs index 188d40a..50ad2d9 100644 --- a/src/Hamming/App/Types.hs +++ b/src/Hamming/App/Types.hs @@ -24,9 +24,8 @@ License along with this program. If not, see |-} -module Hamming.App.Types (AppState (..), Route (..), initialState) where +module Hamming.App.Types (AppState (..), initialState) where -import Brick.Types (BrickEvent, EventM, Widget) import Data.Word (Word16) -- | The main state of the application @@ -34,13 +33,6 @@ data AppState = AppState { hammingCode :: Word16 } --- | Returns appropriate draw function and event handler for the --- current application state -data Route = Route - { drawFunc :: AppState -> [Widget ()] - , eventHandler :: BrickEvent () () -> EventM () AppState () - } - -- | Initial application state initialState :: AppState initialState = AppState 0