                                     (dom/th nil "Blue Trampoline")
                                     (om/build table-cell (:blue-trampete settings) {:init-state {:options (mapv (fn [i] [i]) (range 1 7))}})
                                     )
+                            (dom/tr nil
+                                    (dom/th nil "Spiel Dauer")
+                                    (om/build table-cell (:time settings) {:init-state {:options (mapv (fn [i] [i]) (range 30 61))}})
+                                    )
                             )
 
                  )
       ))
   )
 
+
+(def json-writer (transit/writer :json-verbose))
+
+(defn download-href []
+  (let [json (transit/write json-writer (load-local-storage "game"))]
+    (str "data:application/json;charset=utf-8," (clojure.string/replace json " " "\u00a0"))))
+
+(defn download-page [e]
+  (let [a-tag (.. e -target)]
+    (aset a-tag "download" "website.json")
+    (aset a-tag "href" (download-href))))
+
+(defn preview-or-tutorial [app]
+  (dom/li nil
+          (dom/button #js {:className "btn btn-success navbar-btn" :onClick (fn [e] (om/transact! app :show-help (fn [bool] (not bool))) false)}
+                 (if (app :show-help)
+                   "Website"
+                   "Tutorial"))))
+
+(defn update-storage [json]
+  (let [transit-reader (transit/reader :json)
+        user-data (transit/read transit-reader (clojure.string/replace json "\u00a0" " "))
+        ]
+    (swap! app-state (fn [_] user-data))
+    ))
+
+(defn handle-upload [e]
+  (let [file-field (.. e -target)
+        file (aget file-field "files" 0)
+        file-reader (js/FileReader.)
+        content (.readAsText file-reader file)]
+    (set! (.-onload file-reader) (fn [] (update-storage (aget file-reader "result"))))
+    false))
+
+(defn upload-menu-item []
+  (dom/li nil
+          (dom/div #js {:className "btn-file btn btn-success navbar-btn"}
+                   (dom/form #js {:method "post" :encType "multipart/form-data"}
+                             (dom/input #js {:type "file" :name "data" :className "file-input" :onChange handle-upload}))
+                   (dom/span nil "Hochladen")
+                   )))
+
+
+(defn reset-page [e]
+  (reset! app-state default-data)
+  false
+  )
+
 (defn design-view [app owner]
   (reify
     om/IRenderState
     (render-state [this state]
       (dom/div nil
+               (dom/h2 #js {:href "#"} "Menu")
+               (dom/ul nil
+                       (dom/li nil
+                               (dom/a #js {:href "#" :onClick download-page} "Herunterladen")
+                               )
+                       (dom/li nil
+                               (dom/a #js {:href "#" :onClick reset-page} "Zürucksetzen")
+                               )
+                       (dom/li nil
+                               (dom/form #js {:method "post" :encType "multipart/form-data"}
+                                         (dom/input #js {:type "file" :name "data" :className "file-input" :onChange handle-upload}))
+                               )
+                       )
                (dom/h2 nil "Der Raster")
                (om/build grid-table (:grid app))
-               (dom/h2 nil "Kenny")
+               (dom/h2 nil "Einstellungen")
                (om/build settings-form (:settings app))
                )
       )))

    om/IRender
    (render [this]
      (dom/div #js {:className "status-bar"}
               (dom/span #js {:className "life"} (str "Leben: " (get-in app [:hero :life]) "%"))
               (dom/button #js {:onClick (fn [e] (do
                                                   (om/transact! app [:hero] (fn [_] default-hero))
                                                   (.. js/document (querySelector ".grid") (focus))
                                                   false))
                                }
                           "Neu Starten")
               (dom/button #js {:onClick (fn [e] (do
                                                   (om/transact! app :design-game (fn [bool] (not bool)))
                                                   (.. js/document (querySelector ".grid") (focus))
                                                   false
                                                   )
                                           )}
                           (if (app :design-game)
                             "Züruck"
                             "Entwerfen"))
               )))
  )


    (render-state [this state]
      (apply
       dom/tr nil
       (om/build-all table-cell row {:init-state {:options [[0] [1] [2] [3] [4] [5]]}})))))

(defn grid-table [grid owner]
  (reify
