-(ns frontend.visualization.build)
+(ns frontend.visualization.build
+  (:require [frontend.models.feature :as feature]))
 
 (defn status->color [status]
-  (cond
-   (= status "success") "#292"
-   (= status "failed") "#c13737"
-   :else "rgb(128,128,128)"))
+  (let [is-v2? (feature/enabled? :ui-v2)
+        is-success? (= status "success")
+        is-failed? (= status "failed")]
+    (cond
+      (and is-v2? is-success?) "#42c88a"
+      (and is-v2? is-failed?) "#ed5c5c"
+      is-success? "#292"
+      is-failed? "#c13737"
+      ; grey for v2
+      is-v2? "#2c2f33"
+      :else "rgb(128,128,128)")))
 
 (defn millis->min-secs [millis]
   (let [total-secs (/ millis 1000.0)

        d0 (js/Date. (:start_time build))
        d1 (js/Date. (:stop_time build))
        scale (-> js/d3 (.-time) (.scale))]
    (.attr svg "width" svg-width)
    (-> scale (.domain #js [d0, d1]) (.range #js [0, (* 0.8 svg-width)]))
    (println "scale maps [" d0 ", " d1 "] -> [" (scale d0) ", " (scale d1) "]")


    (> step-pixels cut-off)))

(defn chart-build [svg scale build]
  (let [bar-height 10
        bar-pad 5
        text-height 16
        step-count (-> build (:steps) (count))
        chart-height (* (-> build (:parallel))
