               [clojure.string :as string]
               [om.dom :as dom :include-macros true]))
 
-(def TAB_KEY 9)
-(def ENTER_KEY 13)
 (defn now [] (new js/Date))
 (def custom-formatter (time-format/formatter "dd/MM/yyyy"))
 (def app-title (str "Notes " (time-format/unparse custom-formatter (time-core/date-time (.getFullYear (now)) (+ 1 (.getMonth (now))) (.getDate (now))))))

  (if (== 0 tab) content
    (reduce (fn [res _] (dom/ul nil res)) content (range 0 tab))))

(defn handle-new-note-keydown [e app owner]
  (js/console.log (str (== (.-which e) 9)))
  (let [pressed-key (.-which e)]
  (case (str pressed-key)
    "13"
    (do
      (let [new-field (om/get-node owner "newNote")]
      (when-not (string/blank? (.. new-field -value trim))

            [:create new-note]))
        (set! (.-value new-field) "")))
        false)
    "tab" (do
      (om/transact! app :tab
        #(+ % 1)
        [:tab nil])
      false)
    "shift+tab" (do
      (om/transact! app :tab
        #(- % 1)
        [:tab nil])
      false)
    nil
