-- | Draws application UI.
drawUI :: PlayerApp -> [Widget]
drawUI (PlayerApp l _ _ mPlayback)  = [ui]
  where
    label = str "Item " <+> cur <+> str " of " <+> total
    cur =
      case l ^. L.listSelectedL of
        Nothing -> str "-"
        Just i -> str (show (i + 1))
    total = str $ show $ Vec.length $ l ^. L.listElementsL
    box = B.borderWithLabel label $ L.renderList l (const songWidget)
    ui = vBox [ box
              , playbackProgressBar mPlayback l
              , str $ "Press enter to play/stop, spacebar to pause/resume, " ++
                      "left/right to play prev/next song, " ++
                      "q to exit."
              ]


-- Updates the selected song status and the song list in the app state.
drawUI :: PlayerApp -> [Widget]
drawUI (PlayerApp l _ _ mPlayback)  = [ui]
  where
    label = str "Item " <+> cur <+> str " of " <+> total
    cur =
      case l ^. L.listSelectedL of
        Nothing -> str "-"
        Just i -> str (show (i + 1))
    total = str $ show $ Vec.length $ l ^. L.listElementsL
    box = B.borderWithLabel label $ L.renderList l (const songWidget)
    ui = vBox [ box
              , playbackProgressBar mPlayback l
              , str $ "Press enter to play/stop, spacebar to pause/resume, " ++
                      "left/right to play prev/next song, " ++
                      "q to exit."
              ]


-- Updates the selected song status and the song list in the app state.
drawUI (PlayerApp l _ _ mPlayback)  = [ui]
  where
    label = str "Item " <+> cur <+> str " of " <+> total
    cur =
      case l ^. L.listSelectedL of
        Nothing -> str "-"
        Just i -> str (show (i + 1))
    total = str $ show $ Vec.length $ l ^. L.listElementsL
    box = B.borderWithLabel label $ L.renderList l (const songWidget)
    ui = vBox [ box
              , playbackProgressBar mPlayback l
              , str $ "Press enter to play/stop, spacebar to pause/resume, " ++
                      "left/right to play prev/next song, " ++
                      "q to exit."
              ]


-- Updates the selected song status and the song list in the app state.