 
 (defn set-html [[keyword val]]
   (set-html! (by-id (str keyword)) (format keyword val)))
-  
+
 (defmulti play :state)
 
 (defmethod play :almost [_]

  (do-workout))

#_(defroute  "/workout" []
  (.log js/console "starting workout")
  (start-workout))

(defn show-root []
  (let [go-chan (listen (by-id "ok") "click")]
    (to-html (swap! app-state update-in [:workout] add-id ))
    (go (<! go-chan) (start-workout))))

#_(defroute "/" []
  (.log js/console "showing root")
  (show-root))


;; Quick and dirty history configuration.

(defn main []
  (show-root)
  (swap! app-state assoc :running-workout false)
  (swap! app-state assoc :total-duration 0)
  #_(let [h (History.)]
    (goog.events/listen h EventType/NAVIGATE #(secretary/dispatch! (.-token %)))
    (doto h (.setEnabled true)
          (.setToken "/"))))

(defcomponent om-show-moon-board [data owner]
  (render-state [_ _]
                (dom/div {:class "row"}
                         (dom/div {:class "col-sm-12"}
                                  (dom/img {:class "img-rounded"
                                            :src "FingerboardNumbered1.jpg"})))))
                
(defcomponent om-show-workout [data owner]
  (will-mount [_]
              (om/set-state! owner :n (:init data)))
  (render-state [this {:keys [n]}]
                (->om-show-moon-board {})))

;;(dom/span (str "Count: " n))
;;(dom/button
;;        {:on-click #(om/set-state! owner :n (inc n))}
;;        "+")
;;      (dom/button
;;        {:on-click #(om/set-state! owner :n (dec n))}
;;        "-"))))

(om/root om-show-workout app-state
         {:target (by-id "app")})
             

    (set-html! (by-id ":remaining") (->minutes remaining))
    (set-html! (by-id ":type") (string/capitalize (name activity)))
    (dorun (map set-html (dissoc (assoc excercise :total total) :id :activity)))))

(defn wall-clock []
  (let [output (chan)]
    (go-loop []
