<commit_before>(ns lout-expo.core
    (:require [reagent.core :as r :refer [atom]]
              [re-frame.core :refer [subscribe dispatch dispatch-sync]]
              [lout-expo.handlers]
              [lout-expo.subs]))

(def ReactNative (js/require "react-native"))

(def app-registry (.-AppRegistry ReactNative))
(def text (r/adapt-react-class (.-Text ReactNative)))
(def view (r/adapt-react-class (.-View ReactNative)))
(def image (r/adapt-react-class (.-Image ReactNative)))
(def touchable-highlight (r/adapt-react-class (.-TouchableHighlight ReactNative)))
(def Alert (.-Alert ReactNative))

(defn alert [title]
  (.alert Alert title))

(defn light-component [val x y]
  ^{:key (str x "," y)}
  [view {:style {:background-color :white :flex 1}}
   [touchable-highlight {:style {:background-color "#999"
                                 :margin 1
                                 :padding 10
                                 :border-radius 5
                                 
                                 :flex 1}
                         :on-press #(dispatch [:toggle-light [x y]])}
    [text {:style {:color :white
                   :flex 1 :text-align :center :text-align-vertical :center :font-weight "bold"}} val]]
   ])

(defn row-component [row-lights y]
  ^{:key y}
  [view {:style {:flex-direction :row :flex 1}}
   (map light-component
        row-lights (iterate inc 0) (repeat y))])

(defn lights-component [lights]
  [view {:style {:flex-direction :column :flex 1 :background-color :white :margin 30}}
   (map row-component lights (iterate inc 0))])
<commit_msg>add icons<commit_after>(ns lout-expo.core
    (:require [reagent.core :as r :refer [atom]]
              [re-frame.core :refer [subscribe dispatch dispatch-sync]]
              [lout-expo.handlers]
              [lout-expo.subs]))

(def ReactNative (js/require "react-native"))

(def app-registry (.-AppRegistry ReactNative))
(def text (r/adapt-react-class (.-Text ReactNative)))
(def view (r/adapt-react-class (.-View ReactNative)))
(def image (r/adapt-react-class (.-Image ReactNative)))
(def touchable-highlight (r/adapt-react-class (.-TouchableHighlight ReactNative)))
(def Alert (.-Alert ReactNative))

(def FontAwesome (js/require "@expo/vector-icons/FontAwesome"))
(def icon (r/adapt-react-class (aget FontAwesome "default")))

(defn alert [title]
  (.alert Alert title))

(defn light-component [val x y]
  ^{:key (str x "," y)}
  [view {:style {:background-color :white :flex 1}}
   [touchable-highlight {:style {:background-color (if (= 1 val) "#aaa" "#555")
                                 :margin 1
                                 :border-radius 3
                                 :flex 1}
                         :on-press #(dispatch [:toggle-light [x y]])}
    [icon {:style {:color (if (= 1 val) :yellow :white)
                   :flex 1 :text-align :center :text-align-vertical :center :font-size 60}
           :name "lightbulb-o"
           }]]
   ])

(defn row-component [row-lights y]
  ^{:key y}
  [view {:style {:flex-direction :row :flex 1}}
   (map light-component
        row-lights (iterate inc 0) (repeat y))])

(defn lights-component [lights]
  [view {:style {:flex-direction :column :flex 1 :background-color :white :margin 30}}
   (map row-component lights (iterate inc 0))])

{'fraction_non_alphanumeric': 0.15382281553398058, 'fraction_numerical': 0.010315533980582525, 'mean_word_length': 2.371165644171779, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6683627', 'n_tokens_mistral': 1085, 'n_tokens_neox': 996, 'n_words': 292}