diff --git a/src/Component/CatalogGrid.hs b/src/Component/CatalogGrid.hs index 3fc6b1d..768c117 100644 --- a/src/Component/CatalogGrid.hs +++ b/src/Component/CatalogGrid.hs @@ -6,6 +6,7 @@ module Component.CatalogGrid , Action , Interface (..) , view +, update ) where import Miso @@ -23,6 +24,8 @@ import Miso , p_ , br_ , id_ + , Effect + , noEff ) type Model = () @@ -37,13 +40,20 @@ data Interface a = Interface , selectThread :: () } +update + :: Interface a + -> Action + -> Model + -> Effect a Model +update = const $ const noEff + view :: Interface a -> Model -> View a view iface model = div_ [ class_ "threads" ] [ div_ [ id_ "Grid" ] - [ gridItem | _ <- [0..10] ] + [ gridItem | _ <- [0..10] :: [ Int ] ] ] gridItem :: View a diff --git a/src/Main.hs b/src/Main.hs index 1947c46..b229376 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -73,8 +73,15 @@ mainView model = , Grid.view iGrid (gridModel model) ] + mainUpdate :: Action -> Model -> Effect Action Model -mainUpdate = const noEff +mainUpdate NoAction m = noEff m +mainUpdate GetLatest m = noEff m +mainUpdate GetThread {..} m = noEff m +mainUpdate (GridAction ga) m = + Grid.update iGrid ga (gridModel m) + >>= \gm -> noEff (m { gridModel = gm }) + iGrid :: Grid.Interface Action iGrid = Grid.Interface