 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; UI utils
 
-(defn- to-number [s]
-  {:pre [(string? s)]}
-  (let [prepared-string (clojure.string/replace s #" " "")]
-    (cond (re-seq #"^[-+]?\d*[\.,]\d*$" prepared-string)
-          (js/parseDouble (clojure.string/replace prepared-string #"," "."))
-          (re-seq #"^[-+]?\d+$" prepared-string)
-          (js/parseInt (clojure.string/replace prepared-string #"\+" ""))
-          :else s)))
-
-(defn number-string? [s]
-  (if s
-    (re-seq #"\d+" s)))
+;; (defn- to-number [s]
+;;   {:pre [(string? s)]}
+;;   (let [prepared-string (clojure.string/replace s #" " "")]
+;;     (cond (re-seq #"^[-+]?\d*[\.,]\d*$" prepared-string)
+;;           (js/parseDouble (clojure.string/replace prepared-string #"," "."))
+;;           (re-seq #"^[-+]?\d+$" prepared-string)
+;;           (js/parseInt (clojure.string/replace prepared-string #"\+" ""))
+;;           :else s)))
 
 (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 make-event-time-presentation [time status]
-  (str time
-       (when (= status 1)
-         "*")))
 
 (def round-map
   {:none ""

        ;; Present how far into the competition this class is.
        ;; The round status is given by the last completed round, if there are none
        ;;  the class is not started
        [:td (make-round-presentation-new (:class/rounds class))
         ]])]]])

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

           (get round-map round-type)))
       "Not Started"))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Components

;; TODO - id is used as entity id and not as presentation, is name enough or should we keep
;; a adj/number or adj/position ?
(defn adjudictors-component []
  [:div
   [:h3 "Domare"]
   [:table.table
    [:thead
     [:tr
      ;[:th {:with "20"} "#"]
      [:th {:with "200"} "Name"]
      [:th {:with "20"} "Country"]]]
    [:tbody
     (for [adjudicator
           (sort-by :adjudicator/name (:competition/adjudicators (:competition @app-state)))]
       ^{:key adjudicator}
       [:tr
        ;[:td (:adjudicator/id adjudicator)]
        [:td (:adjudicator/name adjudicator)]
        [:td (:adjudicator/country adjudicator)]])]]])

(defn adjudictor-panels-component []
  [:div
   [:h3 "Domarpaneler"]
   [:table.table
    [:thead
     [:tr
      [:th {:with "20"} "#"]
      [:th {:with "200"} "Domare"]]]
    [:tbody
     (for [adjudicator-panel (sort-by :adjudicator-panel/name (:competition/panels (:competition @app-state)))]
       ^{:key adjudicator-panel}
       [:tr
        [:td (:adjudicator-panel/name adjudicator-panel)]
        [:td (clojure.string/join
              ", "
              (map :adjudicator/name (:adjudicator-panel/adjudicators adjudicator-panel)))]])]]])

(defn classes-component []
  [:div
   [:h3 "Klasser"]
   [:table.table
    [:thead
     [:tr
