 (def sort-on-record "SORT-BY-RECORD")
 (def sort-on-values #{sort-on-name sort-on-record})
 
-(def tournament-state-url "tournament.json")
+(def in-dev-mode? (not= -1 (.indexOf js/document.location.href "devmode")))
+
 (def info-page-url "info.md")
+(def tournament-state-url
+  (if in-dev-mode?
+    "tournament.json"
+    "api/latest.php"))
 
 ;; TODO: allow this to be overriden with a query param
-(def refresh-rate-ms 4000)
+(def refresh-rate-ms 5000)
 
 ;;------------------------------------------------------------------------------
 ;; Page State Atom

;;------------------------------------------------------------------------------

(def init-page!
  (once (fn []
          (fetch-tourney-state!)
          (fetch-info-page!)
          ;; trigger an initial render
          (swap! page-state identity))))

(init-page!)

(defn- on-change-page-state
  "Render the page on every state change."
  [_kwd _the-atom _old-state new-state]
  (rum/mount (IndexApp new-state) app-container-el))

(add-watch page-state :main on-change-page-state)

