diff --git a/src/Main.hs b/src/Main.hs index 9c6fb3c..6ac9e46 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -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 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 -> "-"