<commit_before>(ns tttclj.render
  (:require [quiescent :as q :include-macros true]
            [quiescent.dom :as d]))

(def state {:tiles [:x :o :-
                    :x :- :o
                    :- :x :o]
            :player :x})


(q/defcomponent Turn
  "Renders a component saying whose turn it is"
  [player]
  (d/p {} (str "It is " player "'s turn:")))

(q/defcomponent Cell
  "Renders a cell in the TicTacToe grid"
  [cell]
  (d/div {:className "cell"}
         (if (not (= cell :-))
           (d/div {:className (name cell)}))))

(q/defcomponent Line
  "Renders a line in the TicTacToe grid"
  [cells]
  (apply d/div {:className "line"}
         (map Cell cells)))

(q/defcomponent Grid
  "Renders a TicTacToe Grid"
  [tiles]
  (apply d/div {:className "grid clearfix"}
         (map Line (partition 3 tiles))))

(q/defcomponent Game
  "Renders a TicTacToe game"
  [game]
  (d/div {}
         (Turn (:player game))
         (Grid (:tiles game))))

(q/render (Game state)
          (.getElementById js/document "main"))<commit_msg>Minor refactoring<commit_after>(ns tttclj.render
  (:require [quiescent :as q :include-macros true]
            [quiescent.dom :as d]))

(def state {:tiles [:x :o :-
                    :x :- :o
                    :- :x :o]
            :player :x})


(q/defcomponent Turn
  "Renders a component saying whose turn it is"
  [game]
  (d/p {} (str "It is " player "'s turn:")))

(q/defcomponent Cell
  "Renders a cell in the TicTacToe grid"
  [cell]
  (d/div {:className "cell"}
         (if (not (= cell :-))
           (d/div {:className (name cell)}))))

(q/defcomponent Line
  "Renders a line in the TicTacToe grid"
  [cells]
  (apply d/div {:className "line"}
         (map Cell cells)))

(q/defcomponent Grid
  "Renders a TicTacToe Grid"
  [tiles]
  (apply d/div {:className "grid clearfix"}
         (map Line (partition 3 tiles))))

(q/defcomponent Game
  "Renders a TicTacToe game"
  [game]
  (d/div {}
         (Turn game)
         (Grid (:tiles game))))

(q/render (Game state)
          (.getElementById js/document "main"))
{'fraction_non_alphanumeric': 0.1528447444551591, 'fraction_numerical': 0.0009643201542912247, 'mean_word_length': 2.32, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1643889', 'n_tokens_mistral': 764, 'n_tokens_neox': 726, 'n_words': 227}