From 0c35841bb2f8a8aa3d5631d9e9fc08a25e323936 Mon Sep 17 00:00:00 2001 From: Jonathan Lamothe Date: Thu, 18 Jul 2024 18:18:04 -0400 Subject: [PATCH] removed router nonsense --- src/Hamming/App.hs | 15 +++++++++------ src/Hamming/App/Types.hs | 10 +--------- 2 files changed, 10 insertions(+), 15 deletions(-) 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