 (ns unspun.screens.number-needed
-  (:require [cljs-exponent.components :refer [element text view image touchable-highlight status-bar] :as rn]
+  (:require [cljs-exponent.components :refer [element text view image touchable-highlight status-bar scroll-view] :as rn]
             [themes.palettes :refer [get-palette]]
             [shared.ui :refer [n-icon]]
             [unspun.db :refer [app-state palette-index to-pc number-needed stories story-index story-icon text-generator nn1 nn2]]

                (view {:key   r
                       :style {:flex           1
                               :flexDirection  "row"
                               :alignItems     "flex-start"
                               :justifyContent "flex-start"
                               :maxHeight      32
                               }}
                      (for [c (range 5)
                            :let [k (+ c (* r 5))]
                            ]
                        (view {:key   c
                               :style {:flex           1
                                       :maxWidth       32
                                       :alignItems     "center"
                                       :justifyContent "center"
                                       }}
                              (if (< k count)
                                (if (and (zero? k) (zero? block))
                                  (draw-icon scenar (:text-icons palette) 1)
                                  (draw-icon scenar (:light-primary palette) 0.66))
                                (view {:style {:width 30}}))

                              )))))]

(defn draw-icon [scenar color scale]
  (n-icon {:name  (story-icon scenar)
           :style {:color     color
                   :backgroundColor "rgba(0,0,0,0)"
                   :transform [{:scale scale}]}}))

(defn icon-square-size [nn]
  (Math.ceil (Math.sqrt nn)))

(defn col-blocks [nn]
  (min 3 (* (quot (icon-square-size nn) 5))))

(defn cols-rows-blocked [nn]
  (let [cols (* 5 (col-blocks nn))
