<commit_before>(ns frontend.components.errors
  (:require [frontend.state :as state]
            [frontend.utils :as utils :include-macros true]
            [frontend.utils.github :as gh-utils]
            [om.core :as om :include-macros true])
  (:require-macros [frontend.utils :refer [html]]))

(defn error-page [app owner]
  (reify
    om/IRender
    (render [_]
      (let [status (get-in app [:navigation-data :status])
            logged-in? (get-in app state/user-path)
            build-page? (get-in app [:navigation-data :build-page?])
            dashboard-page? (get-in app [:navigation-data :dashboard-page?])]
        (html
         [:div.page.error
          [:div.banner
           [:div.container
            [:h1 status]
            [:h3 (str (condp = status
                        401 "Login required"
                        404 "Page not found"
                        500 "Internal server error"
                        "Something unexpected happened"))]]]
          [:div.container
           (condp = status
             401 [:p
                  [:b [:a {:href (gh-utils/auth-url)}
                       "Login here"]]
                  " to view this page"]
             404 (if (and (not logged-in?) (or dashboard-page? build-page?))
                   [:div
                    [:p "We're sorry; either that page doesn't exist or you need to be logged in to view it."]
                    [:p [:b [:a {:href (gh-utils/auth-url)} "Login here"] " to view this page with your GitHub permissions."]]]
                   [:p "We're sorry, but that page doesn't exist."])
             500 [:p "We're sorry, but something broke"]
             "Something completely unexpected happened")]])))))
<commit_msg>add tracking code for mixpanel<commit_after>(ns frontend.components.errors
  (:require [frontend.state :as state]
            [frontend.utils :as utils :include-macros true]
            [frontend.utils.github :as gh-utils]
            [om.core :as om :include-macros true])
  (:require-macros [frontend.utils :refer [html]]))

(defn error-page [app owner]
  (reify
    om/IRender
    (render [_]
      (let [status (get-in app [:navigation-data :status])
            logged-in? (get-in app state/user-path)
            build-page? (get-in app [:navigation-data :build-page?])
            dashboard-page? (get-in app [:navigation-data :dashboard-page?])]
        (html
         [:div.page.error
          [:div.banner
           [:div.container
            [:h1 status]
            [:h3 (str (condp = status
                        401 "Login required"
                        404 "Page not found"
                        500 "Internal server error"
                        "Something unexpected happened"))]]]
          [:div.container
           (condp = status
             401 [:p
                  [:b [:a {:href (gh-utils/auth-url)
             :on-click #(put! controls-ch [:track-external-link-clicked {:event "Auth GitHub"
                                                                         :properties {:source "401"
                                                                                      :url js/window.location.pathname}
                                                                         :path (gh-utils/auth-url)}])}
                       "Login here"]]
                  " to view this page"]
             404 (if (and (not logged-in?) (or dashboard-page? build-page?))
                   [:div
                    [:p "We're sorry; either that page doesn't exist or you need to be logged in to view it."]
                    [:p [:b [:a {:href (gh-utils/auth-url)} "Login here"] " to view this page with your GitHub permissions."]]]
                   [:p "We're sorry, but that page doesn't exist."])
             500 [:p "We're sorry, but something broke"]
             "Something completely unexpected happened")]])))))

{'fraction_non_alphanumeric': 0.12432571281787824, 'fraction_numerical': 0.011045466221423068, 'mean_word_length': 1.4383218534752662, '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': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7635987', 'n_tokens_mistral': 1102, 'n_tokens_neox': 1014, 'n_words': 318}