Commit 41a1c318 authored by Abinaya Sudhir's avatar Abinaya Sudhir

Refactor code

parent 3f2bb7a9
...@@ -48,32 +48,34 @@ _doclens :: Lens' State DV.State ...@@ -48,32 +48,34 @@ _doclens :: Lens' State DV.State
_doclens = lens (\s -> s.docview) (\s ss -> s {docview = ss}) _doclens = lens (\s -> s.docview) (\s ss -> s {docview = ss})
_authorlens :: Lens' State AV.State _docAction :: Prism' Action DV.Action
_authorlens = lens (\s -> s.authorview) (\s ss -> s {authorview = ss}) _docAction = prism DocviewA \ action ->
case action of
DocviewA laction -> Right laction
_-> Left action
_sourcelens :: Lens' State SV.State
_sourcelens = lens (\s -> s.sourceview) (\s ss -> s {sourceview = ss})
docPageSpec :: forall eff props. Spec (dom :: DOM, console :: CONSOLE, ajax :: AJAX | eff) State props Action
docPageSpec = focus _doclens _docAction DV.layoutDocview
_termslens :: Lens' State TV.State
_termslens = lens (\s -> s.termsview) (\s ss -> s {termsview = ss})
_authorlens :: Lens' State AV.State
_authorlens = lens (\s -> s.authorview) (\s ss -> s {authorview = ss})
_tablens :: Lens' State Tab.State
_tablens = lens (\s -> s.activeTab) (\s ss -> s {activeTab = ss})
_tabAction :: Prism' Action Tab.Action _authorAction :: Prism' Action AV.Action
_tabAction = prism TabViewA \ action -> _authorAction = prism AuthorviewA \ action ->
case action of case action of
TabViewA laction -> Right laction AuthorviewA laction -> Right laction
_-> Left action _-> Left action
_docAction :: Prism' Action DV.Action authorPageSpec :: forall eff props. Spec (dom :: DOM, console::CONSOLE, ajax :: AJAX | eff) State props Action
_docAction = prism DocviewA \ action -> authorPageSpec = focus _authorlens _authorAction AV.authorSpec
case action of
DocviewA laction -> Right laction
_-> Left action _sourcelens :: Lens' State SV.State
_sourcelens = lens (\s -> s.sourceview) (\s ss -> s {sourceview = ss})
_sourceAction :: Prism' Action SV.Action _sourceAction :: Prism' Action SV.Action
_sourceAction = prism SourceviewA \ action -> _sourceAction = prism SourceviewA \ action ->
...@@ -81,11 +83,13 @@ _sourceAction = prism SourceviewA \ action -> ...@@ -81,11 +83,13 @@ _sourceAction = prism SourceviewA \ action ->
SourceviewA laction -> Right laction SourceviewA laction -> Right laction
_-> Left action _-> Left action
_authorAction :: Prism' Action AV.Action
_authorAction = prism AuthorviewA \ action -> sourcePageSpec :: forall eff props. Spec (dom :: DOM, console :: CONSOLE, ajax :: AJAX | eff) State props Action
case action of sourcePageSpec = focus _sourcelens _sourceAction SV.sourceSpec
AuthorviewA laction -> Right laction
_-> Left action
_termslens :: Lens' State TV.State
_termslens = lens (\s -> s.termsview) (\s ss -> s {termsview = ss})
_termsAction :: Prism' Action TV.Action _termsAction :: Prism' Action TV.Action
...@@ -94,29 +98,21 @@ _termsAction = prism TermsviewA \ action -> ...@@ -94,29 +98,21 @@ _termsAction = prism TermsviewA \ action ->
TermsviewA laction -> Right laction TermsviewA laction -> Right laction
_-> Left action _-> Left action
docPageSpec :: forall eff props. Spec (dom :: DOM, console :: CONSOLE, ajax :: AJAX | eff) State props Action
docPageSpec = focus _doclens _docAction DV.layoutDocview
authorPageSpec :: forall eff props. Spec (dom :: DOM, console::CONSOLE, ajax :: AJAX | eff) State props Action
authorPageSpec = focus _authorlens _authorAction AV.authorSpec
sourcePageSpec :: forall eff props. Spec (dom :: DOM, console :: CONSOLE, ajax :: AJAX | eff) State props Action
sourcePageSpec = focus _sourcelens _sourceAction SV.sourceSpec
termsPageSpec :: forall eff props. Spec (dom :: DOM, console :: CONSOLE, ajax :: AJAX | eff) State props Action termsPageSpec :: forall eff props. Spec (dom :: DOM, console :: CONSOLE, ajax :: AJAX | eff) State props Action
termsPageSpec = focus _termslens _termsAction TV.termsSpec termsPageSpec = focus _termslens _termsAction TV.termsSpec
docPageActionSpec :: forall eff props. Spec (dom :: DOM, console :: CONSOLE, ajax :: AJAX | eff) State props Action
docPageActionSpec = simpleSpec (view _performAction docPageSpec) defaultRender
sourcePagesActionSpec :: forall eff props. Spec (dom :: DOM, console::CONSOLE, ajax :: AJAX | eff) State props Action _tablens :: Lens' State Tab.State
sourcePagesActionSpec = simpleSpec (view _performAction sourcePageSpec) defaultRender _tablens = lens (\s -> s.activeTab) (\s ss -> s {activeTab = ss})
authorPageActionSpec :: forall eff props. Spec (dom :: DOM, console :: CONSOLE, ajax :: AJAX | eff) State props Action
authorPageActionSpec = simpleSpec (view _performAction authorPageSpec) defaultRender
termsPageActionSpec :: forall eff props. Spec (dom :: DOM, console :: CONSOLE, ajax :: AJAX | eff) State props Action
termsPageActionSpec = simpleSpec (view _performAction termsPageSpec) defaultRender _tabAction :: Prism' Action Tab.Action
_tabAction = prism TabViewA \ action ->
case action of
TabViewA laction -> Right laction
_-> Left action
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment