From 38cb6b48653f950092e6cd6cd2332eec3f77e667 Mon Sep 17 00:00:00 2001 From: Hannes Schulze Date: Sun, 4 Oct 2026 03:38:43 +0200 Subject: persistence api --- src/Settlr/UI/Page.hs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/Settlr/UI/Page.hs') 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 -- cgit v1.3.1