diff options
| author | Christine Dodrill <me@christine.website> | 2016-12-18 08:51:32 -0800 |
|---|---|---|
| committer | Christine Dodrill <me@christine.website> | 2016-12-18 08:51:32 -0800 |
| commit | dba3ae46f8cbf9eca60e324447e7715744c2130b (patch) | |
| tree | 71c7bcfd26d9e66fe3ef9683bccc6f674523cb87 /frontend/src/Layout.purs | |
| parent | 0315c0b72158a2ae3cc827c6922a4dbcbef3a002 (diff) | |
| download | xesite-dba3ae46f8cbf9eca60e324447e7715744c2130b.tar.xz xesite-dba3ae46f8cbf9eca60e324447e7715744c2130b.zip | |
view my resume
Diffstat (limited to 'frontend/src/Layout.purs')
| -rw-r--r-- | frontend/src/Layout.purs | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/frontend/src/Layout.purs b/frontend/src/Layout.purs index 1b810aa..da5b55e 100644 --- a/frontend/src/Layout.purs +++ b/frontend/src/Layout.purs @@ -3,6 +3,7 @@ module App.Layout where import App.BlogEntry as BlogEntry import App.BlogIndex as BlogIndex import App.Counter as Counter +import App.Resume as Resume import App.Routes (Route(..)) import Control.Monad.RWS (state) import DOM (DOM) @@ -20,20 +21,23 @@ data Action = Child (Counter.Action) | BIChild (BlogIndex.Action) | BEChild (BlogEntry.Action) + | REChild (Resume.Action) | PageView Route type State = { route :: Route , count :: Counter.State , bistate :: BlogIndex.State - , bestate :: BlogEntry.State } + , bestate :: BlogEntry.State + , restate :: Resume.State } init :: State init = { route: NotFound , count: Counter.init , bistate: BlogIndex.init - , bestate: BlogEntry.init } + , bestate: BlogEntry.init + , restate: Resume.init } update :: Action -> State -> EffModel State Action (ajax :: AJAX, dom :: DOM) update (PageView route) state = routeEffects route $ state { route = route } @@ -43,14 +47,19 @@ update (BIChild action) state = BlogIndex.update action state.bistate update (BEChild action) state = BlogEntry.update action state.bestate # mapState (state { bestate = _ }) # mapEffects BEChild +update (REChild action) state = Resume.update action state.restate + # mapState ( state { restate = _ }) + # mapEffects REChild update (Child action) state = noEffects $ state { count = Counter.update action state.count } update _ state = noEffects $ state routeEffects :: Route -> State -> EffModel State Action (dom :: DOM, ajax :: AJAX) -routeEffects BlogIndex state = { state: state +routeEffects (BlogIndex) state = { state: state , effects: [ pure BlogIndex.RequestPosts ] } # mapEffects BIChild -routeEffects (BlogPost page) state = { state: state { bestate = BlogEntry.init { name = page } } - , effects: [ pure BlogEntry.RequestPost ] } # mapEffects BEChild +routeEffects (Resume) state = { state: state + , effects: [ pure Resume.RequestResume ] } # mapEffects REChild +routeEffects (BlogPost page') state = { state: state { bestate = BlogEntry.init { name = page' } } + , effects: [ pure BlogEntry.RequestPost ] } # mapEffects BEChild routeEffects _ state = noEffects $ state view :: State -> Html Action @@ -162,7 +171,7 @@ index = page :: Route -> State -> Html Action page NotFound _ = h1 [] [ text "not found" ] page Home _ = index -page Resume state = h1 [] [ text "Christine Dodrill" ] +page Resume state = map REChild $ Resume.view state.restate page BlogIndex state = map BIChild $ BlogIndex.view state.bistate page (BlogPost _) state = map BEChild $ BlogEntry.view state.bestate page ContactPage _ = contact |
