<commit_before>(ns frontend.components.overlay
  (:require [clojure.set :as set]
            [clojure.string :as str]
            [datascript :as d]
            [frontend.analytics :as analytics]
            [frontend.async :refer [put!]]
            [frontend.auth :as auth]
            [frontend.components.common :as common]
            [frontend.components.doc-viewer :as doc-viewer]
            [frontend.datascript :as ds]
            [frontend.state :as state]
            [frontend.utils :as utils :include-macros true]
            [om.core :as om :include-macros true]
            [om.dom :as dom :include-macros true])
  (:require-macros [frontend.utils :refer [html]])
  (:import [goog.ui IdGenerator]))

(defn info [app owner]
  (reify
    om/IRender
    (render [_]
      (let [cast! (om/get-shared owner :cast!)]
        (html
          [:div.menu-prompt {:class (str "menu-prompt-" "info")}
           [:div.menu-header
            [:a.menu-close {:on-click #(cast! :overlay-closed)
                            :role "button"}
             (common/icon :times)]]
           [:div.menu-prompt-body
            [:h2 "What is Precursor?"]
            [:p
             "No-nonsense prototyping—"
             "perfect for wireframing, sketching, and brainstorming. "
             [:a {:on-click #(cast! :invite-link-clicked)
                  :role "button"
                  :title "In chat, type \"/invite <EMAIL>\""}
              "Invite"]
             " your team and collaborate with them instantly. "
             " We just got started, so if you have feedback say "
             [:a {:href "mailto:<EMAIL>?Subject=I%20have%20feedback"
                  :title "We love feedback, good or bad."}
              "<EMAIL>"]
             " or on "
             [:a {:href "https://twitter.com/prcrsr_app"
                  :on-click #(analytics/track "Twitter link clicked" {:location "info overlay"})
                  :title "On Twitter"
                  :target "_blank"}
              "Twitter"]
             "."]
            [:a.prompt-button {:on-click #(cast! :overlay-info-toggled)
                               :role "button"}
             "Okay"]]
           [:div.menu-footer
            (common/mixpanel-badge)]])))))

;; (defn shortcuts [app owner]
;;   (reify
;;     om/IRender
;;     (render [_]
;;       (let [cast! (om/get-shared owner :cast!)]
;;         (html
;;           [:div.menu-view {:class (str "menu-view-" "shortcuts")}
;;            [:div.menu-view-frame
;;             [:div.shortcuts-item
;;              [:div.shortcuts-key "S"]
;;              [:div.shortcuts-result "Select"]]
;;             [:div.shortcuts-item
;;              [:div.shortcuts-key "R"]
;;              [:div.shortcuts-result "Rectangle"]]
;;             [:div.shortcuts-item
;;              [:div.shortcuts-key "C"]
;;              [:div.shortcuts-result "Circle"]]
;;             [:div.shortcuts-item
;;              [:div.shortcuts-key "L"]
;;              [:div.shortcuts-result "Line"]]
;;             [:div.shortcuts-item
;;              [:div.shortcuts-key "P"]
;;              [:div.shortcuts-result "Pen"]]
;;             [:div.shortcuts-item
;;              [:div.shortcuts-key "T"]
;;              [:div.shortcuts-result "Text"]]
;;             [:div.shortcuts-item
;;              [:div.shortcuts-key "1"]
;;              [:div.shortcuts-result "Snap to origin"]]
;;             [:div.shortcuts-item
;;              [:div.shortcuts-key "Cmd"]
;;              [:div.shortcuts-key "Z"]
;;             [:div.shortcuts-result "Undo"]]]])))))

(defn shortcuts [app owner]
  (reify
    om/IRender
    (render [_]
      (let [cast! (om/get-shared owner :cast!)]
        (html
          [:div.menu-prompt {:class (str "menu-prompt-" "shortcuts")}
           [:div.menu-header
            [:a.menu-close {:on-click #(cast! :overlay-closed)
                            :role "button"}
             (common/icon :times)]]
           [:div.menu-prompt-body
            [:h2 "Shortcuts"]
            [:div.shortcuts-item
             [:div.shortcuts-key "S"]
             [:div.shortcuts-result "Select"]]
            [:div.shortcuts-item
             [:div.shortcuts-key "R"]
             [:div.shortcuts-result "Rectangle"]]
            [:div.shortcuts-item
             [:div.shortcuts-key "C"]
             [:div.shortcuts-result "Circle"]]
            [:div.shortcuts-item
             [:div.shortcuts-key "L"]
             [:div.shortcuts-result "Line"]]
            [:div.shortcuts-item
             [:div.shortcuts-key "P"]
             [:div.shortcuts-result "Pen"]]
            [:div.shortcuts-item
             [:div.shortcuts-key "T"]
             [:div.shortcuts-result "Text"]]
            [:div.shortcuts-item
             [:div.shortcuts-key "1"]
             [:div.shortcuts-result "Snap to origin"]]
            [:div.shortcuts-item
             [:div.shortcuts-key "Cmd"]
             [:div.shortcuts-key "Z"]
            [:div.shortcuts-result "Undo"]]]])))))

