aboutsummaryrefslogtreecommitdiffstats
path: root/frontend/app/Page.hs
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2024-06-06 23:05:41 +0200
committerLibravatar Alexander Foremny <aforemny@posteo.de>2024-06-06 23:05:41 +0200
commit378e007141c699945080bbf944aeef4abf67d75c (patch)
tree0e734b64e6ba2549b5b5fd4df01a33880af7fe62 /frontend/app/Page.hs
parent3add980b73b1ac75d1ad1dde85f6c782439914be (diff)
add new collection page
Diffstat (limited to 'frontend/app/Page.hs')
-rw-r--r--frontend/app/Page.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/frontend/app/Page.hs b/frontend/app/Page.hs
index 762ae90..16191dd 100644
--- a/frontend/app/Page.hs
+++ b/frontend/app/Page.hs
@@ -13,6 +13,7 @@ import Data.Function
import Miso
import Page.EditValue qualified as EditValue
import Page.ListCollection qualified as ListCollection
+import Page.NewCollection qualified as NewCollection
import Route (Route)
import Route qualified as Route
@@ -20,11 +21,13 @@ data Page
= Home
| ListCollection ListCollection.Model
| EditValue EditValue.Model
+ | NewCollection NewCollection.Model
deriving (Show, Eq)
data Action
= HandleListCollection ListCollection.Action
| HandleEditValue EditValue.Action
+ | HandleNewCollection NewCollection.Action
deriving (Show, Eq)
instance Default Page where
@@ -36,6 +39,8 @@ initialPage (Route.ListCollection c) =
fmap ListCollection <$> ListCollection.initialModel c
initialPage (Route.EditValue c f) =
fmap EditValue <$> EditValue.initialModel c f
+initialPage Route.NewCollection =
+ fmap NewCollection <$> NewCollection.initialModel
updatePage :: Action -> Page -> Effect Action Page
updatePage (HandleListCollection action) (ListCollection m) =
@@ -46,8 +51,13 @@ updatePage (HandleEditValue action) (EditValue m) =
EditValue.updateModel action m
& bimap HandleEditValue EditValue
updatePage (HandleEditValue _) p = noEff p
+updatePage (HandleNewCollection action) (NewCollection m) =
+ NewCollection.updateModel action m
+ & bimap HandleNewCollection NewCollection
+updatePage (HandleNewCollection _) p = noEff p
viewPage :: Page -> View Action
viewPage Home = text "home"
viewPage (ListCollection m) = HandleListCollection <$> ListCollection.viewModel m
viewPage (EditValue m) = HandleEditValue <$> EditValue.viewModel m
+viewPage (NewCollection m) = HandleNewCollection <$> NewCollection.viewModel m