diff --git a/app/Main.hs b/app/Main.hs index 48c5672..bbbadff 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -1,8 +1,47 @@ +{-# LANGUAGE OverloadedStrings #-} + module Main where -import qualified Database.SQLite.Simple as DB +--import qualified Database.SQLite.Simple as DB +--import qualified TaskMachine.Database as TMD +--main = DB.withConnection "test.db" TMD.initializeNewDB -import qualified TaskMachine.Database as TMB +import Control.Monad +import Data.Monoid + +import qualified Brick as B +import qualified Graphics.Vty as VTY + +myAttrMap :: B.AttrMap +myAttrMap = B.attrMap VTY.defAttr + [ ("taskList" <> "normal", withStyle VTY.bold $ B.fg VTY.cyan) + , ("taskList" <> "highlight", withStyle VTY.bold $ B.bg VTY.cyan) + , ("taskList" <> "urgent" <> "normal", withStyle VTY.bold $ B.fg VTY.yellow) + , ("taskList" <> "urgent" <> "highlight", withStyle VTY.bold $ B.bg VTY.yellow) + , ("taskList" <> "veryUrgent" <> "normal", withStyle VTY.bold $ B.fg VTY.red) + , ("taskList" <> "veryUrgent" <> "highlight", withStyle VTY.bold $ B.bg VTY.red) + , ("taskList" <> "overdue" <> "normal", withStyle VTY.bold $ B.fg VTY.magenta) + , ("taskList" <> "overdue" <> "highlight", withStyle VTY.bold $ B.bg VTY.magenta) + ] + where withStyle = flip VTY.withStyle + +data ResourceName = Asdf + deriving (Eq, Ord) + +myApp :: B.App () () ResourceName +myApp = B.App + { B.appDraw = \_ -> [myTestWidget] + , B.appHandleEvent = B.resizeOrQuit + , B.appStartEvent = \s -> return s + , B.appChooseCursor = B.neverShowCursor + , B.appAttrMap = \_ -> myAttrMap + } + where + myTestWidget = normal B.<=> urgent B.<=> veryUrgent B.<=> overdue + normal = B.withAttr ("taskList" <> "normal") (B.str " normal ") B.<+> B.withAttr ("taskList" <> "highlight") (B.str "style") + urgent = B.withAttr ("taskList" <> "urgent" <> "normal") (B.str " urgent ") B.<+> B.withAttr ("taskList" <> "urgent" <> "highlight") (B.str "style") + veryUrgent = B.withAttr ("taskList" <> "veryUrgent" <> "normal") (B.str "very urgent ") B.<+> B.withAttr ("taskList" <> "veryUrgent" <> "highlight") (B.str "style") + overdue = B.withAttr ("taskList" <> "overdue" <> "normal") (B.str " overdue ") B.<+> B.withAttr ("taskList" <> "overdue" <> "highlight") (B.str "style") main :: IO () -main = DB.withConnection "test.db" TMB.initializeNewDB +main = void $ B.defaultMain myApp () diff --git a/package.yaml b/package.yaml index 65afd17..4ac70f0 100644 --- a/package.yaml +++ b/package.yaml @@ -22,6 +22,8 @@ description: Please see the README on Github at = 4.7 && < 5 - sqlite-simple +- brick +- vty #- containers #- unordered-containers #- text @@ -32,7 +34,6 @@ dependencies: #- bytestring #- stm #- megaparsec - #- brick library: source-dirs: src diff --git a/stack.yaml b/stack.yaml index 9c6b17c..a0ded07 100644 --- a/stack.yaml +++ b/stack.yaml @@ -15,7 +15,7 @@ # resolver: # name: custom-snapshot # location: "./custom-snapshot.yaml" -resolver: lts-10.9 +resolver: lts-11.0 # User packages to be built. # Various formats can be used as shown in the example below. @@ -63,4 +63,4 @@ packages: # extra-lib-dirs: [/path/to/dir] # # Allow a newer minor version of GHC than the snapshot specifies -# compiler-check: newer-minor \ No newline at end of file +# compiler-check: newer-minor