(defn username [app owner]
  (reify
    om/IRender
    (render [_]
      (let [cast! (om/get-shared owner :cast!)]
        (html
         [:div.menu-prompt {:class (str "menu-prompt-" "username")}
          [:div.menu-header
           [:a.menu-close {:on-click #(cast! :overlay-closed)
                           :role "button"}
            (common/icon :times)]]
          [:div.menu-prompt-body
           [:h2 "Let's change that name."]
           [:p
            "Help your team communicate faster with each other by using custom names. "
            "Log in or sign up to change how your name appears in chat."]
           [:a.prompt-button {:href (auth/auth-url)
                              :role "button"}
            "Sign Up"]]
          [:div.menu-footer
           [:a.menu-footer-link {:href "#"}
            "No thanks."]]])))))

(def overlay-components
  {:info {:component info
          :menu-type :prompt}
   ;; :shortcuts {:component shortcuts
   ;;             :menu-type :view}
   :shortcuts {:component shortcuts
               :menu-type :prompt}
   :username {:component username
              :menu-type :prompt}
   :doc-viewer {:component doc-viewer/doc-viewer
                :menu-type :prompt}})<commit_msg>track signups on the username overlay<commit_after>(ns frontend.components.overlay
  (:require [clojure.set :as set]
            [clojure.string :as str]
            [datascript :as d]
            [frontend.analytics :as analytics]
            [frontend.async :refer [put!]]
            [frontend.auth :as auth]
            [frontend.components.common :as common]
            [frontend.components.doc-viewer :as doc-viewer]
            [frontend.datascript :as ds]
            [frontend.state :as state]
            [frontend.utils :as utils :include-macros true]
            [om.core :as om :include-macros true]
            [om.dom :as dom :include-macros true])
  (:require-macros [frontend.utils :refer [html]])
  (:import [goog.ui IdGenerator]))

(defn info [app owner]
  (reify
    om/IRender
    (render [_]
      (let [cast! (om/get-shared owner :cast!)]
        (html
          [:div.menu-prompt {:class (str "menu-prompt-" "info")}
           [:div.menu-header
            [:a.menu-close {:on-click #(cast! :overlay-closed)
                            :role "button"}
             (common/icon :times)]]
           [:div.menu-prompt-body
            [:h2 "What is Precursor?"]
            [:p
             "No-nonsense prototyping—"
             "perfect for wireframing, sketching, and brainstorming. "
             [:a {:on-click #(cast! :invite-link-clicked)
                  :role "button"
                  :title "In chat, type \"/invite <EMAIL>\""}
              "Invite"]
             " your team and collaborate with them instantly. "
             " We just got started, so if you have feedback say "
             [:a {:href "mailto:<EMAIL>?Subject=I%20have%20feedback"
                  :title "We love feedback, good or bad."}
              "<EMAIL>"]
             " or on "
             [:a {:href "https://twitter.com/prcrsr_app"
                  :on-click #(analytics/track "Twitter link clicked" {:location "info overlay"})
                  :title "On Twitter"
                  :target "_blank"}
              "Twitter"]
             "."]
            [:a.prompt-button {:on-click #(cast! :overlay-info-toggled)
                               :role "button"}
             "Okay"]]
           [:div.menu-footer
            (common/mixpanel-badge)]])))))

