 
 (defdom notebooks-list [aurora]
   [:ul {:className "programs"}
-   (each [[name notebook] (:notebooks aurora)]
+   (each [notebook (from-index (:notebooks aurora))]
          (let [click (fn []
-                       (swap! aurora-state assoc :notebook name :screen :pages))]
+                       (swap! aurora-state assoc :notebook (:id notebook) :screen :pages))]
            (if (input? (:id notebook))
              [:li {:className "program-item"}
               [:input {:type "text" :defaultValue (:desc notebook)
                        :onKeyPress (fn [e]
                                      (when (= 13 (.-charCode e))
                                        (remove-input! (:id notebook))
-                                       (swap! aurora-state assoc-in [:notebooks (:id notebook) :desc] (.-target.value e))
+                                       (update-index! notebook [] assoc :desc (.-target.value e))
                                        ))}]]
              [:li {:className "program-item"
                    :onContextMenu (fn [e]
                                     (add-input! (:id notebook) :desc)
+                                    (.stopPropagation e)
                                     (.preventDefault e))
                    :onTouchStart click
                    :onClick click}


(defn remove-input! [id]
  (swap! aurora-state update-in [:cache :inputs] dissoc id))

(defn add-notebook! [desc]
  (let [notebook {:type :notebook
                  :id (compiler/new-id)
                  :desc desc
                  :pages {}}]
    (when (ast/notebook! notebook)
      (swap! aurora-state update-in [:notebooks] assoc (:id notebook) notebook)
      (add-input! (:id notebook) :desc)
      notebook)))

(defn add-page! [notebook-id desc]
  (let [page {:type :page
              :id (compiler/new-id)
              :tags #{:page}
              :args []
              :desc desc
              :steps {}}]
    (when (ast/page! page)
      (swap! aurora-state update-in [:notebooks notebook-id :pages] assoc (:id page) page)
      page)))

(defn add-step! [notebook-id page-id info])


    (condp = (:screen @aurora-state)
      :notebooks (notebooks-list @aurora-state)
      :pages (pages-list (from-index (:notebook @aurora-state)))
      :editor (editing-view))
    ]])

