This repository has been archived by the owner on Apr 24, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d67f605
Showing
18 changed files
with
599 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/resources/public/js/compiled/** | ||
figwheel_server.log | ||
pom.xml | ||
*jar | ||
/lib/ | ||
/classes/ | ||
/out/ | ||
/target/ | ||
.lein-deps-sum | ||
.lein-repl-history | ||
.lein-plugins/ | ||
.repl | ||
.nrepl-port |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# conduit | ||
|
||
FIXME: Write a one-line description of your library/project. | ||
|
||
## Overview | ||
|
||
FIXME: Write a paragraph about the library/project and highlight its goals. | ||
|
||
## Setup | ||
|
||
To get an interactive development environment run: | ||
|
||
lein figwheel | ||
|
||
and open your browser at [localhost:3449](http://localhost:3449/). | ||
This will auto compile and send all changes to the browser without the | ||
need to reload. After the compilation process is complete, you will | ||
get a Browser Connected REPL. An easy way to try it is: | ||
|
||
(js/alert "Am I connected?") | ||
|
||
and you should see an alert in the browser window. | ||
|
||
To clean all compiled files: | ||
|
||
lein clean | ||
|
||
To create a production build run: | ||
|
||
lein do clean, cljsbuild once min | ||
|
||
And open your browser in `resources/public/index.html`. You will not | ||
get live reloading, nor a REPL. | ||
|
||
## License | ||
|
||
Copyright © 2014 FIXME | ||
|
||
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module cursive.leiningen.project.LeiningenProjectsManager.displayName="conduit:0.1.0-SNAPSHOT" cursive.leiningen.project.LeiningenProjectsManager.isLeinModule="true" type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="false"> | ||
<output url="file://$MODULE_DIR$/target/classes" /> | ||
<output-test url="file://$MODULE_DIR$/target/classes" /> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/dev" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/dev-resources" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/resources" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" /> | ||
<excludeFolder url="file://$MODULE_DIR$/resources/public/js/compiled" /> | ||
<excludeFolder url="file://$MODULE_DIR$/target" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
<orderEntry type="library" name="Leiningen: args4j:2.0.26" level="project" /> | ||
<orderEntry type="library" name="Leiningen: binaryage/devtools:0.9.2" level="project" /> | ||
<orderEntry type="library" name="Leiningen: binaryage/env-config:0.1.1" level="project" /> | ||
<orderEntry type="library" name="Leiningen: clj-stacktrace:0.2.8" level="project" /> | ||
<orderEntry type="library" name="Leiningen: clj-time:0.11.0" level="project" /> | ||
<orderEntry type="library" name="Leiningen: cljsjs/react-dom:15.4.2-0" level="project" /> | ||
<orderEntry type="library" name="Leiningen: cljsjs/react:15.4.2-0" level="project" /> | ||
<orderEntry type="library" name="Leiningen: clojure-complete:0.2.4" level="project" /> | ||
<orderEntry type="library" name="Leiningen: com.cemerick/piggieback:0.2.1" level="project" /> | ||
<orderEntry type="library" name="Leiningen: com.google.code.findbugs/jsr305:1.3.9" level="project" /> | ||
<orderEntry type="library" name="Leiningen: com.google.code.gson/gson:2.2.4" level="project" /> | ||
<orderEntry type="library" name="Leiningen: com.google.guava/guava:19.0" level="project" /> | ||
<orderEntry type="library" name="Leiningen: com.google.javascript/closure-compiler-externs:v20160315" level="project" /> | ||
<orderEntry type="library" name="Leiningen: com.google.javascript/closure-compiler-unshaded:v20160315" level="project" /> | ||
<orderEntry type="library" name="Leiningen: com.google.protobuf/protobuf-java:2.5.0" level="project" /> | ||
<orderEntry type="library" name="Leiningen: com.stuartsierra/component:0.3.1" level="project" /> | ||
<orderEntry type="library" name="Leiningen: com.stuartsierra/dependency:0.2.0" level="project" /> | ||
<orderEntry type="library" name="Leiningen: commons-codec:1.6" level="project" /> | ||
<orderEntry type="library" name="Leiningen: commons-fileupload:1.3.1" level="project" /> | ||
<orderEntry type="library" name="Leiningen: commons-io:2.5" level="project" /> | ||
<orderEntry type="library" name="Leiningen: crypto-equality:1.0.0" level="project" /> | ||
<orderEntry type="library" name="Leiningen: crypto-random:1.2.0" level="project" /> | ||
<orderEntry type="library" name="Leiningen: figwheel-sidecar:0.5.10" level="project" /> | ||
<orderEntry type="library" name="Leiningen: figwheel:0.5.10" level="project" /> | ||
<orderEntry type="library" name="Leiningen: hawk:0.2.11" level="project" /> | ||
<orderEntry type="library" name="Leiningen: http-kit:2.2.0" level="project" /> | ||
<orderEntry type="library" name="Leiningen: joda-time:2.8.2" level="project" /> | ||
<orderEntry type="library" name="Leiningen: net.cgrand/parsley:0.9.3" level="project" /> | ||
<orderEntry type="library" name="Leiningen: net.cgrand/regex:1.1.0" level="project" /> | ||
<orderEntry type="library" name="Leiningen: net.cgrand/sjacket:0.1.1" level="project" /> | ||
<orderEntry type="library" name="Leiningen: net.incongru.watchservice/barbary-watchservice:1.0" level="project" /> | ||
<orderEntry type="library" name="Leiningen: net.java.dev.jna/jna:3.2.2" level="project" /> | ||
<orderEntry type="library" name="Leiningen: org.clojure/clojure:1.8.0" level="project" /> | ||
<orderEntry type="library" name="Leiningen: org.clojure/clojurescript:1.9.229" level="project" /> | ||
<orderEntry type="library" name="Leiningen: org.clojure/core.async:0.3.442" level="project" /> | ||
<orderEntry type="library" name="Leiningen: org.clojure/core.cache:0.6.5" level="project" /> | ||
<orderEntry type="library" name="Leiningen: org.clojure/core.memoize:0.5.9" level="project" /> | ||
<orderEntry type="library" name="Leiningen: org.clojure/data.json:0.2.6" level="project" /> | ||
<orderEntry type="library" name="Leiningen: org.clojure/data.priority-map:0.0.7" level="project" /> | ||
<orderEntry type="library" name="Leiningen: org.clojure/google-closure-library-third-party:0.0-20160609-f42b4a24" level="project" /> | ||
<orderEntry type="library" name="Leiningen: org.clojure/google-closure-library:0.0-20160609-f42b4a24" level="project" /> | ||
<orderEntry type="library" name="Leiningen: org.clojure/tools.analyzer.jvm:0.7.0" level="project" /> | ||
<orderEntry type="library" name="Leiningen: org.clojure/tools.analyzer:0.6.9" level="project" /> | ||
<orderEntry type="library" name="Leiningen: org.clojure/tools.nrepl:0.2.12" level="project" /> | ||
<orderEntry type="library" name="Leiningen: org.clojure/tools.reader:1.0.0-beta3" level="project" /> | ||
<orderEntry type="library" name="Leiningen: org.mozilla/rhino:1.7R5" level="project" /> | ||
<orderEntry type="library" name="Leiningen: org.ow2.asm/asm-all:4.2" level="project" /> | ||
<orderEntry type="library" name="Leiningen: ring-cors:0.1.8" level="project" /> | ||
<orderEntry type="library" name="Leiningen: ring/ring-codec:1.0.1" level="project" /> | ||
<orderEntry type="library" name="Leiningen: ring/ring-core:1.5.0" level="project" /> | ||
<orderEntry type="library" name="Leiningen: rum:0.10.8" level="project" /> | ||
<orderEntry type="library" name="Leiningen: sablono:0.7.7" level="project" /> | ||
<orderEntry type="library" name="Leiningen: simple-lein-profile-merge:0.1.4" level="project" /> | ||
<orderEntry type="library" name="Leiningen: strictly-specking-standalone:0.1.1" level="project" /> | ||
</component> | ||
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
(ns user | ||
(:require | ||
[figwheel-sidecar.repl-api :as f])) | ||
|
||
;; user is a namespace that the Clojure runtime looks for and | ||
;; loads if its available | ||
|
||
;; You can place helper functions in here. This is great for starting | ||
;; and stopping your webserver and other development services | ||
|
||
;; The definitions in here will be available if you run "lein repl" or launch a | ||
;; Clojure repl some other way | ||
|
||
;; You have to ensure that the libraries you :require are listed in your dependencies | ||
|
||
;; Once you start down this path | ||
;; you will probably want to look at | ||
;; tools.namespace https://github.com/clojure/tools.namespace | ||
;; and Component https://github.com/stuartsierra/component | ||
|
||
|
||
(defn fig-start | ||
"This starts the figwheel server and watch based auto-compiler." | ||
[] | ||
;; this call will only work are long as your :cljsbuild and | ||
;; :figwheel configurations are at the top level of your project.clj | ||
;; and are not spread across different lein profiles | ||
|
||
;; otherwise you can pass a configuration into start-figwheel! manually | ||
(f/start-figwheel!)) | ||
|
||
(defn fig-stop | ||
"Stop the figwheel server and watch based auto-compiler." | ||
[] | ||
(f/stop-figwheel!)) | ||
|
||
;; if you are in an nREPL environment you will need to make sure you | ||
;; have setup piggieback for this to work | ||
(defn cljs-repl | ||
"Launch a ClojureScript REPL that is connected to your build and host environment." | ||
[] | ||
(f/cljs-repl)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
(defproject conduit "0.1.0-SNAPSHOT" | ||
:description "FIXME: write this!" | ||
:url "http://example.com/FIXME" | ||
:license {:name "Eclipse Public License" | ||
:url "http://www.eclipse.org/legal/epl-v10.html"} | ||
|
||
:min-lein-version "2.7.1" | ||
|
||
:dependencies [[org.clojure/clojure "1.8.0"] | ||
[org.clojure/clojurescript "1.9.521"] | ||
[rum "0.10.8"] | ||
[org.roman01la/scrum "2.0.0-SNAPSHOT"] | ||
[bidi "2.0.17"] | ||
[funcool/promesa "1.8.1"] | ||
[funcool/httpurr "0.6.2"]] | ||
|
||
:plugins [[lein-figwheel "0.5.10"] | ||
[lein-cljsbuild "1.1.5" :exclusions [[org.clojure/clojure]]]] | ||
|
||
:source-paths ["src"] | ||
|
||
:cljsbuild {:builds | ||
[{:id "dev" | ||
:source-paths ["src"] | ||
|
||
;; the presence of a :figwheel configuration here | ||
;; will cause figwheel to inject the figwheel client | ||
;; into your build | ||
:figwheel true | ||
|
||
:compiler {:main conduit.core | ||
:asset-path "js/compiled/out" | ||
:output-to "resources/public/js/compiled/conduit.js" | ||
:output-dir "resources/public/js/compiled/out" | ||
:source-map-timestamp true | ||
;; To console.log CLJS data-structures make sure you enable devtools in Chrome | ||
;; https://github.com/binaryage/cljs-devtools | ||
:preloads [devtools.preload]}} | ||
|
||
;; This next build is an compressed minified build for | ||
;; production. You can build this with: | ||
;; lein cljsbuild once min | ||
{:id "min" | ||
:source-paths ["src"] | ||
:compiler {:output-to "resources/public/js/compiled/conduit.js" | ||
:main conduit.core | ||
:optimizations :advanced | ||
:pretty-print false}}]} | ||
|
||
:figwheel {;; :http-server-root "public" ;; default and assumes "resources" | ||
;; :server-port 3449 ;; default | ||
;; :server-ip "127.0.0.1" | ||
|
||
:css-dirs ["resources/public/css"]} ;; watch and update CSS | ||
|
||
;; Start an nREPL server into the running figwheel process | ||
;; :nrepl-port 7888 | ||
|
||
;; Server Ring Handler (optional) | ||
;; if you want to embed a ring handler into the figwheel http-kit | ||
;; server, this is for simple ring servers, if this | ||
|
||
;; doesn't work for you just run your own server :) (see lein-ring) | ||
|
||
;; :ring-handler hello_world.server/handler | ||
|
||
;; To be able to open files in your editor from the heads up display | ||
;; you will need to put a script on your path. | ||
;; that script will have to take a file path and a line number | ||
;; ie. in ~/bin/myfile-opener | ||
;; #! /bin/sh | ||
;; emacsclient -n +$2 $1 | ||
;; | ||
;; :open-file-command "myfile-opener" | ||
|
||
;; if you are using emacsclient you can just use | ||
;; :open-file-command "emacsclient" | ||
|
||
;; if you want to disable the REPL | ||
;; :repl false | ||
|
||
;; to configure a different figwheel logfile path | ||
;; :server-logfile "tmp/logs/figwheel-logfile.log" | ||
|
||
;; to pipe all the output to the repl | ||
;; :server-logfile false | ||
|
||
|
||
|
||
;; setting up nREPL for Figwheel and ClojureScript dev | ||
;; Please see: | ||
;; https://github.com/bhauman/lein-figwheel/wiki/Using-the-Figwheel-REPL-within-NRepl | ||
:profiles {:dev {:dependencies [[binaryage/devtools "0.9.2"] | ||
[figwheel-sidecar "0.5.10"] | ||
[com.cemerick/piggieback "0.2.1"]] | ||
;; need to add dev source path here to get user.clj loaded | ||
:source-paths ["src" "dev"] | ||
;; for CIDER | ||
;; :plugins [[cider/cider-nrepl "0.12.0"]] | ||
:repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]} | ||
;; need to add the compliled assets to the :clean-targets | ||
:clean-targets ^{:protect false} ["resources/public/js/compiled" | ||
:target-path]}}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/* some style */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Conduit</title> | ||
<!-- Import Ionicon icons & Google Fonts our Bootstrap theme relies on --> | ||
<link href="//code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" rel="stylesheet" type="text/css"> | ||
<link href="//fonts.googleapis.com/css?family=Titillium+Web:700|Source+Serif+Pro:400,700|Merriweather+Sans:400,700|Source+Sans+Pro:400,300,600,700,300italic,400italic,600italic,700italic" rel="stylesheet" type="text/css"> | ||
<!-- Import the custom Bootstrap 4 theme from our hosted CDN --> | ||
<link rel="stylesheet" href="//demo.productionready.io/main.css"> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script src="js/compiled/conduit.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
(ns conduit.api | ||
(:require [scrum.core :as scrum] | ||
[httpurr.client.xhr :as xhr] | ||
[promesa.core :as p])) | ||
|
||
(defn ->uri [path] | ||
(str "https://conduit.productionready.io/api/" path)) | ||
|
||
(def endpoints | ||
{:articles "articles" | ||
:tags "tags"}) | ||
|
||
(defn parse-body [res] | ||
(-> (:body res) | ||
js/JSON.parse | ||
(js->clj :keywordize-keys true))) | ||
|
||
(defn fetch [endpoint] | ||
(-> (get endpoints endpoint) | ||
->uri | ||
xhr/get | ||
(p/then parse-body))) | ||
|
||
(defn mixin [controller->endpoint] | ||
{:did-mount | ||
(fn [{[r] :rum/args | ||
:as state}] | ||
(doseq [[controller endpoint] controller->endpoint] | ||
(->> (fetch endpoint) | ||
(scrum/dispatch! r controller :load r))) | ||
state)}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
(ns conduit.components.base | ||
(:require [rum.core :as rum])) | ||
|
||
(rum/defc Button [{:keys [icon]} label] | ||
[:button.btn.btn-outline-primary.btn-sm.pull-xs-right | ||
(when icon [:i {:class icon}]) | ||
(when icon " ") | ||
label]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
(ns conduit.components.footer | ||
(:require [rum.core :as rum])) | ||
|
||
(rum/defc Footer [] | ||
[:footer | ||
[:div.container | ||
[:a.logo-font {:href "/"} "conduit"] | ||
[:span.attribution | ||
"An interactive learning project from " | ||
[:a {:href "https://thinkster.io"} "Thinkster"] | ||
". " | ||
"Code & design licensed under MIT."]]]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
(ns conduit.components.grid | ||
(:require [rum.core :as rum])) | ||
|
||
(rum/defc Row [& children] | ||
(apply vector :div.row children)) | ||
|
||
(rum/defc Column [size & children] | ||
(apply vector :div {:class (str "col-md-" size)} children)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
(ns conduit.components.header | ||
(:require [rum.core :as rum])) | ||
|
||
(def nav-items | ||
[{:label "Home" | ||
:route :home} | ||
{:label "New Post" | ||
:route :new-post | ||
:icon "ion-compose"} | ||
{:label "Settings" | ||
:route :settings | ||
:icon "ion-gear-a"} | ||
{:label "Sign up" | ||
:route :sign-up}]) | ||
|
||
(rum/defc NavItem [curr-route {:keys [label icon route]}] | ||
[:li.nav-item {:class (when (= route curr-route) "active")} | ||
[:a.nav-link {:href ""} | ||
(when icon [:i {:class icon}]) | ||
(when icon " ") | ||
label]]) | ||
|
||
(rum/defc Header [r route] | ||
[:nav.navbar.navbar-light | ||
[:div.container | ||
[:a.navbar-brand {:href "index.html"} "conduit"] | ||
[:ul.nav.navbar-nav.pull-xs-right | ||
(map #(rum/with-key (NavItem route %) (:label %)) nav-items)]]]) |
Oops, something went wrong.