<commit_before>(ns braid.core.client.ui.views.header-item
  (:require
    [re-frame.core :refer [subscribe]]
    [spec-tools.data-spec :as ds]))

(def HeaderItem
  {(ds/opt :title) string?
   :priority number?
   (ds/opt :icon) string?
   (ds/opt :on-click) fn?
   (ds/opt :route-fn) fn?
   (ds/opt :route-args) {keyword? any?}
   (ds/opt :body) string?})

(defn header-item-view
  [conf]
  (let [open-group-id (subscribe [:open-group-id])
        current-path (subscribe [:page-path])]
    (fn [{:keys [route-fn route-args title icon body on-click context]}]
      (let [path (when route-fn
                   (route-fn (merge route-args {:group-id @open-group-id})))]
        [:a {:class (when (= path @current-path) "active")
             :href path
             :on-click (if context
                         (on-click context)
                         on-click)
             :title title}
         body
         (when icon<commit_msg>Wrap header-item text in span (for easier styling)<commit_after>(ns braid.core.client.ui.views.header-item
  (:require
    [re-frame.core :refer [subscribe]]
    [spec-tools.data-spec :as ds]))

(def HeaderItem
  {(ds/opt :title) string?
   :priority number?
   (ds/opt :icon) string?
   (ds/opt :on-click) fn?
   (ds/opt :route-fn) fn?
   (ds/opt :route-args) {keyword? any?}
   (ds/opt :body) string?})

(defn header-item-view
  [conf]
  (let [open-group-id (subscribe [:open-group-id])
        current-path (subscribe [:page-path])]
    (fn [{:keys [route-fn route-args title icon body on-click context]}]
      (let [path (when route-fn
                   (route-fn (merge route-args {:group-id @open-group-id})))]
        [:a {:class (when (= path @current-path) "active")
             :href path
             :on-click (if context
                         (on-click context)
                         on-click)
             :title title}
         [:span body]
         (when icon
{'fraction_non_alphanumeric': 0.15704628185127406, 'fraction_numerical': 0.0, 'mean_word_length': 2.073482428115016, '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': '4661942', 'n_tokens_mistral': 653, 'n_tokens_neox': 633, 'n_words': 165}