mirror of
https://github.com/penpot/penpot.git
synced 2025-06-11 09:01:41 +02:00
🔥 Remove atom wrapping on several config props
This commit is contained in:
parent
0aefd044dc
commit
10205e51cc
14 changed files with 56 additions and 56 deletions
|
@ -88,11 +88,11 @@
|
|||
(def themes (obj/get global "penpotThemes"))
|
||||
|
||||
(def build-date (parse-build-date global))
|
||||
(def flags (atom (parse-flags global)))
|
||||
(def version (atom (parse-version global)))
|
||||
(def target (atom (parse-target global)))
|
||||
(def browser (atom (parse-browser)))
|
||||
(def platform (atom (parse-platform)))
|
||||
(def flags (parse-flags global))
|
||||
(def version (parse-version global))
|
||||
(def target (parse-target global))
|
||||
(def browser (parse-browser))
|
||||
(def platform (parse-platform))
|
||||
|
||||
(def terms-of-service-uri (obj/get global "penpotTermsOfServiceURI" nil))
|
||||
(def privacy-policy-uri (obj/get global "penpotPrivacyPolicyURI" nil))
|
||||
|
@ -121,11 +121,11 @@
|
|||
|
||||
(defn ^boolean check-browser? [candidate]
|
||||
(dm/assert! (contains? valid-browsers candidate))
|
||||
(= candidate @browser))
|
||||
(= candidate browser))
|
||||
|
||||
(defn ^boolean check-platform? [candidate]
|
||||
(dm/assert! (contains? valid-platforms candidate))
|
||||
(= candidate @platform))
|
||||
(= candidate platform))
|
||||
|
||||
(defn resolve-profile-photo-url
|
||||
[{:keys [photo-id fullname name] :as profile}]
|
||||
|
|
|
@ -36,9 +36,9 @@
|
|||
|
||||
(log/setup! {:app :info})
|
||||
|
||||
(when (= :browser @cf/target)
|
||||
(when (= :browser cf/target)
|
||||
(log/info :message "Welcome to penpot"
|
||||
:version (:full @cf/version)
|
||||
:version (:full cf/version)
|
||||
:asserts *assert*
|
||||
:build-date cf/build-date
|
||||
:public-uri (dm/str cf/public-uri)))
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
[]
|
||||
(let [uagent (UAParser.)]
|
||||
(merge
|
||||
{:app-version (:full @cf/version)
|
||||
{:app-version (:full cf/version)
|
||||
:locale @i18n/locale}
|
||||
(let [browser (.getBrowser uagent)]
|
||||
{:browser (obj/get browser "name")
|
||||
|
@ -230,7 +230,7 @@
|
|||
|
||||
(defn initialize
|
||||
[]
|
||||
(when (contains? @cf/flags :audit-log)
|
||||
(when (contains? cf/flags :audit-log)
|
||||
(ptk/reify ::initialize
|
||||
ptk/EffectEvent
|
||||
(effect [_ _ stream]
|
||||
|
|
|
@ -377,7 +377,7 @@
|
|||
(ptk/reify ::mark-onboarding-as-viewed
|
||||
ptk/WatchEvent
|
||||
(watch [_ _ _]
|
||||
(let [version (or version (:main @cf/version))
|
||||
(let [version (or version (:main cf/version))
|
||||
props {:onboarding-viewed true
|
||||
:release-notes-viewed version}]
|
||||
(->> (rp/cmd! :update-profile-props {:props props})
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
(log/trace :hint "event:initialize" :fn "features")
|
||||
(rx/concat
|
||||
;; Enable all features set on the configuration
|
||||
(->> (rx/from @cf/flags)
|
||||
(->> (rx/from cf/flags)
|
||||
(rx/map name)
|
||||
(rx/map (fn [flag]
|
||||
(when (str/starts-with? flag "frontend-feature-")
|
||||
|
|
|
@ -98,9 +98,9 @@
|
|||
[:& app.main.ui.onboarding/onboarding-modal {}]
|
||||
|
||||
(and (:onboarding-viewed props)
|
||||
(not= (:release-notes-viewed props) (:main @cf/version))
|
||||
(not= "0.0" (:main @cf/version)))
|
||||
[:& app.main.ui.releases/release-notes-modal {:version (:main @cf/version)}]))
|
||||
(not= (:release-notes-viewed props) (:main cf/version))
|
||||
(not= "0.0" (:main cf/version)))
|
||||
[:& app.main.ui.releases/release-notes-modal {:version (:main cf/version)}]))
|
||||
|
||||
[:& dashboard {:route route :profile profile}]]
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
[rumext.v2 :as mf]))
|
||||
|
||||
(def show-alt-login-buttons?
|
||||
(some (partial contains? @cf/flags)
|
||||
(some (partial contains? cf/flags)
|
||||
[:login-with-google
|
||||
:login-with-github
|
||||
:login-with-gitlab
|
||||
|
@ -175,13 +175,13 @@
|
|||
:label (tr "auth.password")}]]
|
||||
|
||||
[:div.buttons-stack
|
||||
(when (or (contains? @cf/flags :login)
|
||||
(contains? @cf/flags :login-with-password))
|
||||
(when (or (contains? cf/flags :login)
|
||||
(contains? cf/flags :login-with-password))
|
||||
[:& fm/submit-button
|
||||
{:label (tr "auth.login-submit")
|
||||
:data-test "login-submit"}])
|
||||
|
||||
(when (contains? @cf/flags :login-with-ldap)
|
||||
(when (contains? cf/flags :login-with-ldap)
|
||||
[:& fm/submit-button
|
||||
{:label (tr "auth.login-with-ldap-submit")
|
||||
:on-click on-submit-ldap}])]]]))
|
||||
|
@ -189,25 +189,25 @@
|
|||
(mf/defc login-buttons
|
||||
[{:keys [params] :as props}]
|
||||
[:div.auth-buttons
|
||||
(when (contains? @cf/flags :login-with-google)
|
||||
(when (contains? cf/flags :login-with-google)
|
||||
[:& bl/button-link {:action #(login-with-oidc % :google params)
|
||||
:icon i/brand-google
|
||||
:name (tr "auth.login-with-google-submit")
|
||||
:klass "btn-google-auth"}])
|
||||
|
||||
(when (contains? @cf/flags :login-with-github)
|
||||
(when (contains? cf/flags :login-with-github)
|
||||
[:& bl/button-link {:action #(login-with-oidc % :github params)
|
||||
:icon i/brand-github
|
||||
:name (tr "auth.login-with-github-submit")
|
||||
:klass "btn-github-auth"}])
|
||||
|
||||
(when (contains? @cf/flags :login-with-gitlab)
|
||||
(when (contains? cf/flags :login-with-gitlab)
|
||||
[:& bl/button-link {:action #(login-with-oidc % :gitlab params)
|
||||
:icon i/brand-gitlab
|
||||
:name (tr "auth.login-with-gitlab-submit")
|
||||
:klass "btn-gitlab-auth"}])
|
||||
|
||||
(when (contains? @cf/flags :login-with-oidc)
|
||||
(when (contains? cf/flags :login-with-oidc)
|
||||
[:& bl/button-link {:action #(login-with-oidc % :oidc params)
|
||||
:icon i/brand-openid
|
||||
:name (tr "auth.login-with-oidc-submit")
|
||||
|
@ -215,7 +215,7 @@
|
|||
|
||||
(mf/defc login-button-oidc
|
||||
[{:keys [params] :as props}]
|
||||
(when (contains? @cf/flags :login-with-oidc)
|
||||
(when (contains? cf/flags :login-with-oidc)
|
||||
[:div.link-entry.link-oidc
|
||||
[:a {:tab-index "0"
|
||||
:on-key-down (fn [event]
|
||||
|
@ -236,17 +236,17 @@
|
|||
|
||||
[:& login-buttons {:params params}]
|
||||
|
||||
(when (or (contains? @cf/flags :login)
|
||||
(contains? @cf/flags :login-with-password)
|
||||
(contains? @cf/flags :login-with-ldap))
|
||||
(when (or (contains? cf/flags :login)
|
||||
(contains? cf/flags :login-with-password)
|
||||
(contains? cf/flags :login-with-ldap))
|
||||
[:span.separator
|
||||
[:span.line]
|
||||
[:span.text (tr "labels.or")]
|
||||
[:span.line]])])
|
||||
|
||||
(when (or (contains? @cf/flags :login)
|
||||
(contains? @cf/flags :login-with-password)
|
||||
(contains? @cf/flags :login-with-ldap))
|
||||
(when (or (contains? cf/flags :login)
|
||||
(contains? cf/flags :login-with-password)
|
||||
(contains? cf/flags :login-with-ldap))
|
||||
[:& login-form {:params params :on-success-callback on-success-callback}])])
|
||||
|
||||
(mf/defc login-page
|
||||
|
@ -258,21 +258,21 @@
|
|||
[:& login-methods {:params params}]
|
||||
|
||||
[:div.links
|
||||
(when (or (contains? @cf/flags :login)
|
||||
(contains? @cf/flags :login-with-password))
|
||||
(when (or (contains? cf/flags :login)
|
||||
(contains? cf/flags :login-with-password))
|
||||
[:div.link-entry
|
||||
[:& lk/link {:action #(st/emit! (rt/nav :auth-recovery-request))
|
||||
:data-test "forgot-password"}
|
||||
(tr "auth.forgot-password")]])
|
||||
|
||||
(when (contains? @cf/flags :registration)
|
||||
(when (contains? cf/flags :registration)
|
||||
[:div.link-entry
|
||||
[:span (tr "auth.register") " "]
|
||||
[:& lk/link {:action #(st/emit! (rt/nav :auth-register {} params))
|
||||
:data-test "register-submit"}
|
||||
(tr "auth.register-submit")]])]
|
||||
|
||||
(when (contains? @cf/flags :demo-users)
|
||||
(when (contains? cf/flags :demo-users)
|
||||
[:div.links.demo
|
||||
[:div.link-entry
|
||||
[:span (tr "auth.create-demo-profile") " "]
|
||||
|
|
|
@ -141,8 +141,8 @@
|
|||
|
||||
[:& login/login-buttons {:params params}]
|
||||
|
||||
(when (or (contains? @cf/flags :login)
|
||||
(contains? @cf/flags :login-with-ldap))
|
||||
(when (or (contains? cf/flags :login)
|
||||
(contains? cf/flags :login-with-ldap))
|
||||
[:span.separator
|
||||
[:span.line]
|
||||
[:span.text (tr "labels.or")]
|
||||
|
@ -157,7 +157,7 @@
|
|||
[:h1 {:data-test "registration-title"} (tr "auth.register-title")]
|
||||
[:div.subtitle (tr "auth.register-subtitle")]
|
||||
|
||||
(when (contains? @cf/flags :demo-warning)
|
||||
(when (contains? cf/flags :demo-warning)
|
||||
[:& demo-warning])
|
||||
|
||||
[:& register-methods {:params params}]
|
||||
|
@ -170,7 +170,7 @@
|
|||
:data-test "login-here-link"}
|
||||
(tr "auth.login-here")]]
|
||||
|
||||
(when (contains? @cf/flags :demo-users)
|
||||
(when (contains? cf/flags :demo-users)
|
||||
[:div.link-entry
|
||||
[:span (tr "auth.create-demo-profile") " "]
|
||||
[:& lk/link {:action #(st/emit! (du/create-demo-profile))}
|
||||
|
@ -207,7 +207,7 @@
|
|||
(s/def ::accept-terms-and-privacy (s/and ::us/boolean true?))
|
||||
(s/def ::accept-newsletter-subscription ::us/boolean)
|
||||
|
||||
(if (contains? @cf/flags :terms-and-privacy-checkbox)
|
||||
(if (contains? cf/flags :terms-and-privacy-checkbox)
|
||||
(s/def ::register-validate-form
|
||||
(s/keys :req-un [::token ::fullname ::accept-terms-and-privacy]
|
||||
:opt-un [::accept-newsletter-subscription]))
|
||||
|
@ -244,7 +244,7 @@
|
|||
:label (tr "auth.fullname")
|
||||
:type "text"}]]
|
||||
|
||||
(when (contains? @cf/flags :terms-and-privacy-checkbox)
|
||||
(when (contains? cf/flags :terms-and-privacy-checkbox)
|
||||
[:div.fields-row.input-visible.accept-terms-and-privacy-wrapper
|
||||
[:& fm/input {:name :accept-terms-and-privacy
|
||||
:class "check-primary"
|
||||
|
|
|
@ -376,7 +376,7 @@
|
|||
:data-test "team-invitations"}
|
||||
(tr "labels.invitations")]
|
||||
|
||||
(when (contains? @cf/flags :webhooks)
|
||||
(when (contains? cf/flags :webhooks)
|
||||
[:& dropdown-menu-item {:on-click go-webhooks
|
||||
:on-key-down (fn [event]
|
||||
(when (kbd/enter? event)
|
||||
|
@ -459,7 +459,7 @@
|
|||
can-rename? (or (get-in team [:permissions :is-owner]) (get-in team [:permissions :is-admin]))
|
||||
options-ids ["teams-options-members"
|
||||
"teams-options-invitations"
|
||||
(when (contains? @cf/flags :webhooks)
|
||||
(when (contains? cf/flags :webhooks)
|
||||
"teams-options-webhooks")
|
||||
"teams-options-settings"
|
||||
(when can-rename?
|
||||
|
@ -680,7 +680,7 @@
|
|||
show-release-notes
|
||||
(mf/use-callback
|
||||
(fn [event]
|
||||
(let [version (:main @cf/version)]
|
||||
(let [version (:main cf/version)]
|
||||
(st/emit! (ptk/event ::ev/event {::ev/name "show-release-notes" :version version}))
|
||||
(if (and (kbd/alt? event) (kbd/mod? event))
|
||||
(st/emit! (modal/show {:type :onboarding}))
|
||||
|
@ -769,7 +769,7 @@
|
|||
(dom/open-new-window "https://penpot.app/terms")))}
|
||||
[:span (tr "auth.terms-of-service")]]
|
||||
|
||||
(when (contains? @cf/flags :user-feedback)
|
||||
(when (contains? cf/flags :user-feedback)
|
||||
[:li.separator {:tab-index (if show
|
||||
"0"
|
||||
"-1")
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
[:div.modal-left.welcome
|
||||
[:img {:src "images/onboarding-welcome.png" :border "0" :alt (tr "onboarding.welcome.alt")}]]
|
||||
[:div.modal-right
|
||||
[:div.release-container [:span.release "Version " (:main @cf/version)]]
|
||||
[:div.release-container [:span.release "Version " (:main cf/version)]]
|
||||
[:div.right-content
|
||||
[:div.modal-title
|
||||
[:h2 {:data-test "onboarding-welcome"} (tr "onboarding-v2.welcome.title")]]
|
||||
|
@ -73,7 +73,7 @@
|
|||
[:div.modal-left.welcome
|
||||
[:img {:src "images/onboarding-people.png" :border "0" :alt (tr "onboarding.welcome.alt")}]]
|
||||
[:div.modal-right
|
||||
[:div.release-container [:span.release "Version " (:main @cf/version)]]
|
||||
[:div.release-container [:span.release "Version " (:main cf/version)]]
|
||||
[:div.right-content
|
||||
[:div.modal-title
|
||||
[:h2 {:data-test "onboarding-welcome"} (tr "onboarding-v2.before-start.title")]]
|
||||
|
@ -112,7 +112,7 @@
|
|||
skip
|
||||
(mf/use-fn
|
||||
#(st/emit! (modal/hide)
|
||||
(if (contains? @cf/flags :newsletter-subscription)
|
||||
(if (contains? cf/flags :newsletter-subscription)
|
||||
(modal/show {:type :onboarding-newsletter-modal})
|
||||
(modal/show {:type :onboarding-team}))
|
||||
(du/mark-onboarding-as-viewed)))]
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
show-release-notes
|
||||
(mf/use-callback
|
||||
(fn [event]
|
||||
(let [version (:main @cf/version)]
|
||||
(let [version (:main cf/version)]
|
||||
(st/emit! (ptk/event ::ev/event {::ev/name "show-release-notes" :version version}))
|
||||
(if (and (kbd/alt? event) (kbd/mod? event))
|
||||
(st/emit! (modal/show {:type :onboarding}))
|
||||
|
@ -91,7 +91,7 @@
|
|||
i/tree
|
||||
[:span.element-title (tr "labels.settings")]]
|
||||
|
||||
(when (contains? @cf/flags :access-tokens)
|
||||
(when (contains? cf/flags :access-tokens)
|
||||
[:li {:class (when access-tokens? "current")
|
||||
:on-click go-settings-access-tokens
|
||||
:data-test "settings-access-tokens"}
|
||||
|
@ -104,7 +104,7 @@
|
|||
i/pencil
|
||||
[:span.element-title (tr "labels.release-notes")]]
|
||||
|
||||
(when (contains? @cf/flags :user-feedback)
|
||||
(when (contains? cf/flags :user-feedback)
|
||||
[:li {:class (when feedback? "current")
|
||||
:on-click go-settings-feedback}
|
||||
i/msg-info
|
||||
|
|
|
@ -158,7 +158,7 @@
|
|||
show-release-notes
|
||||
(mf/use-fn
|
||||
(fn [event]
|
||||
(let [version (:main @cf/version)]
|
||||
(let [version (:main cf/version)]
|
||||
(st/emit! (ptk/event ::ev/event {::ev/name "show-release-notes" :version version}))
|
||||
(if (and (kbd/alt? event) (kbd/mod? event))
|
||||
(st/emit! (modal/show {:type :onboarding}))
|
||||
|
@ -186,7 +186,7 @@
|
|||
[:span (tr "label.shortcuts")]
|
||||
[:span.shortcut (sc/get-tooltip :show-shortcuts)]]
|
||||
|
||||
(when (contains? @cf/flags :user-feedback)
|
||||
(when (contains? cf/flags :user-feedback)
|
||||
[:*
|
||||
[:li.feedback {:on-click nav-to-feedback}
|
||||
[:span (tr "labels.give-feedback")]]])]]))
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
(into {} (map vec) (seq (.entries ^js headers))))
|
||||
|
||||
(def default-headers
|
||||
{"x-frontend-version" (:full @cfg/version)})
|
||||
{"x-frontend-version" (:full cfg/version)})
|
||||
|
||||
(defn fetch
|
||||
[{:keys [method uri query headers body mode omit-default-headers credentials]
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
|
||||
(defmethod handler :configure
|
||||
[{:keys [key val]}]
|
||||
(log/info :hint "configure worker" :key key :val val)
|
||||
(log/info :hint "configure worker" :key key :val (dm/str val))
|
||||
(case key
|
||||
:public-uri
|
||||
(set! cf/public-uri val)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue