     (log (str "Dispatch of " id " with data " data))
     (match [id data]
            [:file/import [file]]
-           (inc 1))))
+           (inc 1)
+           [:select-page [new-page]]
+           (swap! app-state merge {:selected-page new-page}))))
 
 (defn on-export-click [e competition]
   (log "Export clicked")

;; Components

(defn dp-classes-component []
  [:table.table
   [:thead
    [:tr
     [:th {:with "20"} "#"]
     [:th {:with "200"} "Dansdisciplin"]
     [:th {:with "20"} "Panel"]
     [:th {:with "20"} "Typ"]
     [:th {:with "20"} "Startande"]
     [:th {:with "20"} "Status"]]]
   [:tbody
    (for [class (sort-by :class/position (:competition/classes (:competition @app-state)))]
      ^{:key class}
      [:tr
       [:td (inc (:class/position class))]
       [:td (:class/name class)]
       [:td (:class/adjudicator-panel class)]
       [:td (make-dance-type-presentation (:class/dances class))]
       
       [:td
        (let [results (:result/results (last (:class/results class)))
              started (count (:class/competitors class))
              recalled-count
              (if (empty? results)
                started
                (reduce
                 (fn [x y]
                   (if (contains?
                        #{:r :x}
                        (:competitor/recalled y))
                     (inc x)
                     x))
                 0
                 results))]
          (str recalled-count "/" started))]

       [:td (make-round-presentation (:result/round (last (:class/results class)))
                                     (count (:class/results class)))]])]])

;; TODO - make the on-click event run thoughe dispatch
(defn import-component []

;;   (atom {:competitions []}))

(defonce app-state
  (atom {:selected-page :events ;:classes

         ;; :competition
         ;; {:competition/date #inst "2014-11-22T00:00:00.000-00:00",
