frontend: Implement /contact page

This commit is contained in:
Cadey Ratio 2016-12-14 14:53:00 -08:00
parent 013d9bf1b8
commit 1328cf3311
5 changed files with 53 additions and 4 deletions

View File

@ -1,5 +1,6 @@
module App.BlogEntry where module App.BlogEntry where
import App.Utils (mdify)
import Control.Monad.Aff (attempt) import Control.Monad.Aff (attempt)
import DOM (DOM) import DOM (DOM)
import Data.Argonaut (class DecodeJson, decodeJson, (.?)) import Data.Argonaut (class DecodeJson, decodeJson, (.?))
@ -75,5 +76,3 @@ view { id: id, status: status, post: (Post post) } =
, div [ className "col s8 offset-s2" ] , div [ className "col s8 offset-s2" ]
[ p [ id_ "blogpost" ] [ text post.body ] ] [ p [ id_ "blogpost" ] [ text post.body ] ]
] ]
foreign import mdify :: String -> String

View File

@ -9,8 +9,8 @@ import DOM (DOM)
import Network.HTTP.Affjax (AJAX) import Network.HTTP.Affjax (AJAX)
import Prelude (($), (#), map, pure) import Prelude (($), (#), map, pure)
import Pux (EffModel, noEffects, mapEffects, mapState) import Pux (EffModel, noEffects, mapEffects, mapState)
import Pux.Html (Html, div, h1, li, nav, text, ul) import Pux.Html (Html, a, code, div, h1, h3, h4, li, nav, p, pre, text, ul)
import Pux.Html.Attributes (classID, className, id_, role) import Pux.Html.Attributes (classID, className, id_, role, href)
import Pux.Router (link) import Pux.Router (link)
data Action data Action
@ -41,6 +41,7 @@ update (BEChild action) state = BlogEntry.update action state.bestate
# mapState (state { bestate = _ }) # mapState (state { bestate = _ })
# mapEffects BEChild # mapEffects BEChild
update (Child action) state = noEffects $ state { count = Counter.update action state.count } 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 :: Route -> State -> EffModel State Action (dom :: DOM, ajax :: AJAX)
routeEffects BlogIndex state = { state: state routeEffects BlogIndex state = { state: state
@ -76,10 +77,50 @@ navbar state =
] ]
] ]
contact :: Html Action
contact =
div
[ className "row" ]
[ div
[ className "col s6" ]
[ h3 [] [ text "Email" ]
, div [ className "email" ] [ text "me@christine.website" ]
, p []
[ text "My GPG fingerprint is "
, code [] [ text "799F 9134 8118 1111" ]
, text ". If you get an email that appears to be from me and the signature does not match that fingerprint, it is not from me. You may download a copy of my public key "
, a [ href "/static/gpg.pub" ] [ text "here" ]
, text "."
]
]
, div
[ className "col s6" ]
[ h3 [] [ text "Other Information" ]
, p []
[ text "To send me donations, my bitcoin address is "
, code [] [ text "1Gi2ZF2C9CU9QooH8bQMB2GJ2iL6shVnVe" ]
, text "."
]
, div []
[ h4 [] [ text "IRC" ]
, p [] [ text "I am on many IRC networks. On Freenode I am using the nick Xe but elsewhere I will use the nick Xena or Cadey." ]
]
, div []
[ h4 [] [ text "Telegram" ]
, a [ href "https://telegram.me/miamorecadenza" ] [ text "@miamorecadenza" ]
]
, div []
[ h4 [] [ text "Discord" ]
, pre [] [ text "Cadey~#1932" ]
]
]
]
page :: Route -> State -> Html Action page :: Route -> State -> Html Action
page NotFound _ = h1 [] [ text "not found" ] page NotFound _ = h1 [] [ text "not found" ]
page Home state = map Child $ Counter.view state.count page Home state = map Child $ Counter.view state.count
page Resume state = h1 [] [ text "Christine Dodrill" ] page Resume state = h1 [] [ text "Christine Dodrill" ]
page BlogIndex state = map BIChild $ BlogIndex.view state.bistate page BlogIndex state = map BIChild $ BlogIndex.view state.bistate
page (BlogPost _) state = map BEChild $ BlogEntry.view state.bestate page (BlogPost _) state = map BEChild $ BlogEntry.view state.bestate
page ContactPage _ = contact
page _ _ = h1 [] [ text "not implemented yet" ] page _ _ = h1 [] [ text "not implemented yet" ]

View File

@ -1,5 +1,8 @@
module App.Routes where module App.Routes where
import App.BlogEntry as BlogEntry
import App.BlogIndex as BlogIndex
import App.Counter as Counter
import Control.Alt ((<|>)) import Control.Alt ((<|>))
import Control.Apply ((<*), (*>)) import Control.Apply ((<*), (*>))
import Data.Functor ((<$)) import Data.Functor ((<$))
@ -9,6 +12,7 @@ import Pux.Router (param, router, lit, str, end)
data Route = Home data Route = Home
| Resume | Resume
| ContactPage
| StaticPage String | StaticPage String
| BlogIndex | BlogIndex
| BlogPost String | BlogPost String
@ -21,3 +25,5 @@ match url = fromMaybe NotFound $ router url $
BlogIndex <$ lit "blog" <* end BlogIndex <$ lit "blog" <* end
<|> <|>
BlogPost <$> (lit "blog" *> str) <* end BlogPost <$> (lit "blog" *> str) <* end
<|>
ContactPage <$ lit "contact" <* end

3
frontend/src/Utils.purs Normal file
View File

@ -0,0 +1,3 @@
module App.Utils where
foreign import mdify :: String -> String