 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; UI utils
-
-(defn make-dance-type-presentation [dances]
-  ;; Dances are presented as a list of the first letters of each dance
-  (clojure.string/join (map #(first (:dance/name %)) dances)))
 
 (defn- to-number [s]
   {:pre [(string? s)]}

;; 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 []

            :event/class-number 1
            :event/number 1
            :event/time "10:00"
            :event/comment "A comment"
            :event/adjudicator-panel 4
            :event/heats 2
            :event/round :normal-x
            :event/status 1
            :event/start-order 0}

          {:event/position 2
            :event/class-number 0
            :event/number 1
            :event/time "10:05"
            :event/comment "A comment"
            :event/adjudicator-panel 4
            :event/heats 2
