Browse Source

UI improvements

master
Denis Tereshkin 6 years ago
parent
commit
f0040bf339
  1. 12
      src/Main.hs

12
src/Main.hs

@ -13,6 +13,7 @@ import Control.Exception @@ -13,6 +13,7 @@ import Control.Exception
import Control.Monad
import Data.Aeson
import qualified Data.ByteString.Lazy as B
import qualified Data.List as L
import qualified Data.Map.Strict as M
import qualified Graphics.Vty as Vty
import Lens.Micro.Platform
@ -67,13 +68,10 @@ main = do @@ -67,13 +68,10 @@ main = do
where
initialState = AppState M.empty
draw :: AppState -> [Widget Name]
draw s = [hBox [vBox (txt <$> tickers s),
vBorder,
vBox (str <$> fmap (printEntry s qteLastPrice) (tickers s)),
vBorder,
vBox (str <$> fmap (printEntry s qteBid) (tickers s)),
vBorder,
vBox (str <$> fmap (printEntry s qteAsk) (tickers s))] ]
draw s = [hBox . L.intersperse vBorder $ hLimit 15 . padLeftRight 3 <$> [vBox ([str "Ticker", hBorder] ++ (txt <$> tickers s)),
vBox ([str "Last", hBorder] ++ (str <$> fmap (printEntry s qteLastPrice) (tickers s))),
vBox ([str "Bid", hBorder] ++ (str <$> fmap (printEntry s qteBid) (tickers s))),
vBox ([str "Ask", hBorder] ++ (str <$> fmap (printEntry s qteAsk) (tickers s)))] ]
printEntry s l tickerId = case s ^. quotes . at tickerId of
Just qte -> show $ qte ^. l
Nothing -> "-"

Loading…
Cancel
Save