;; (defn shortcuts [app owner]
;;   (reify
;;     om/IRender
;;     (render [_]
;;       (let [cast! (om/get-shared owner :cast!)]
;;         (html
;;           [:div.menu-view {:class (str "menu-view-" "shortcuts")}
;;            [:div.menu-view-frame
;;             [:div.shortcuts-item
;;              [:div.shortcuts-key "S"]
;;              [:div.shortcuts-result "Select"]]
;;             [:div.shortcuts-item
;;              [:div.shortcuts-key "R"]
;;              [:div.shortcuts-result "Rectangle"]]
;;             [:div.shortcuts-item
;;              [:div.shortcuts-key "C"]
;;              [:div.shortcuts-result "Circle"]]
;;             [:div.shortcuts-item
;;              [:div.shortcuts-key "L"]
;;              [:div.shortcuts-result "Line"]]
;;             [:div.shortcuts-item
;;              [:div.shortcuts-key "P"]
;;              [:div.shortcuts-result "Pen"]]
;;             [:div.shortcuts-item
;;              [:div.shortcuts-key "T"]
;;              [:div.shortcuts-result "Text"]]
;;             [:div.shortcuts-item
;;              [:div.shortcuts-key "1"]
;;              [:div.shortcuts-result "Snap to origin"]]
;;             [:div.shortcuts-item
;;              [:div.shortcuts-key "Cmd"]
;;              [:div.shortcuts-key "Z"]
;;             [:div.shortcuts-result "Undo"]]]])))))

(defn shortcuts [app owner]
  (reify
    om/IRender
    (render [_]
      (let [cast! (om/get-shared owner :cast!)]
        (html
          [:div.menu-prompt {:class (str "menu-prompt-" "shortcuts")}
           [:div.menu-header
            [:a.menu-close {:on-click #(cast! :overlay-closed)
                            :role "button"}
             (common/icon :times)]]
           [:div.menu-prompt-body
            [:h2 "Shortcuts"]
            [:div.shortcuts-item
             [:div.shortcuts-key "S"]
             [:div.shortcuts-result "Select"]]
            [:div.shortcuts-item
             [:div.shortcuts-key "R"]
             [:div.shortcuts-result "Rectangle"]]
            [:div.shortcuts-item
             [:div.shortcuts-key "C"]
             [:div.shortcuts-result "Circle"]]
            [:div.shortcuts-item
             [:div.shortcuts-key "L"]
             [:div.shortcuts-result "Line"]]
            [:div.shortcuts-item
             [:div.shortcuts-key "P"]
             [:div.shortcuts-result "Pen"]]
            [:div.shortcuts-item
             [:div.shortcuts-key "T"]
             [:div.shortcuts-result "Text"]]
            [:div.shortcuts-item
             [:div.shortcuts-key "1"]
             [:div.shortcuts-result "Snap to origin"]]
            [:div.shortcuts-item
             [:div.shortcuts-key "Cmd"]
             [:div.shortcuts-key "Z"]
            [:div.shortcuts-result "Undo"]]]])))))

(defn username [app owner]
  (reify
    om/IRender
    (render [_]
      (let [cast! (om/get-shared owner :cast!)]
        (html
         [:div.menu-prompt {:class (str "menu-prompt-" "username")}
          [:div.menu-header
           [:a.menu-close {:on-click #(cast! :overlay-closed)
                           :role "button"}
            (common/icon :times)]]
          [:div.menu-prompt-body
           [:h2 "Let's change that name."]
           [:p
            "Help your team communicate faster with each other by using custom names. "
            "Log in or sign up to change how your name appears in chat."]
           [:a.prompt-button {:href (auth/auth-url)
                              :on-click #(do
                                           (.preventDefault %)
                                           (cast! :track-external-link-clicked
                                                  {:path (auth/auth-url)
                                                   :event "Signup Clicked"
                                                   :properties {:source "username-overlay"}}))
                              :role "button"}
            "Sign Up"]]
          [:div.menu-footer
           [:a.menu-footer-link {:href "#"}
            "No thanks."]]])))))

(def overlay-components
  {:info {:component info
          :menu-type :prompt}
   ;; :shortcuts {:component shortcuts
   ;;             :menu-type :view}
   :shortcuts {:component shortcuts
               :menu-type :prompt}
   :username {:component username
              :menu-type :prompt}
   :doc-viewer {:component doc-viewer/doc-viewer
                :menu-type :prompt}})
{'fraction_non_alphanumeric': 0.15609038848475468, 'fraction_numerical': 0.0013929732239591395, 'mean_word_length': 1.5034870205346764, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1677978', 'n_tokens_mistral': 4138, 'n_tokens_neox': 3745, 'n_words': 817}