 ;; -------------------------
 ;; Views
 
-(def db (atom {:players #{{:name "Steven"}
-                          {:name "Davide"}}
-               :matches []}))
+(defn redirect-to [path]
+  (set! js/window.location.href path))
 
 (defonce players (atom nil))
-(def selected-players (atom #{}))
-
-(defn add-new-player [name]
-  (swap! db #(update-in % [:players] conj {:name name})))
 
 (defn parse-json [json]
   (walk/keywordize-keys (t/read (t/reader :json) @players)))

                :placeholder "New player name"}]
       [:button {:on-click (fn []
                             (POST (str "/add-player/" @val))
                             (redirect-to "#/new-game"))} "Save"]])))

(defn current-page []
  [:div [(session/get :current-page)]])

(secretary/defroute "/" []
  (session/put! :current-page #'home-page))

(secretary/defroute "/select-players" []
  (session/put! :current-page #'select-players-page))

(secretary/defroute "/select-game-type" []
  (session/put! :current-page #'select-game-type-page))

(secretary/defroute "/new-player" []
  (session/put! :current-page #'new-player-page))
