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