From 46a680f7ca7def264a0f0b616883fb8e47271bab Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Sun, 12 Apr 2020 12:15:49 -0700 Subject: De-namespace Alpha A bunch of formatting changes got in there too. Oops. I will probably eventually de-namespace everything, mostly because I'm tired of typing "Com.Whatever.Thing" all the time. A better namespacing strategy might be to use normal Haskell namespacing (Data, Control, Network, etc) for code that is not specific to biz activities (i.e. if I could open-source it at any time), and use simply "Biz" for stuff that I would never want to open-source. --- Com/InfluencedByBooks/Core.hs | 102 ++++++++++++++++++++++++------------------ 1 file changed, 58 insertions(+), 44 deletions(-) (limited to 'Com/InfluencedByBooks/Core.hs') diff --git a/Com/InfluencedByBooks/Core.hs b/Com/InfluencedByBooks/Core.hs index 6984004..2b98914 100644 --- a/Com/InfluencedByBooks/Core.hs +++ b/Com/InfluencedByBooks/Core.hs @@ -7,16 +7,18 @@ -- | Main app logic module Com.InfluencedByBooks.Core where -import Com.Simatime.Alpha -import Com.Simatime.Network -import Data.Aeson hiding (Success) -import Data.Data (Data, Typeable) -import Data.Text (Text) -import GHC.Generics (Generic) -import Miso -import Miso.String -import Servant.API -import Servant.Links +import Alpha +import Com.Simatime.Network +import Data.Aeson hiding ( Success ) +import Data.Data ( Data + , Typeable + ) +import Data.Text ( Text ) +import GHC.Generics ( Generic ) +import Miso +import Miso.String +import Servant.API +import Servant.Links -- * entity data types @@ -79,51 +81,63 @@ handlers :: Model -> View Action handlers = home notfound :: View Action -notfound = div_ [] [ text "404" ] +notfound = div_ [] [text "404"] goHome :: URI -goHome = linkURI $ safeLink - (Proxy :: Proxy AppRoutes) - (Proxy :: Proxy Home) +goHome = linkURI $ safeLink (Proxy :: Proxy AppRoutes) (Proxy :: Proxy Home) see :: Model -> View Action -see m = div_ [ class_ "container mt-5" ] - [ div_ [ class_ "jumbotron" ] - [ h1_ [ class_ "display-4" ] [ text "Influenced by books" ] - , p_ [ class_ "lead" ] [ text "Influential people and the books that made them." ] - , p_ [ class_ "lead" ] - [ a_ [ href_ "http://eepurl.com/ghBFjv" ] - [ text "Get new book recommendations from the world's influencers in your email." ] - ] +see m = div_ + [class_ "container mt-5"] + [ div_ + [class_ "jumbotron"] + [ h1_ [class_ "display-4"] [text "Influenced by books"] + , p_ [class_ "lead"] + [text "Influential people and the books that made them."] + , p_ + [class_ "lead"] + [ a_ + [href_ "http://eepurl.com/ghBFjv"] + [ text + "Get new book recommendations from the world's influencers in your email." + ] ] - , div_ [ class_ "card-columns" ] $ case people m of - NotAsked -> [ text "Initializing..." ] - Loading -> [ text "Loading..." ] - Failure err -> [ text err ] - Success ps -> seePerson [text "Initializing..."] + Loading -> [text "Loading..."] + Failure err -> [text err] + Success ps -> seePerson View Action -seePerson person = div_ [ class_ "card" ] - [ div_ [ class_ "card-img" ] - [ img_ [ class_ "card-img img-fluid", src_ $ ms $ _pic person ]] - , div_ [ class_ "card-body" ] - [ h4_ [ class_ "card-title" ] [ text $ ms $ _name person ] - , h6_ [] [ a_ [ class_ "fab fa-twitter" - , href_ $ "https://twitter.com/" <> (ms $ _twitter person) ] [] - , a_ [ class_ "fas fa-globe", href_ $ ms $ _website person ] [] - ] - , p_ [ class_ "card-text" ] - [ text $ ms $ _blurb person - , ul_ [] $ seeBook (ms $ _twitter person) + ] + [] + , a_ [class_ "fas fa-globe", href_ $ ms $ _website person] [] ] + , p_ [class_ "card-text"] + [text $ ms $ _blurb person, ul_ [] $ seeBook View Action -seeBook book = li_ [] - [ a_ [ class_ "text-dark" - , href_ $ "https://www.amazon.com/dp/" <> (ms $ _amznref book) - ] - [ text $ ms $ _title book ] +seeBook book = li_ + [] + [ a_ + [ class_ "text-dark" + , href_ $ "https://www.amazon.com/dp/" <> (ms $ _amznref book) + ] + [text $ ms $ _title book] ] -- cgit v1.2.3