summaryrefslogtreecommitdiff
path: root/src/Settlr/UI/Page.hs
diff options
context:
space:
mode:
authorHannes Schulze <contact@haschu.me>2026-10-04 03:38:43 +0200
committerHannes Schulze <contact@haschu.me>2026-10-04 03:38:43 +0200
commit38cb6b48653f950092e6cd6cd2332eec3f77e667 (patch)
treea7b6286f01c166ed7f25cd06d53f6811c5022a6a /src/Settlr/UI/Page.hs
parent41dc555f3a4d53a8773a03ac24bed9aea8143bfa (diff)
persistence api
Diffstat (limited to 'src/Settlr/UI/Page.hs')
-rw-r--r--src/Settlr/UI/Page.hs16
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