User: better show user card

This commit is contained in:
Christine Dodrill 2015-07-28 23:49:48 -07:00
parent 35b12761d0
commit 968de846a7
2 changed files with 27 additions and 2 deletions

View File

@ -22,8 +22,8 @@ instance FromRow User where
render :: User -> H.Html
render user = do
H.div ! A.class_ "card blue-grey darken-3" $ do
H.div ! A.class_ "card-content white-text" $ do
H.div ! A.class_ "card-content white-text center" $ do
H.span ! A.class_ "card-title" $ H.toHtml $ unpack (name user)
H.br
H.a ! A.href (H.toValue ("https://derpibooru.org/profiles/" ++ unpack (oID user))) $ do
H.img ! A.src (H.toValue $ unpack $ avatar user)
H.img ! A.src (H.toValue $ unpack $ avatar user) ! A.width "125"

View File

@ -0,0 +1,25 @@
{-# LANGUAGE OverloadedStrings #-}
module Within.DBMemorial.Views.Thread where
import Control.Monad (forM_)
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Text (Text)
import Text.Blaze.Html
import Text.Blaze.Html5 as H hiding (map)
import Text.Blaze.Html5.Attributes as A
import qualified Within.DBMemorial.Post as Post
import qualified Within.DBMemorial.User as User
render :: Int -> [Post.Post] -> (Map Text User.User) -> Html
render pageNumber posts users = do
H.h1 ! A.class_ "center text-orange" $ H.toHtml ("Page " ++ (show pageNumber))
H.div ! A.class_ "row" $ do
forM_ posts $ \post -> do
let user = case (Post.author post) `Map.lookup` users of
Just u -> u
Nothing -> error "Can't find user? Impossible state."
Post.render post (User.render user)