kino/src/AppTypes.hs

43 lines
1.4 KiB
Haskell
Raw Normal View History

2021-09-14 17:06:34 +02:00
{-# LANGUAGE TemplateHaskell #-}
{-|
Module : AppTypes
Description : Contains the types related to our Brick application
-}
2021-09-14 17:06:34 +02:00
module AppTypes where
import JSONTypes
import Lens.Micro.TH
2021-09-20 13:21:48 +02:00
import Brick.Widgets.Edit (Editor(..))
import qualified Data.Text as T
2021-09-14 17:06:34 +02:00
-- | Contains the different elements which we
-- might want brick to be able to identify
2021-09-14 17:06:34 +02:00
data Ident = Listing | Input | ListItem Int
deriving (Eq, Ord, Show)
-- | Used to distiguish what set of
-- widgets should currently be rendered.
data Mode = Search | Browse | Message
2021-09-14 17:06:34 +02:00
deriving (Eq, Ord, Show)
-- | Used for scrolling
2021-09-14 17:06:34 +02:00
data ScrollDirection = Up | Down
deriving (Eq, Show)
-- | The state of our app
2021-09-14 17:06:34 +02:00
data AppS = AppS
2021-09-20 13:21:48 +02:00
{ _appMode :: Mode -- ^ The current mode of the app
, _appCursor :: Int -- ^ The selected into the listing
, _appExpanded :: Bool -- ^ If the currently selected listing is expanded
, _appPage :: Int -- ^ The page currently being viewed
, _appListing :: JSONListMovies -- ^ The movies being browsed
, _appDetails :: Maybe JSONMovie -- ^ The movie being focused
, _appMessage :: Maybe String -- ^ The message to be shown in message mode
, _appContinue :: Bool -- ^ If to continue after showing message
, _appEditor :: Editor T.Text Ident -- ^ The state for the editor widget
2021-09-14 17:06:34 +02:00
} deriving (Show)
makeLenses ''AppS