Create app-state tab
This commit is contained in:
parent
c3ca82e704
commit
3f83b46201
|
@ -1,5 +1,6 @@
|
|||
(ns day8.re-frame.trace
|
||||
(: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.components :as components]
|
||||
[day8.re-frame.trace.localstorage :as localstorage]
|
||||
|
@ -331,11 +332,14 @@
|
|||
[:button {:class (str "tab button " (when (= @selected-tab :traces) "active"))
|
||||
:on-click #(reset! selected-tab :traces)} "Traces"]
|
||||
[: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
|
||||
:traces [render-trace-panel]
|
||||
:subvis [subvis/render-subvis traces
|
||||
[:div.panel-content-scrollable]])]]]))})))
|
||||
[:div.panel-content-scrollable]]
|
||||
:app-state [app-state/tab @traces])]]]))})))
|
||||
|
||||
(defn panel-div []
|
||||
(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