 (ns triboard.view.board
   (:require
     [triboard.logic.board :as board]
-    [triboard.view.interactions :as cb]
+    [triboard.view.interactions :as i]
     [triboard.view.utils :as vutils]))
 
 
 ;; ----------------------------------------------------------------------------
 ;; Private
 ;; ----------------------------------------------------------------------------
-
-;; TODO - Square SVG Board utils
 
 (def relative-size 0.9)
 (def border-size (/ (- 1 relative-size) 2))

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

(defn render-board
  [board suggestions cb]
  (into
    (empty-svg-board)
    (for [[position cell] (board/to-seq board)]
      ^{:key position}
      (if (= :none cell)
        [empty-cell position cb
         (if (and suggestions (suggestions position))       ;; Avoids crash !
           :help :none)]
        [rect-cell position cell])
      )))

     options)])

(defn- empty-cell
  [[x y :as position] interactions player]
  (rect-cell position player
    {:on-click #(i/on-player-move interactions x y)}))

(defn- empty-svg-board []
  [:svg.board
