removed router nonsense

This commit is contained in:
Jonathan Lamothe 2024-07-18 18:18:04 -04:00
parent 6f106c2660
commit 0c35841bb2
2 changed files with 10 additions and 15 deletions

View File

@ -27,22 +27,25 @@ License along with this program. If not, see
module Hamming.App (mainApp, initialState) where module Hamming.App (mainApp, initialState) where
import Brick.AttrMap (forceAttrMap) 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 Brick.Util (style)
import Control.Monad.State.Class (gets)
import Hamming.App.Types import Hamming.App.Types
mainApp :: App AppState () () mainApp :: App AppState () ()
mainApp = App mainApp = App
{ appDraw = \s -> drawFunc (router s) s { appDraw = drawFunc
, appChooseCursor = neverShowCursor , appChooseCursor = neverShowCursor
, appHandleEvent = \e -> gets router >>= flip eventHandler e , appHandleEvent = eventHandler
, appStartEvent = return () , appStartEvent = return ()
, appAttrMap = const $ forceAttrMap $ style 0 , appAttrMap = const $ forceAttrMap $ style 0
} }
router :: AppState -> Route drawFunc :: AppState -> [Widget ()]
router = undefined drawFunc = const []
eventHandler :: BrickEvent () () -> EventM () AppState ()
eventHandler = const halt
--jl --jl

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) import Data.Word (Word16)
-- | The main state of the application -- | The main state of the application
@ -34,13 +33,6 @@ data AppState = AppState
{ hammingCode :: Word16 { 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 -- | Initial application state
initialState :: AppState initialState :: AppState
initialState = AppState 0 initialState = AppState 0