diff options
Diffstat (limited to 'src/Settlr/UI')
| -rw-r--r-- | src/Settlr/UI/Page.hs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/Settlr/UI/Page.hs b/src/Settlr/UI/Page.hs index a3cd497..575b076 100644 --- a/src/Settlr/UI/Page.hs +++ b/src/Settlr/UI/Page.hs @@ -10,20 +10,26 @@ import qualified Text.Blaze.Html5 as H import qualified Text.Blaze.Html5.Attributes as A import Data.Text (Text) import Settlr.Config (Config(..)) -import Control.Monad.Reader (MonadReader, asks) +import Settlr.Scripts (ScriptM, getToasts, Toast(..)) +import Control.Monad.Reader (asks) +import Control.Monad (forM_) page - :: MonadReader Config m - => Text -- ^ the page title - -> Html -- ^ main content - -> m Html -- ^ given the config, the rendered page (i.e., the entire html document) + :: Text -- ^ the page title + -> Html -- ^ main content + -> ScriptM Html -- ^ given the config, the rendered page (i.e., the entire html document) page title content = do cssPath <- asks cfgCssPath + toasts <- getToasts pure $ H.docTypeHtml $ do H.head $ do H.meta ! A.charset "utf-8" H.title (text (title <> " | Settlr")) H.link ! A.rel "stylesheet" ! A.href (textValue cssPath) H.body $ do + H.ul $ do + forM_ toasts $ \(Toast msg) -> do + H.li $ do + H.span (text msg) ! A.class_ "toast" H.main $ do content |
