aboutsummaryrefslogtreecommitdiff
path: root/src/View/Plain
diff options
context:
space:
mode:
Diffstat (limited to 'src/View/Plain')
-rw-r--r--src/View/Plain/Ad.hs38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/View/Plain/Ad.hs b/src/View/Plain/Ad.hs
index 5120226..75e35e2 100644
--- a/src/View/Plain/Ad.hs
+++ b/src/View/Plain/Ad.hs
@@ -5,7 +5,6 @@ module View.Plain.Ad
, renderAds
) where
-import Data.List (intersperse)
import Data.Maybe (fromMaybe, catMaybes)
import Data.Map (Map)
import qualified Data.Map as M
@@ -22,12 +21,13 @@ import qualified Model.Resume as Resume
import Model.Detail (Detail)
import qualified Model.Detail as Detail
-import Model.URL
-import Model.Config
+import Model.URL (URL)
+import Conf (Conf)
+import qualified Conf
-renderConsoleAds :: Config -> Text -> [Ad] -> Text
-renderConsoleAds config time ads =
- let (title, message) = renderAds config ads
+renderConsoleAds :: Conf -> Text -> [Ad] -> Text
+renderConsoleAds conf time ads =
+ let (title, message) = renderAds conf ads
titleWithTime =
T.concat
[ "\n["
@@ -44,10 +44,10 @@ renderConsoleAds config time ads =
, message
]
-renderAds :: Config -> [Ad] -> (Text, Text)
-renderAds config ads =
+renderAds :: Conf -> [Ad] -> (Text, Text)
+renderAds conf ads =
let titleMessage = renderTitle $ length ads
- adsMessage = T.intercalate "\n\n" . map (renderAd config) $ ads
+ adsMessage = T.intercalate "\n\n" . map (renderAd conf) $ ads
in (titleMessage, adsMessage)
renderTitle :: Int -> Text
@@ -63,31 +63,31 @@ renderTitle count =
, if count > 1 then "s" else ""
]
-renderAd :: Config -> Ad -> Text
-renderAd config ad =
+renderAd :: Conf -> Ad -> Text
+renderAd conf ad =
T.concat
[ renderResume (Ad.resume ad)
, "\n"
- , renderDetail config (Ad.detail ad)
+ , renderDetail conf (Ad.detail ad)
]
renderResume :: Resume -> Text
renderResume resume =
let formatPrice price = T.concat [" - ", price]
- price = fromMaybe "" . fmap formatPrice . Resume.price $ resume
- titleLine = T.concat [Resume.name resume, price]
+ getPrice = fromMaybe "" . fmap formatPrice . Resume.price $ resume
+ titleLine = T.concat [Resume.name resume, getPrice]
in T.intercalate "\n" [titleLine, Resume.url resume]
-renderDetail :: Config -> Detail -> Text
-renderDetail config detail =
+renderDetail :: Conf -> Detail -> Text
+renderDetail conf detail =
T.concat
- [ renderProperties (properties config) (Detail.properties detail)
+ [ renderProperties (Conf.properties conf) (Detail.properties detail)
, fromMaybe "−" (Detail.description detail)
, renderURLs "\n\nImages:" (Detail.images detail)
]
renderProperties :: [Text] -> Map Text Text -> Text
-renderProperties [] properties = ""
+renderProperties [] _ = ""
renderProperties keys properties =
T.concat
[ "\n"
@@ -102,6 +102,6 @@ renderProperty properties key =
(M.lookup key properties)
renderURLs :: Text -> [URL] -> Text
-renderURLs title [] = ""
+renderURLs _ [] = ""
renderURLs title urls =
T.intercalate "\n" (title:urls)