diff options
Diffstat (limited to 'Hero/Core.hs')
-rw-r--r-- | Hero/Core.hs | 67 |
1 files changed, 33 insertions, 34 deletions
diff --git a/Hero/Core.hs b/Hero/Core.hs index 8f865da..86b0638 100644 --- a/Hero/Core.hs +++ b/Hero/Core.hs @@ -77,12 +77,11 @@ comicSlug Comic {..} = snake comicName <> "-" <> comicIssue -- * user -data User - = User - { userEmail :: Text, - userName :: Text, - userLibrary :: [Comic] - } +data User = User + { userEmail :: Text, + userName :: Text, + userLibrary :: [Comic] + } deriving (Show, Eq, Generic, Data, Ord) instance Semigroup User where @@ -158,7 +157,7 @@ instance Elemental Button where [ img_ [src_ <| ms <| Pack.icon <> "save.svg"], span_ [] [text "saved"] ] - else-- not in library + else -- not in library a_ [class_ "wrs-button", onClick <| ToggleInLibrary c] @@ -173,7 +172,7 @@ instance Elemental Button where onClick <| ToggleInLibrary c ] [img_ [src_ <| ms <| Pack.demo <> "library-add.png"]] - else-- not in library + else -- not in library button_ [ class_ "button is-large has-background-black-bis", @@ -231,16 +230,15 @@ findComic id = List.find (\c -> comicId c == id) -- -- Try to prefix component-specific state with the component initials: 'd' for -- discover, 'cp' for comic player. -data Form - = Form - { uri :: Api.URI, - appComics :: RemoteData MisoString [Comic], - user :: User, - dMediaInfo :: Maybe Comic, - cpState :: ComicReaderState, - cpAudioState :: AudioState, - magnification :: Magnification - } +data Form = Form + { uri :: Api.URI, + appComics :: RemoteData MisoString [Comic], + user :: User, + dMediaInfo :: Maybe Comic, + cpState :: ComicReaderState, + cpAudioState :: AudioState, + magnification :: Magnification + } deriving (Show, Eq) initForm :: Api.URI -> Form @@ -323,6 +321,7 @@ pubRoutes :: Proxy PubRoutes pubRoutes = Proxy -- * pages + -- -- TODO: consider making a typeclass, something like: -- @@ -334,6 +333,7 @@ pubRoutes = Proxy -- link :: Api.URI -- ** home + -- -- this is the unauthenticated page that you see when you first visit @@ -481,15 +481,14 @@ discoverFooter = -- ** comic -data Comic - = Comic - { comicId :: ComicId, - comicPages :: Integer, - comicName :: Text, - -- | Ideally this would be a dynamic number-like type - comicIssue :: Text, - comicDescription :: Text - } +data Comic = Comic + { comicId :: ComicId, + comicPages :: Integer, + comicName :: Text, + -- | Ideally this would be a dynamic number-like type + comicIssue :: Text, + comicDescription :: Text + } deriving (Show, Eq, Generic, Data, Ord) instance ToJSON Comic where @@ -534,11 +533,11 @@ instance IsMediaObject Comic where <| Pack.demo <> comicSlug comic <> "-logo.png" ] ], - div_ [class_ "comic-action-menu"] <| - el </ [Watch comic, Read comic, Save comic lib], + div_ [class_ "comic-action-menu"] + <| el </ [Watch comic, Read comic, Save comic lib], p_ [class_ "description"] - [ text . ms <| comicDescription comic + [ text <. ms <| comicDescription comic ] ] ] @@ -800,7 +799,7 @@ comicVideo _ _ _ = ] ] --- * general page components & utils +-- * general page components |> utils -- | If 'View' had a 'Monoid' instance, then '(text "")' could just be 'mempty' maybeView :: (a -> View action) -> Maybe a -> View action @@ -899,9 +898,9 @@ comicControls comic page form = ] ] where - leftPage = ms . Legacy.show <| page - rightPage = ms . Legacy.show <| 1 + page - totalpages = ms . Legacy.show <| comicPages comic + leftPage = ms <. Legacy.show <| page + rightPage = ms <. Legacy.show <| 1 + page + totalpages = ms <. Legacy.show <| comicPages comic topbar :: View Move topbar = |