<commit_before>(ns frontend.components.pages.user-settings.integrations
  (:require [frontend.components.pieces.card :as card]
            [frontend.models.user :as user]
            [om.next :as om-next :refer-macros [defui]])
  (:require-macros [frontend.utils :refer [html]]))

(defui Subpage
  static om-next/IQuery
  (query [this]
    [{:app/current-user [{:user/identities [:identity/type :identity/login]}]}])
  Object
  (render [this]
    (let [{[github-identity] "github"
           [bitbucket-identity] "bitbucket"}
          (group-by :identity/type
                    (-> (om-next/props this) :app/current-user :user/identities))]
      (card/collection
       [(card/titled {:title "GitHub"}
                     (html
                      [:div
                       [:p "Build and deploy your GitHub repositories."]
                       (if github-identity
                         [:p "Connected to " (:identity/login github-identity) "."]
                         [:p "Not connected."])]))
        (card/titled {:title "Bitbucket"}
                     (html
                      [:div
                       [:p "Build and deploy your Bitbucket repositories."]
                       (if bitbucket-identity
                         [:p "Connected to " (:identity/login bitbucket-identity) "."]
                         [:p "Not connected."])]))]))))<commit_msg>Extract integration card to component<commit_after>(ns frontend.components.pages.user-settings.integrations
  (:require [frontend.components.pieces.card :as card]
            [frontend.models.user :as user]
            [frontend.utils.function-query :as fq :include-macros true]
            [om.next :as om-next :refer-macros [defui]])
  (:require-macros [frontend.utils :refer [html]]))

(defn- card
  {::fq/queries {:identity [:identity/login]}}
  [name identity]
  (card/titled {:title name}
               (html
                [:div
                 [:p "Build and deploy your " name " repositories."]
                 (if identity
                   [:p "Connected to " (:identity/login identity) "."]
                   [:p "Not connected."])])))

(defui Subpage
  static om-next/IQuery
  (query [this]
    [{:app/current-user [{:user/identities (fq/merge [:identity/type]
                                                     (fq/get card :identity))}]}])
  Object
  (render [this]
    (let [{[github-identity] "github"
           [bitbucket-identity] "bitbucket"}
          (group-by :identity/type
                    (-> (om-next/props this) :app/current-user :user/identities))]
      (card/collection
       [(card "GitHub" github-identity)
        (card "Bitbucket" bitbucket-identity)]))))
{'fraction_non_alphanumeric': 0.14397321428571427, 'fraction_numerical': 0.0, 'mean_word_length': 1.8364978902953586, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5396210', 'n_tokens_mistral': 793, 'n_tokens_neox': 751, 'n_words': 176}