             [reagent-forms.core :refer [bind-fields]]
             [ajax.core :refer [POST]])
   (:require-macros [secretary.core :refer [defroute]]))
+
+
+(defn row [label & body]
+  [:div.row
+   [:div.col-md-2 [:span label]]
+   [:div.col-md-3 body]])
+
+(defn text-input [id label]
+  (row label [:input.form-control {:field :text
+                                   :id    id}]))
 
 
 

(defn in-seq? [s x]
  (some? (some #{x} s)))

(defn create-graph []
  (js/sigma.parsers.json "/api/network/Anime/CowboyBebop" ; "/static/test-data/basic-graph.json"
                         (clj->js {
                                   :renderer {:container (.getElementById js/document "container")
                                              :type      "canvas"

                                  ))
                         ))

(defn redraw-graph []
  (let [current (:graph @state)]                            ; Must be set by importer on creation
    (if current
      (do
        (.kill current)
        (swap! state assoc :graph nil)))
    (create-graph (-> (.getElementById js/document "trope-code") .-value))
    ))


(defn plot []
  [:div
   (text-input :trope-code "Trope code:")
   [:input {:type     "button" :value "Graph!"
            :on-click #(redraw-graph)}]
   [:div {:id "container"}]])

(def pages
  {:home  plot
   :about about-page})


(defn page []
