<commit_before>(ns openslack.views.channels
  (:require [om.core :as om :include-macros true]
            [openslack.routing :refer [navigate room-route]]
            [shodan.console :as console :include-macros true]
            [sablono.core :as s :include-macros true]
            [openslack.views.user :refer [user]]))

(defn channels
  [state owner]
  (reify
    om/IDisplayName
    (display-name [_] "Channels")

    om/IInitState
    (init-state [_]
      (let [channels (:channels state)
            chanlist (sort-by first (seq channels))
            chanlist (map second chanlist)]
        {:channels channels
         :chanlist chanlist}))

    om/IRenderState
    (render-state [_ {:keys [channels chanlist]}]
      (when chanlist
        (s/html
         [:div.room-list.sidebar-list
          [:h3 "Channels"]
          [:ul (for [chan chanlist]
                 (let [name (:local chan)
                       is-current-chan? (and (= (get-in state [:page :state]) :room)
                                             (= (get-in state [:page :room])  name))
                       unread (:unread chan 0)
                       attrs {:on-click #(navigate (room-route {:name name}))
                              :class-name (when is-current-chan? "highlighted")}]
                   (if (> unread 0)
                     [:li.unread attrs name [:i unread] [:i.close-channel "x"]]
                     [:li attrs name [:i unread] [:i.close-channel "x"]])))
           [:li.add
            [:span "+"] "Add new channel\n              "]]])))))
<commit_msg>Prepend hash to room names<commit_after>(ns openslack.views.channels
  (:require [om.core :as om :include-macros true]
            [openslack.routing :refer [navigate room-route]]
            [shodan.console :as console :include-macros true]
            [sablono.core :as s :include-macros true]
            [openslack.views.user :refer [user]]))

(defn channels
  [state owner]
  (reify
    om/IDisplayName
    (display-name [_] "Channels")

    om/IInitState
    (init-state [_]
      (let [channels (:channels state)
            chanlist (sort-by first (seq channels))
            chanlist (map second chanlist)]
        {:channels channels
         :chanlist chanlist}))

    om/IRenderState
    (render-state [_ {:keys [channels chanlist]}]
      (when chanlist
        (s/html
         [:div.room-list.sidebar-list
          [:h3 "Channels"]
          [:ul (for [chan chanlist]
                 (let [name (:local chan)
                       is-current-chan? (and (= (get-in state [:page :state]) :room)
                                             (= (get-in state [:page :room])  name))
                       unread (:unread chan 0)
                       attrs {:on-click #(navigate (room-route {:name name}))
                              :class-name (when is-current-chan? "highlighted")}
                       hashname (str "#" name)]
                   (if (> unread 0)
                     [:li.unread attrs hashname [:i unread] [:i.close-channel "x"]]
                     [:li attrs hashname [:i unread] [:i.close-channel "x"]])))
           [:li.add
            [:span "+"] "Add new channel\n              "]]])))))

{'fraction_non_alphanumeric': 0.13764044943820225, 'fraction_numerical': 0.0018726591760299626, 'mean_word_length': 1.6141924959216967, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4214047', 'n_tokens_mistral': 1001, 'n_tokens_neox': 929, 'n_words': 245}