Create app-state tab
This commit is contained in:
parent
5f3cb0dbb8
commit
506ee537f1
|
@ -1,5 +1,6 @@
|
||||||
(ns day8.re-frame.trace
|
(ns day8.re-frame.trace
|
||||||
(:require [day8.re-frame.trace.subvis :as subvis]
|
(:require [day8.re-frame.trace.subvis :as subvis]
|
||||||
|
[day8.re-frame.trace.app-state :as app-state]
|
||||||
[day8.re-frame.trace.styles :as styles]
|
[day8.re-frame.trace.styles :as styles]
|
||||||
[day8.re-frame.trace.components :as components]
|
[day8.re-frame.trace.components :as components]
|
||||||
[day8.re-frame.trace.localstorage :as localstorage]
|
[day8.re-frame.trace.localstorage :as localstorage]
|
||||||
|
@ -391,11 +392,14 @@
|
||||||
[:button {:class (str "tab button " (when (= @selected-tab :traces) "active"))
|
[:button {:class (str "tab button " (when (= @selected-tab :traces) "active"))
|
||||||
:on-click #(reset! selected-tab :traces)} "Traces"]
|
:on-click #(reset! selected-tab :traces)} "Traces"]
|
||||||
[:button {:class (str "tab button " (when (= @selected-tab :subvis) "active"))
|
[:button {:class (str "tab button " (when (= @selected-tab :subvis) "active"))
|
||||||
:on-click #(reset! selected-tab :subvis)} "SubVis"]]]
|
:on-click #(reset! selected-tab :subvis)} "SubVis"]
|
||||||
|
[:button {:class (str "tab button " (when (= @selected-tab :app-state) "active"))
|
||||||
|
:on-click #(reset! selected-tab :app-state)} "app-state"]]]
|
||||||
(case @selected-tab
|
(case @selected-tab
|
||||||
:traces [render-trace-panel]
|
:traces [render-trace-panel]
|
||||||
:subvis [subvis/render-subvis traces
|
:subvis [subvis/render-subvis traces
|
||||||
[:div.panel-content-scrollable]])]]]))})))
|
[:div.panel-content-scrollable]]
|
||||||
|
:app-state [app-state/tab @traces])]]]))})))
|
||||||
|
|
||||||
(defn panel-div []
|
(defn panel-div []
|
||||||
(let [id "--re-frame-trace--"
|
(let [id "--re-frame-trace--"
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
(ns day8.re-frame.trace.app-state
|
||||||
|
(:require [reagent.core :as r]
|
||||||
|
[clojure.string :as str]))
|
||||||
|
|
||||||
|
(defn classname
|
||||||
|
[obj]
|
||||||
|
(str/replace (pr-str (type obj)) #"\.|/" "-"))
|
||||||
|
|
||||||
|
(defn view
|
||||||
|
[data]
|
||||||
|
(if (string? data)
|
||||||
|
[:span.data-string data]
|
||||||
|
[:div {:class (classname data)}]))
|
||||||
|
|
||||||
|
(defn crawl
|
||||||
|
[data]
|
||||||
|
(if (coll? data)
|
||||||
|
(into (view data) (mapv crawl data))
|
||||||
|
(view data)))
|
||||||
|
|
||||||
|
(defn tab [data]
|
||||||
|
(println (crawl data))
|
||||||
|
(crawl data))
|
Loading…
Reference in New Issue