removed router nonsense

This commit is contained in:
jlamothe committed 2024-07-18 18:18:04 -04:00
1 parent 6f106c2660
commit 0c35841bb2
2 files changed
+10 -15

No files matched your search

+9 -6
View File
@@ -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
+1 -9
View File
@@ -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