Improve appearance of subscriptions panel

This commit is contained in:
Daniel Compton 2017-11-23 10:03:03 +13:00
parent 065e5f8a50
commit 6128ec1901
2 changed files with 22 additions and 19 deletions

View File

@ -71,10 +71,6 @@
[:span {:class "toggle"
:on-click #(rf/dispatch [:app-db/toggle-expansion path])}
[:button.expansion-button (if @expanded? "▼" "▶")]]
(if (and @expanded? (cljs-devtools-has-body (get-object jsonml) (get-config jsonml)))
(jsonml->hiccup
(cljs-devtools-body
@ -124,7 +120,9 @@
(cond
(and @expanded?
(or (string? data)
(number? data))) [:div {:style {:margin "10px 0"}} data]
(number? data)
(boolean? data)
(nil? data))) [:div {:style {:margin "10px 0"}} (prn-str data)]
@expanded? (jsonml->hiccup (cljs-devtools-header data) (conj path 0)))]])))
(defn subscription-render [data title path]
@ -141,5 +139,7 @@
(cond
(and @expanded?
(or (string? data)
(number? data))) [:div {:style {:margin "10px 0"}} data]
(number? data)
(boolean? data)
(nil? data))) [:div {:style {:margin "10px 0"}} (prn-str data)]
@expanded? (jsonml->hiccup (cljs-devtools-header data) (conj path 0)))]])))

View File

@ -21,17 +21,20 @@
[:div.panel-content-scrollable {:style {:margin-left "10px"}}
[:div.subtrees {:style {:margin "20px 0"}}
(doall
(map (fn [me]
(let [[query-v dyn-v :as inputs] (key me)]
@re-frame.db/app-db
^{:key query-v}
[:div.subtree-wrapper {:style {:margin "10px 0"}}
[:div.subtree
[data-browser/subscription-render
(rc/deref-or-value-peek (val me))
[:button.subtree-button {:on-click #(rf/dispatch [:app-db/remove-path (key me)])}
[:span.subtree-button-string
(prn-str (first (key me)))]]
(into [:subs] query-v)]]]))
@subs/query->reaction))]]])
(->> @subs/query->reaction
(sort)
(map (fn [me]
(let [[query-v dyn-v :as inputs] (key me)]
^{:key query-v}
[:div.subtree-wrapper {:style {:margin "10px 0"}}
[:div.subtree
[data-browser/subscription-render
(rc/deref-or-value-peek (val me))
[:button.subtree-button {:on-click #(rf/dispatch [:app-db/remove-path (key me)])}
[:span.subtree-button-string
(prn-str (first (key me)))]]
(into [:subs] query-v)]]]))
)))
(do @re-frame.db/app-db
nil)]]])