{-# Language OverloadedStrings #-}
module Client.View.IgnoreList
  ( ignoreListLines
  ) where
import           Client.Image.PackedImage
import           Client.Image.Palette
import           Client.Image.Message
import           Graphics.Vty.Attributes
import           Irc.Identifier
import           Data.HashSet (HashSet)
import           Data.Foldable
import           Control.Lens
ignoreListLines ::
  HashSet Identifier  ->
  Palette             ->
  [Image']
ignoreListLines ignores pal =
  summaryLine ignores pal :
  [ text' defAttr (cleanText (idText mask)) | mask <- toList ignores ]
summaryLine ::
  HashSet Identifier  ->
  Palette             ->
  Image'
summaryLine ignores pal
  | null ignores = text' (view palError pal) "Ignore list empty"
  | otherwise    = text' (view palLabel pal) "Ignore entries: "
                <> string defAttr (show (length ignores))