diff options
| author | Christine Dodrill <me@christine.website> | 2017-05-20 23:30:47 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-05-20 23:30:47 -0700 |
| commit | 55f50910d96b94658b8d9d6bcaa09be5cc90bc05 (patch) | |
| tree | 07112ff8f7d2a67dbb5f99652181d4e205f877cb /frontend | |
| parent | 372573572913bebe24312b72f2c62d74bb8aba54 (diff) | |
| parent | e8f967619e02ebdd6daa5132012ea2382f34ce91 (diff) | |
| download | xesite-55f50910d96b94658b8d9d6bcaa09be5cc90bc05.tar.xz xesite-55f50910d96b94658b8d9d6bcaa09be5cc90bc05.zip | |
Merge pull request #4 from Xe/Xe/feat/server-side-rendering
Use server-side rendering, redo frontend with hack.css
Diffstat (limited to 'frontend')
| -rw-r--r-- | frontend/.gitignore | 9 | ||||
| -rw-r--r-- | frontend/LICENSE | 24 | ||||
| -rw-r--r-- | frontend/README.md | 38 | ||||
| -rw-r--r-- | frontend/bower.json | 19 | ||||
| -rw-r--r-- | frontend/package.json | 53 | ||||
| -rw-r--r-- | frontend/src/BlogEntry.purs | 72 | ||||
| -rw-r--r-- | frontend/src/BlogIndex.purs | 86 | ||||
| -rw-r--r-- | frontend/src/Counter.purs | 40 | ||||
| -rw-r--r-- | frontend/src/Layout.purs | 188 | ||||
| -rw-r--r-- | frontend/src/Main.purs | 53 | ||||
| -rw-r--r-- | frontend/src/NotFound.purs | 8 | ||||
| -rw-r--r-- | frontend/src/Pux/DocumentTitle.js | 3 | ||||
| -rw-r--r-- | frontend/src/Pux/DocumentTitle.purs | 7 | ||||
| -rw-r--r-- | frontend/src/Resume.purs | 66 | ||||
| -rw-r--r-- | frontend/src/Routes.purs | 31 | ||||
| -rw-r--r-- | frontend/src/Utils.js | 16 | ||||
| -rw-r--r-- | frontend/src/Utils.purs | 3 | ||||
| -rw-r--r-- | frontend/support/index.html | 18 | ||||
| -rw-r--r-- | frontend/support/index.js | 25 | ||||
| -rw-r--r-- | frontend/support/pux-starter-app.gif | bin | 2095651 -> 0 bytes | |||
| -rw-r--r-- | frontend/webpack.config.js | 102 | ||||
| -rw-r--r-- | frontend/webpack.production.config.js | 69 |
22 files changed, 0 insertions, 930 deletions
diff --git a/frontend/.gitignore b/frontend/.gitignore deleted file mode 100644 index 5f00026..0000000 --- a/frontend/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -node_modules/ -bower_components/ -output/ -dist/ -static/dist -.psci_modules -npm-debug.log -**DS_Store -.psc-ide-port diff --git a/frontend/LICENSE b/frontend/LICENSE deleted file mode 100644 index 69da0fe..0000000 --- a/frontend/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -Copyright (c) 2016, Alexander C. Mingoia -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the <organization> nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/frontend/README.md b/frontend/README.md deleted file mode 100644 index 51c3474..0000000 --- a/frontend/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# pux-starter-app - -Starter [Pux](https://github.com/alexmingoia/purescript-pux/) application using -webpack with hot-reloading and time-travel debug using -[pux-devtool](https://github.com/alexmingoia/pux-devtool). - -See the [Guide](https://alexmingoia.github.io/purescript-pux) for help learning -Pux. - - - -## Installation - -```sh -git clone git://github.com/alexmingoia/pux-starter-app.git example -cd example -npm install -npm start -``` - -Visit `http://localhost:3000` in your browser, edit `src/purs/Layout.purs` -and watch the magic! - -## Available scripts - -### watch - -`npm start` or `npm run watch` will start a development server, which -hot-reloads your application when sources changes. - -### serve - -`npm run serve` serves your application without watching for changes or -hot-reloading. - -### build - -`npm run build` bundles and minifies your application to run in production mode. diff --git a/frontend/bower.json b/frontend/bower.json deleted file mode 100644 index 1ba4949..0000000 --- a/frontend/bower.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "pux-starter-app", - "homepage": "https://github.com/alexmingoia/pux-starter-app", - "authors": [ - "Alex Mingoia <talk@alexmingoia.com>" - ], - "description": "Starter Pux application using webpack with hot-reloading.", - "main": "support/index.js", - "license": "BSD3", - "dependencies": { - "purescript-pux": "^7.0.0", - "purescript-pux-devtool": "^4.1.0", - "purescript-argonaut": "^2.0.0", - "purescript-affjax": "^3.0.2" - }, - "resolutions": { - "purescript-dom": "^3.1.0" - } -} diff --git a/frontend/package.json b/frontend/package.json deleted file mode 100644 index 9de0f7d..0000000 --- a/frontend/package.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "christine-website", - "version": "0.1.0", - "description": "Starter Pux application using webpack with hot-reloading.", - "main": "support/index.js", - "keywords": [ - "pux", - "purescript-pux", - "boilerplate", - "starter-app" - ], - "scripts": { - "postinstall": "bower cache clean && bower install", - "clean": "rimraf static/dist && rimraf dist && rimraf output", - "build": "webpack --config ./webpack.production.config.js --progress --profile --colors", - "watch": "npm run clean && node ./webpack.config.js", - "serve": "http-server static --cors -p 3000", - "start": "npm run watch", - "test": "echo \"Error: no test specified\" && exit 1" - }, - "repository": { - "type": "git", - "url": "git://github.com/alexmingoia/pux-starter-app.git" - }, - "author": "Alexander C. Mingoia", - "license": "BSD-3-Clause", - "bugs": { - "url": "https://github.com/alexmingoia/pux-starter-app/issues" - }, - "dependencies": { - "bower": "^1.7.9", - "connect-history-api-fallback": "^1.2.0", - "express": "^4.13.4", - "favicons-webpack-plugin": "0.0.7", - "html-webpack-plugin": "^2.15.0", - "http-server": "^0.9.0", - "purescript": "^0.10.1", - "purescript-psa": "^0.3.9", - "purs-loader": "^2.0.0", - "react": "^15.0.0", - "react-document-title": "^2.0.2", - "react-dom": "^15.0.0", - "rimraf": "^2.5.2", - "showdown": "^1.6.0", - "webpack": "^2.1.0-beta.25", - "webpack-uglify-js-plugin": "^1.1.9" - }, - "devDependencies": { - "source-map-loader": "^0.1.5", - "webpack-dev-middleware": "^1.8.3", - "webpack-hot-middleware": "^2.12.2" - } -} diff --git a/frontend/src/BlogEntry.purs b/frontend/src/BlogEntry.purs deleted file mode 100644 index 0a46976..0000000 --- a/frontend/src/BlogEntry.purs +++ /dev/null @@ -1,72 +0,0 @@ -module App.BlogEntry where - -import App.Utils (mdify) -import Control.Monad.Aff (attempt) -import DOM (DOM) -import Data.Argonaut (class DecodeJson, decodeJson, (.?)) -import Data.Either (Either(..), either) -import Data.Maybe (Maybe(..)) -import Network.HTTP.Affjax (AJAX, get) -import Prelude (bind, pure, show, ($), (<>), (<<<)) -import Pux (noEffects, EffModel) -import Pux.DocumentTitle (documentTitle) -import Pux.Html (Html, div, h1, p, text) -import Pux.Html.Attributes (dangerouslySetInnerHTML, className, id_, title) - -data Action = RequestPost - | ReceivePost (Either String Post) - -type State = - { status :: String - , id :: Maybe Int - , post :: Post - , name :: String } - -data Post = Post - { title :: String - , body :: String - , date :: String } - -instance decodeJsonPost :: DecodeJson Post where - decodeJson json = do - obj <- decodeJson json - title <- obj .? "title" - body <- obj .? "body" - date <- obj .? "date" - pure $ Post { title: title, body: body, date: date } - -init :: State -init = - { status: "Loading..." - , post: Post - { title: "" - , body: "" - , date: "" } - , name: "" - , id: Nothing } - -update :: Action -> State -> EffModel State Action (ajax :: AJAX, dom :: DOM) -update (ReceivePost (Left err)) state = - noEffects $ state { id = Nothing, status = err } -update (ReceivePost (Right post)) state = noEffects $ state { status = "", id = Just 1, post = post } -update RequestPost state = - { state: state - , effects: [ do - res <- attempt $ get ("/api/blog/post?name=" <> state.name) - let decode r = decodeJson r.response :: Either String Post - let post = either (Left <<< show) decode res - pure $ ReceivePost post - ] - } - -view :: State -> Html Action -view { id: id, status: status, post: (Post post) } = - case id of - Nothing -> div [] [] - (Just _) -> - div [ className "row" ] - [ h1 [] [ text status ] - , documentTitle [ title $ post.title <> " - Christine Dodrill" ] [] - , div [ className "col s8 offset-s2" ] - [ p [ id_ "blogpost", dangerouslySetInnerHTML $ mdify post.body ] [] ] - ] diff --git a/frontend/src/BlogIndex.purs b/frontend/src/BlogIndex.purs deleted file mode 100644 index 1b41dbf..0000000 --- a/frontend/src/BlogIndex.purs +++ /dev/null @@ -1,86 +0,0 @@ -module App.BlogIndex where - -import Control.Monad.Aff (attempt) -import DOM (DOM) -import Data.Argonaut (class DecodeJson, decodeJson, (.?)) -import Data.Either (Either(Left, Right), either) -import Network.HTTP.Affjax (AJAX, get) -import Prelude (($), bind, map, const, show, (<>), pure, (<<<)) -import Pux (EffModel, noEffects) -import Pux.DocumentTitle (documentTitle) -import Pux.Html (Html, br, div, h1, ol, li, button, text, span, p) -import Pux.Html.Attributes (className, id_, key, title) -import Pux.Html.Events (onClick) -import Pux.Router (link) - -data Action = RequestPosts - | ReceivePosts (Either String Posts) - -type State = - { posts :: Posts - , status :: String } - -data Post = Post - { title :: String - , link :: String - , summary :: String - , date :: String } - -type Posts = Array Post - -instance decodeJsonPost :: DecodeJson Post where - decodeJson json = do - obj <- decodeJson json - title <- obj .? "title" - link <- obj .? "link" - summ <- obj .? "summary" - date <- obj .? "date" - pure $ Post { title: title, link: link, summary: summ, date: date } - -init :: State -init = - { posts: [] - , status: "" } - -update :: Action -> State -> EffModel State Action (ajax :: AJAX, dom :: DOM) -update (ReceivePosts (Left err)) state = - noEffects $ state { status = ("error: " <> err) } -update (ReceivePosts (Right posts)) state = - noEffects $ state { posts = posts, status = "" } -update RequestPosts state = - { state: state { status = "Loading..." } - , effects: [ do - res <- attempt $ get "/api/blog/posts" - let decode r = decodeJson r.response :: Either String Posts - let posts = either (Left <<< show) decode res - pure $ ReceivePosts posts - ] - } - -post :: Post -> Html Action -post (Post state) = - div - [ className "col s6" ] - [ div - [ className "card pink lighten-5" ] - [ div - [ className "card-content black-text" ] - [ span [ className "card-title" ] [ text state.title ] - , br [] [] - , p [] [ text ("Posted on: " <> state.date) ] - , span [] [ text state.summary ] - ] - , div - [ className "card-action pink lighten-5" ] - [ link state.link [] [ text "Read More" ] ] - ] - ] - -view :: State -> Html Action -view state = - div - [] - [ h1 [] [ text "Posts" ] - , documentTitle [ title "Posts - Christine Dodrill" ] [] - , div [ className "row" ] $ map post state.posts - , p [] [ text state.status ] ] diff --git a/frontend/src/Counter.purs b/frontend/src/Counter.purs deleted file mode 100644 index d56afbe..0000000 --- a/frontend/src/Counter.purs +++ /dev/null @@ -1,40 +0,0 @@ -module App.Counter where - -import Prelude ((+), (-), const, show) -import Pux.Html (Html, a, br, div, span, text) -import Pux.Html.Attributes (className, href) -import Pux.Html.Events (onClick) - -data Action = Increment | Decrement - -type State = Int - -init :: State -init = 0 - -update :: Action -> State -> State -update Increment state = state + 1 -update Decrement state = state - 1 - -view :: State -> Html Action -view state = - div - [ className "row" ] - [ div - [ className "col s4 offset-s4" ] - [ div - [ className "card blue-grey darken-1" ] - [ div - [ className "card-content white-text" ] - [ span [ className "card-title" ] [ text "Counter" ] - , br [] [] - , span [] [ text (show state) ] - ] - , div - [ className "card-action" ] - [ a [ onClick (const Increment), href "#" ] [ text "Increment" ] - , a [ onClick (const Decrement), href "#" ] [ text "Decrement" ] - ] - ] - ] - ] diff --git a/frontend/src/Layout.purs b/frontend/src/Layout.purs deleted file mode 100644 index 193419e..0000000 --- a/frontend/src/Layout.purs +++ /dev/null @@ -1,188 +0,0 @@ -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 Pux.Html as H -import App.Routes (Route(..)) -import Control.Monad.RWS (state) -import DOM (DOM) -import Network.HTTP.Affjax (AJAX) -import Prelude (($), (#), map, pure) -import Pux (EffModel, noEffects, mapEffects, mapState) -import Pux.DocumentTitle (documentTitle) -import Pux.Html (style, Html, a, code, div, h1, h2, h3, h4, li, nav, p, pre, text, ul, img, span) -import Pux.Html (Html, a, code, div, h1, h3, h4, li, nav, p, pre, text, ul) -import Pux.Html.Attributes (attr, target, href, classID, className, id_, role, src, rel, title) -import Pux.Router (link) - -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 - , restate :: Resume.State } - -init :: State -init = - { route: NotFound - , count: Counter.init - , bistate: BlogIndex.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 } -update (BIChild action) state = BlogIndex.update action state.bistate - # mapState (state { bistate = _ }) - # mapEffects BIChild -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 - , effects: [ pure BlogIndex.RequestPosts ] } # mapEffects BIChild -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 -view state = - div - [] - [ navbar state - , div - [ className "container" ] - [ page state.route state ] - ] - -navbar :: State -> Html Action -navbar state = - nav - [ className "pink lighten-1", role "navigation" ] - [ div - [ className "nav-wrapper container" ] - [ link "/" [ className "brand-logo", id_ "logo-container" ] [ text "Christine Dodrill" ] - , H.link [ rel "stylesheet", href "/static/css/about/main.css" ] [] - , ul - [ className "right hide-on-med-and-down" ] - [ li [] [ link "/blog" [] [ text "Blog" ] ] - -- , li [] [ link "/projects" [] [ text "Projects" ] ] - , li [] [ link "/resume" [] [ text "Resume" ] ] - , li [] [ link "/contact" [] [ text "Contact" ] ] - ] - ] - ] - -contact :: Html Action -contact = - div - [ className "row" ] - [ documentTitle [ title "Contact - Christine Dodrill" ] [] - , 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 "." - ] - , h3 [] [ text "Social Media" ] - , ul - [ className "browser-default" ] - [ li [] [ a [ href "https://github.com/Xe" ] [ text "Github" ] ] - , li [] [ a [ href "https://twitter.com/theprincessxena"] [ text "Twitter" ] ] - , li [] [ a [ href "https://keybase.io/xena" ] [ text "Keybase" ] ] - , li [] [ a [ href "https://www.coinbase.com/christinedodrill" ] [ text "Coinbase" ] ] - , li [] [ a [ href "https://www.facebook.com/chrissycade1337" ] [ text "Facebook" ] ] - ] - ] - , 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" ] - ] - ] - ] - -index :: Html Action -index = - div - [ className "row panel" ] - [ documentTitle [ title "Christine Dodrill" ] [] - , div [] [ div - [ className "col m4 bg_blur valign-wrapper center-align" ] - [ div - [ className "valign center-align fb_wrap" ] - [ link "/contact" - [ className "btn follow_btn" ] - [ text "Contact Me" ] - ] - ] - ] - , div - [ className "col m8" ] - [ div - [ className "header" ] - [ h1 [] [ text "Christine Dodrill" ] - , h4 [] [ text "Rockstar Hacker, Freelance Programmer, Gopher, Cloud Architect" ] - , span [] [ text "I am a GitHub power user. I am constantly learning new languages and tools. I strongly believe in knowing many languages and ways to do things so I can pick the right tool for the job." ] - , h2 [] [ text "Skills" ] - , ul - [ className "browser-default" ] - [ li [] [ text "Go, Moonscript, Lua, Python, C, Nim, Haskell" ] - , li [] [ text "Docker deployments" ] - , li [] [ text "Research, Development and Experimentation" ] - ] - , h2 [] [ text "Side Projects" ] - , ul - [ className "browser-default" ] - [ li [] [ text "Real-time globally distributed chat server maintenance" ] - , li [] [ text "Mashups of chat, video and music" ] - ] - ] - ] - ] - -page :: Route -> State -> Html Action -page NotFound _ = h1 [] [ text "not found" ] -page Home _ = index -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 -page _ _ = h1 [] [ text "not implemented yet" ] diff --git a/frontend/src/Main.purs b/frontend/src/Main.purs deleted file mode 100644 index 09030f3..0000000 --- a/frontend/src/Main.purs +++ /dev/null @@ -1,53 +0,0 @@ -module Main where - -import App.Layout (Action(PageView), State, view, update) -import App.Routes (match) -import Control.Bind ((=<<)) -import Control.Monad.Eff (Eff) -import DOM (DOM) -import Network.HTTP.Affjax (AJAX) -import Prelude (bind, pure) -import Pux (renderToDOM, renderToString, App, Config, CoreEffects, start) -import Pux.Devtool (Action, start) as Pux.Devtool -import Pux.Router (sampleUrl) -import Signal ((~>)) - -type AppEffects = (dom :: DOM, ajax :: AJAX) - --- | App configuration -config :: forall eff. State -> Eff (dom :: DOM | eff) (Config State Action AppEffects) -config state = do - -- | Create a signal of URL changes. - urlSignal <- sampleUrl - - -- | Map a signal of URL changes to PageView actions. - let routeSignal = urlSignal ~> \r -> PageView (match r) - - pure - { initialState: state - , update: update - , view: view - , inputs: [routeSignal] } - --- | Entry point for the browser. -main :: State -> Eff (CoreEffects AppEffects) (App State Action) -main state = do - app <- start =<< config state - renderToDOM "#app" app.html - -- | Used by hot-reloading code in support/index.js - pure app - --- | Entry point for the browser with pux-devtool injected. -debug :: State -> Eff (CoreEffects AppEffects) (App State (Pux.Devtool.Action Action)) -debug state = do - app <- Pux.Devtool.start =<< config state - renderToDOM "#app" app.html - -- | Used by hot-reloading code in support/index.js - pure app - --- | Entry point for server side rendering -ssr :: State -> Eff (CoreEffects AppEffects) String -ssr state = do - app <- start =<< config state - res <- renderToString app.html - pure res diff --git a/frontend/src/NotFound.purs b/frontend/src/NotFound.purs deleted file mode 100644 index d22d26d..0000000 --- a/frontend/src/NotFound.purs +++ /dev/null @@ -1,8 +0,0 @@ -module App.NotFound where - -import Pux.Html (Html, (#), div, h2, text) - -view :: forall state action. state -> Html action -view state = - div # do - h2 # text "404 Not Found" diff --git a/frontend/src/Pux/DocumentTitle.js b/frontend/src/Pux/DocumentTitle.js deleted file mode 100644 index 4813319..0000000 --- a/frontend/src/Pux/DocumentTitle.js +++ /dev/null @@ -1,3 +0,0 @@ -var Pux = require('purescript-pux'); - -exports.documentTitle = Pux.fromReact(require('react-document-title')); diff --git a/frontend/src/Pux/DocumentTitle.purs b/frontend/src/Pux/DocumentTitle.purs deleted file mode 100644 index 584af35..0000000 --- a/frontend/src/Pux/DocumentTitle.purs +++ /dev/null @@ -1,7 +0,0 @@ -module Pux.DocumentTitle where - -import Pux.Html (Html, Attribute) - --- | Declaratively set `document.title`. See [react-document-title](https://github.com/gaearon/react-document-title) --- | for more information. -foreign import documentTitle :: forall a. Array (Attribute a) -> Array (Html a) -> Html a diff --git a/frontend/src/Resume.purs b/frontend/src/Resume.purs deleted file mode 100644 index 8a23d02..0000000 --- a/frontend/src/Resume.purs +++ /dev/null @@ -1,66 +0,0 @@ -module App.Resume where - -import App.Utils (mdify) -import Control.Monad.Aff (attempt) -import DOM (DOM) -import Data.Argonaut (class DecodeJson, decodeJson, (.?)) -import Data.Either (Either(..), either) -import Data.Maybe (Maybe(..)) -import Network.HTTP.Affjax (AJAX, get) -import Prelude (Unit, bind, pure, show, unit, ($), (<>), (<<<)) -import Pux (noEffects, EffModel) -import Pux.DocumentTitle (documentTitle) -import Pux.Html (Html, a, div, h1, p, text) -import Pux.Html.Attributes (href, dangerouslySetInnerHTML, className, id_, title) - -data Action = RequestResume - | ReceiveResume (Either String Resume) - -type State = - { status :: String - , err :: String - , resume :: Maybe Resume } - -data Resume = Resume - { body :: String } - -instance decodeJsonResume :: DecodeJson Resume where - decodeJson json = do - obj <- decodeJson json - body <- obj .? "body" - pure $ Resume { body: body } - -init :: State -init = - { status: "Loading..." - , err: "" - , resume: Nothing } - -update :: Action -> State -> EffModel State Action (ajax :: AJAX, dom :: DOM) -update (ReceiveResume (Left err)) state = - noEffects $ state { resume = Nothing, status = "Error in fetching resume, please use the plain text link below.", err = err } -update (ReceiveResume (Right body)) state = - noEffects $ state { status = "", err = "", resume = Just body } - where - got' = Just unit -update RequestResume state = - { state: state - , effects: [ do - res <- attempt $ get "/api/resume" - let decode r = decodeJson r.response :: Either String Resume - let resume = either (Left <<< show) decode res - pure $ ReceiveResume resume - ] - } - -view :: State -> Html Action -view { status: status, err: err, resume: resume } = - case resume of - Nothing -> div [] [ text status, p [] [ text err ] ] - (Just (Resume resume')) -> - div [ className "row" ] - [ documentTitle [ title "Resume - Christine Dodrill" ] [] - , div [ className "col s8 offset-s2" ] - [ p [ className "browser-default", dangerouslySetInnerHTML $ mdify resume'.body ] [] - , a [ href "/static/resume/resume.md" ] [ text "Plain-text version of this resume here" ], text "." ] - ] diff --git a/frontend/src/Routes.purs b/frontend/src/Routes.purs deleted file mode 100644 index 7076898..0000000 --- a/frontend/src/Routes.purs +++ /dev/null @@ -1,31 +0,0 @@ -module App.Routes where - -import App.BlogEntry as BlogEntry -import App.BlogIndex as BlogIndex -import App.Counter as Counter -import Control.Alt ((<|>)) -import Control.Apply ((<*), (*>)) -import Data.Functor ((<$)) -import Data.Maybe (fromMaybe) -import Prelude (($), (<$>)) -import Pux.Router (param, router, lit, str, end) - -data Route = Home - | Resume - | ContactPage - | StaticPage String - | BlogIndex - | BlogPost String - | NotFound - -match :: String -> Route -match url = fromMaybe NotFound $ router url $ - Home <$ end - <|> - BlogIndex <$ lit "blog" <* end - <|> - BlogPost <$> (lit "blog" *> str) <* end - <|> - ContactPage <$ lit "contact" <* end - <|> - Resume <$ lit "resume" <* end diff --git a/frontend/src/Utils.js b/frontend/src/Utils.js deleted file mode 100644 index 61023c8..0000000 --- a/frontend/src/Utils.js +++ /dev/null @@ -1,16 +0,0 @@ -// Module App.BlogEntry - -showdown = require("showdown"); - -showdown.extension('blog', function() { - return [{ - type: 'output', - regex: /<ul>/g, - replace: '<ul class="browser-default">' - }]; -}); - -exports.mdify = function(corpus) { - var converter = new showdown.Converter({ extensions: ['blog'] }); - return converter.makeHtml(corpus); -}; diff --git a/frontend/src/Utils.purs b/frontend/src/Utils.purs deleted file mode 100644 index 2d3c8a9..0000000 --- a/frontend/src/Utils.purs +++ /dev/null @@ -1,3 +0,0 @@ -module App.Utils where - -foreign import mdify :: String -> String diff --git a/frontend/support/index.html b/frontend/support/index.html deleted file mode 100644 index 65d0e6c..0000000 --- a/frontend/support/index.html +++ /dev/null @@ -1,18 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="UTF-8"/> - <meta http-equiv="Content-type" content="text/html; charset=utf-8"/> - <meta name="viewport" content="width=device-width, initial-scale=1" /> - <title>Christine Dodrill</title> - - <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> - <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.8/css/materialize.min.css"> - <link rel="stylesheet" href="/static/css/main.css"> - </head> - <body> - <div id="app"></div> - <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script> - <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.8/js/materialize.min.js"></script> - </body> -</html> diff --git a/frontend/support/index.js b/frontend/support/index.js deleted file mode 100644 index 9f6020d..0000000 --- a/frontend/support/index.js +++ /dev/null @@ -1,25 +0,0 @@ -var Main = require('../src/Main.purs'); -var initialState = require('../src/Layout.purs').init; -var debug = process.env.NODE_ENV === 'development' - -if (module.hot) { - var app = Main[debug ? 'debug' : 'main'](window.puxLastState || initialState)(); - app.state.subscribe(function (state) { - window.puxLastState = state; - }); - module.hot.accept(); -} else { - Main[debug ? 'debug' : 'main'](initialState)(); -} - -global.main = function(args, callback) { - var body = Main['ssr'](initialState)(); - - result = { - "app": body, - "uuid": args.uuid, - "title": "Christine Dodrill" - } - - callback(result); -}; |
