mirror of
https://github.com/heyarne/airsonic-ui.git
synced 2026-05-06 18:33:38 +02:00
Initial commit; shadow-cljs, re-frame + re-frame-10x
This commit is contained in:
commit
4fc35c34b0
11 changed files with 1813 additions and 0 deletions
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
.nrepl-port
|
||||||
|
.shadow-cljs/
|
||||||
|
node_modules/
|
||||||
|
public/app/
|
||||||
1705
package-lock.json
generated
Normal file
1705
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
21
package.json
Normal file
21
package.json
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"name": "airsonic-ui",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"description": "Airsonic UI written with re-frame",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"author": "Arne Schlüter",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"create-react-class": "^15.6.3",
|
||||||
|
"react": "^16.3.2",
|
||||||
|
"react-dom": "^16.3.2",
|
||||||
|
"shadow-cljs": "^2.3.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"react-flip-move": "^3.0.1",
|
||||||
|
"react-highlight.js": "^1.0.7"
|
||||||
|
}
|
||||||
|
}
|
||||||
12
public/index.html
Normal file
12
public/index.html
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>Airsonic UI</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app"> </div>
|
||||||
|
<script src="/app/js/main.js"></script>
|
||||||
|
<script>airsonic_ui.core.init()</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
18
shadow-cljs.edn
Normal file
18
shadow-cljs.edn
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
;; shadow-cljs configuration
|
||||||
|
{:source-paths
|
||||||
|
["src"]
|
||||||
|
|
||||||
|
:dependencies
|
||||||
|
[[reagent "0.7.0"]
|
||||||
|
[re-frame "0.10.5"]
|
||||||
|
[day8.re-frame/re-frame-10x "0.3.2-react16"]]
|
||||||
|
|
||||||
|
:builds
|
||||||
|
{:app {:target :browser
|
||||||
|
:output-dir "public/app/js"
|
||||||
|
:asset-path "/app/js"
|
||||||
|
:closure-defines {"re_frame.trace.trace_enabled_QMARK_" true}
|
||||||
|
:modules {:main {:entries [airsonic-ui.core]}}
|
||||||
|
:devtools {:http-root "public"
|
||||||
|
:http-port 8080
|
||||||
|
:preloads [day8.re-frame-10x.preload]}}}}
|
||||||
4
src/airsonic_ui/config.cljs
Normal file
4
src/airsonic_ui/config.cljs
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
(ns airsonic-ui.config)
|
||||||
|
|
||||||
|
(def debug?
|
||||||
|
^boolean goog.DEBUG)
|
||||||
22
src/airsonic_ui/core.cljs
Normal file
22
src/airsonic_ui/core.cljs
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
(ns airsonic-ui.core
|
||||||
|
(:require [reagent.core :as reagent]
|
||||||
|
[re-frame.core :as re-frame]
|
||||||
|
[airsonic-ui.events :as events]
|
||||||
|
[airsonic-ui.views :as views]
|
||||||
|
[airsonic-ui.config :as config]))
|
||||||
|
|
||||||
|
|
||||||
|
(defn dev-setup []
|
||||||
|
(when config/debug?
|
||||||
|
(enable-console-print!)
|
||||||
|
(println "dev mode")))
|
||||||
|
|
||||||
|
(defn mount-root []
|
||||||
|
(re-frame/clear-subscription-cache!)
|
||||||
|
(reagent/render [views/main-panel]
|
||||||
|
(.getElementById js/document "app")))
|
||||||
|
|
||||||
|
(defn ^:export init []
|
||||||
|
(re-frame/dispatch-sync [::events/initialize-db])
|
||||||
|
(dev-setup)
|
||||||
|
(mount-root))
|
||||||
4
src/airsonic_ui/db.cljs
Normal file
4
src/airsonic_ui/db.cljs
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
(ns airsonic-ui.db)
|
||||||
|
|
||||||
|
(def default-db
|
||||||
|
{:name "re-frame"})
|
||||||
8
src/airsonic_ui/events.cljs
Normal file
8
src/airsonic_ui/events.cljs
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
(ns airsonic-ui.events
|
||||||
|
(:require [re-frame.core :as re-frame]
|
||||||
|
[airsonic-ui.db :as db]))
|
||||||
|
|
||||||
|
(re-frame/reg-event-db
|
||||||
|
::initialize-db
|
||||||
|
(fn [_]
|
||||||
|
db/default-db))
|
||||||
7
src/airsonic_ui/subs.cljs
Normal file
7
src/airsonic_ui/subs.cljs
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
(ns airsonic-ui.subs
|
||||||
|
(:require [re-frame.core :as re-frame]))
|
||||||
|
|
||||||
|
(re-frame/reg-sub
|
||||||
|
::name
|
||||||
|
(fn [db]
|
||||||
|
(:name db)))
|
||||||
8
src/airsonic_ui/views.cljs
Normal file
8
src/airsonic_ui/views.cljs
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
(ns airsonic-ui.views
|
||||||
|
(:require [re-frame.core :as re-frame]
|
||||||
|
[airsonic-ui.subs :as subs]
|
||||||
|
))
|
||||||
|
|
||||||
|
(defn main-panel []
|
||||||
|
(let [name (re-frame/subscribe [::subs/name])]
|
||||||
|
[:div "Hello from " @name]))
|
||||||
Loading…
Add table
Add a link
Reference in a new issue