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" [:span {:class "toggle"
:on-click #(rf/dispatch [:app-db/toggle-expansion path])} :on-click #(rf/dispatch [:app-db/toggle-expansion path])}
[:button.expansion-button (if @expanded? "▼" "▶")]] [:button.expansion-button (if @expanded? "▼" "▶")]]
(if (and @expanded? (cljs-devtools-has-body (get-object jsonml) (get-config jsonml))) (if (and @expanded? (cljs-devtools-has-body (get-object jsonml) (get-config jsonml)))
(jsonml->hiccup (jsonml->hiccup
(cljs-devtools-body (cljs-devtools-body
@ -124,7 +120,9 @@
(cond (cond
(and @expanded? (and @expanded?
(or (string? data) (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)))]]))) @expanded? (jsonml->hiccup (cljs-devtools-header data) (conj path 0)))]])))
(defn subscription-render [data title path] (defn subscription-render [data title path]
@ -141,5 +139,7 @@
(cond (cond
(and @expanded? (and @expanded?
(or (string? data) (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)))]]))) @expanded? (jsonml->hiccup (cljs-devtools-header data) (conj path 0)))]])))

View File

@ -21,9 +21,10 @@
[:div.panel-content-scrollable {:style {:margin-left "10px"}} [:div.panel-content-scrollable {:style {:margin-left "10px"}}
[:div.subtrees {:style {:margin "20px 0"}} [:div.subtrees {:style {:margin "20px 0"}}
(doall (doall
(->> @subs/query->reaction
(sort)
(map (fn [me] (map (fn [me]
(let [[query-v dyn-v :as inputs] (key me)] (let [[query-v dyn-v :as inputs] (key me)]
@re-frame.db/app-db
^{:key query-v} ^{:key query-v}
[:div.subtree-wrapper {:style {:margin "10px 0"}} [:div.subtree-wrapper {:style {:margin "10px 0"}}
[:div.subtree [:div.subtree
@ -33,5 +34,7 @@
[:span.subtree-button-string [:span.subtree-button-string
(prn-str (first (key me)))]] (prn-str (first (key me)))]]
(into [:subs] query-v)]]])) (into [:subs] query-v)]]]))
@subs/query->reaction))]]]) )))
(do @re-frame.db/app-db
nil)]]])