             [sablono.core :as html :refer-macros [html]]
             [clojure.string :as string]
             [goog.string :as gstring]
-            [goog.string.format]))
+            [goog.string.format])
+  (:require-macros [cljs.core.async.macros :as am :refer [go go-loop alt!]]))
 
 (defn missing-scopes-notice [current-scopes missing-scopes]
   [:div

        (html
         [:div.repo-filter
          [:i.fa.fa-search]
          [:input.unobtrusive-search.input-large {:placeholder "Filter repos..."
                                                  :type "search"
                                                  :value repo-filter-string
                                                  :onChange #(put! controls-ch [:edit-repo-filter-string (.. % -target -value)])}]])))))

(defn main [data owner opts]
  (reify

      (let [repo (:repo data)
            repo-id (repo-model/id repo)
            controls-ch (:controls-ch data)
            api-ch (:api-ch data)
            settings (:settings data)
            should-build? (repo-model/should-do-first-follower-build? repo)]
        (html
         (cond (repo-model/can-follow? repo)
               [:li.repo-follow {:class (when should-build? "repo-1stfollow")}
                [:div.proj-name
                 [:span {:title (str (vcs-url/project-name (:vcs_url repo))
                                     (when (:fork repo) " (forked)"))}
                  (:name repo)]
                 (when (:fork repo)
                   [:span.forked (str " (" (vcs-url/org-name (:vcs_url repo)) ")")])]
                [:button {:on-click #(do (when should-build?
                                           (start-first-build-after-follow repo-id controls-ch api-ch))
                                         (put! controls-ch [:followed-repo repo-id]))
                          ;; XXX implement data-spinner
                          :data-spinner "true"}
                 [:span "Follow"]]]
