-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Derek Gonyeo
committed
Mar 1, 2018
1 parent
b595ad8
commit ee52765
Showing
17 changed files
with
155 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
|
||
module Cyanide.UI.ErrorScreen where | ||
|
||
import Lens.Micro ((^.)) | ||
import qualified Brick as B | ||
import qualified Brick.Widgets.List as BL | ||
import qualified Graphics.Vty as Vty | ||
import qualified Data.Text as T | ||
import qualified Data.Vector as V | ||
import qualified Brick.Widgets.Center as BC | ||
import qualified Brick.Widgets.Border as BB | ||
import Data.Monoid | ||
import Control.Monad.IO.Class | ||
|
||
import Cyanide.UI.State | ||
import Cyanide.UI.Util | ||
|
||
attrMap :: [(B.AttrName, Vty.Attr)] | ||
attrMap = [] | ||
|
||
handleEvent :: CyanideState -> B.BrickEvent Name () -> B.EventM Name (B.Next CyanideState) | ||
handleEvent s@(CyanideState conn _ (ErrorScreen _ prev)) (B.VtyEvent e) = | ||
case e of | ||
Vty.EvKey (Vty.KEsc) [] -> | ||
B.continue $ s { stateScreen = prev } | ||
|
||
_ -> B.continue s | ||
handleEvent s _ = B.continue s | ||
|
||
drawUI :: CyanideState -> [B.Widget Name] | ||
drawUI (CyanideState conn _ (ErrorScreen msg _)) = [ui] | ||
where ui = BC.center | ||
$ B.hLimit 80 | ||
$ B.vLimit 25 $ B.vBox | ||
[ BC.hCenter $ B.txtWrap msg | ||
, B.txt " " | ||
, renderInstructions [ ("Esc","Previous screen") | ||
] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.