Skip to content

Commit d9ac82b

Browse files
committed
upgrade respo and update new states syntax
1 parent fd6c820 commit d9ac82b

11 files changed

+363
-326
lines changed

calcit.cirru

+115-69
Large diffs are not rendered by default.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"devDependencies": {
2929
"feather-icons": "^4.26.0",
3030
"http-server": "^0.12.1",
31-
"shadow-cljs": "^2.8.92",
31+
"shadow-cljs": "^2.8.93",
3232
"source-map-support": "^0.5.16",
3333
"url-parse": "^1.4.7"
3434
}

shadow-cljs.edn

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
[mvc-works/shell-page "0.1.10"]
77
[mvc-works/ws-edn "0.1.3"]
88
[cumulo/recollect "0.5.0"]
9-
[cumulo/reel "0.1.1"]
9+
[cumulo/reel "0.2.0-a1"]
1010
[cumulo/util "0.1.10"]
11-
[respo "0.11.5"]
11+
[respo "0.12.1-a2"]
1212
[respo/ui "0.3.14"]
13-
[respo/alerts "0.4.3"]
13+
[respo/alerts "0.5.0-a2"]
1414
[respo/message "0.3.6"]
1515
[respo/feather "0.1.1"]
1616
[cirru/bisection-key "0.1.5"]
17-
[cirru/favored-edn "0.1.2"]
17+
[cirru/favored-edn "0.1.3"]
1818
[medley "1.3.0"]
19-
[appliedscience/js-interop "0.2.4"]
19+
[appliedscience/js-interop "0.2.5"]
2020
[org.clojure/core.incubator "0.1.4"]
2121
]
2222
:open-file-command [

src/app/client.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
(ns app.client
33
(:require [respo.core :refer [render! clear-cache! realize-ssr!]]
4-
[respo.cursor :refer [mutate]]
4+
[respo.cursor :refer [update-states]]
55
[app.comp.container :refer [comp-container]]
66
[cljs.reader :refer [read-string]]
77
[app.schema :as schema]
@@ -32,7 +32,7 @@
3232
(defn dispatch! [op op-data]
3333
(when (and config/dev? (not= op :states)) (println "Dispatch" op op-data))
3434
(case op
35-
:states (reset! *states ((mutate op-data) @*states))
35+
:states (reset! *states (update-states @*states op-data))
3636
:effect/connect (connect!)
3737
(ws-send! {:kind :op, :op op, :data op-data})))
3838

src/app/comp/container.cljs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
(ns app.comp.container
33
(:require [hsl.core :refer [hsl]]
44
[respo-ui.core :as ui]
5-
[respo.core :refer [defcomp <> div span action-> cursor-> button]]
5+
[respo.core :refer [defcomp <> >> div span button]]
66
[respo.comp.inspect :refer [comp-inspect]]
77
[respo.comp.space :refer [=<]]
88
[app.comp.navigation :refer [comp-navigation]]
@@ -31,7 +31,7 @@
3131
:background-size :contain}})
3232
(div
3333
{:style {:cursor :pointer, :line-height "32px"},
34-
:on-click (action-> :effect/connect nil)}
34+
:on-click (fn [e d!] (d! :effect/connect nil))}
3535
(<> "No connection..." {:font-family ui/font-fancy, :font-size 24}))))
3636

3737
(defcomp
@@ -66,11 +66,11 @@
6666
:home (<> "Home")
6767
:profile (comp-profile (:user store) (:data router))
6868
(<> router))
69-
(comp-login states))
69+
(comp-login (>> states :login)))
7070
(comp-status-color (:color store))
7171
(when dev? (comp-inspect "Store" store {:bottom 0, :left 0, :max-width "100%"}))
7272
(comp-messages
7373
(get-in store [:session :messages])
7474
{}
75-
(fn [info d! m!] (d! :session/remove-message info)))
75+
(fn [info d!] (d! :session/remove-message info)))
7676
(when dev? (comp-reel (:reel-length store) {}))))))

src/app/comp/login.cljs

+3-5
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
(def initial-state {:username "", :password ""})
1111

12-
(defn on-input [state k] (fn [e dispatch! mutate!] (mutate! (assoc state k (:value e)))))
13-
1412
(defn on-submit [username password signup?]
1513
(fn [e dispatch!]
1614
(dispatch! (if signup? :user/sign-up :user/log-in) [username password])
@@ -19,7 +17,7 @@
1917
(defcomp
2018
comp-login
2119
(states)
22-
(let [state (or (:data states) initial-state)]
20+
(let [cursor (:cursor states), state (or (:data states) initial-state)]
2321
(div
2422
{:style (merge ui/flex ui/center)}
2523
(div
@@ -32,15 +30,15 @@
3230
{:placeholder "Username",
3331
:value (:username state),
3432
:style ui/input,
35-
:on-input (on-input state :username)}))
33+
:on-input (fn [e d!] (d! cursor (assoc state :username (:value e))))}))
3634
(=< nil 8)
3735
(div
3836
{}
3937
(input
4038
{:placeholder "Password",
4139
:value (:password state),
4240
:style ui/input,
43-
:on-input (on-input state :password)})))
41+
:on-input (fn [e d!] (d! cursor (assoc state :password (:value e))))})))
4442
(=< nil 8)
4543
(div
4644
{:style {:text-align :right}}

src/app/comp/navigation.cljs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
(:require [hsl.core :refer [hsl]]
44
[respo-ui.core :as ui]
55
[respo.comp.space :refer [=<]]
6-
[respo.core :refer [defcomp <> action-> span div]]
6+
[respo.core :refer [defcomp <> span div]]
77
[app.config :as config]))
88

99
(defcomp
@@ -19,10 +19,10 @@
1919
:border-bottom (str "1px solid " (hsl 0 0 0 0.1)),
2020
:font-family ui/font-fancy})}
2121
(div
22-
{:on-click (action-> :router/change {:name :home}), :style {:cursor :pointer}}
22+
{:on-click (fn [e d!] (d! :router/change {:name :home})), :style {:cursor :pointer}}
2323
(<> (:title config/site) nil))
2424
(div
25-
{:style {:cursor "pointer"}, :on-click (action-> :router/change {:name :profile})}
25+
{:style {:cursor "pointer"}, :on-click (fn [e d!] (d! :router/change {:name :profile}))}
2626
(<> (if logged-in? "Me" "Guest"))
2727
(=< 8 nil)
2828
(<> count-members))))

src/app/comp/profile.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@
3737
{}
3838
(button
3939
{:style (merge ui/button),
40-
:on-click (fn [e d! m!]
40+
:on-click (fn [e d!]
4141
(js/location.replace (str js/location.origin "?time=" (.now js/Date))))}
4242
(<> "Refresh"))
4343
(=< 8 nil)
4444
(button
4545
{:style (merge ui/button {:color :red, :border-color :red}),
46-
:on-click (fn [e dispatch! mutate!]
46+
:on-click (fn [e dispatch!]
4747
(dispatch! :user/log-out nil)
4848
(.removeItem js/localStorage (:storage-key config/site)))}
4949
(<> "Log out")))))

upload.cirru

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
{} (:host |cumulo.org)
3+
:uploads $ []
4+
{} (:from |dist/*) (:to |/web-assets/cdn/cumulo-workflow/)
5+
{} (:from |dist/{index.html,manifest.json}) (:to |/web-assets/repo/Cumulo/workflow/)
6+
{} (:from |dist/{server.js,package.json}) (:to |/servers/workflow/)

upload.edn

-8
This file was deleted.

0 commit comments

Comments
 (0)