0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-22 14:39:45 -05:00

Merge pull request #5000 from penpot/palba-default-light

🎉 Test A/B for starting with light theme
This commit is contained in:
Alejandro 2024-08-19 08:57:10 +02:00 committed by GitHub
commit 0ccae600bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 21 additions and 7 deletions

View file

@ -282,6 +282,7 @@
is-demo (:is-demo params false)
is-muted (:is-muted params false)
is-active (:is-active params false)
theme (:theme params nil)
email (str/lower email)
params {:id id
@ -292,6 +293,7 @@
:password password
:deleted-at (:deleted-at params)
:props props
:theme theme
:is-active is-active
:is-muted is-muted
:is-demo is-demo}]
@ -347,11 +349,13 @@
:extra-data ptoken})))
(defn register-profile
[{:keys [::db/conn] :as cfg} {:keys [token fullname] :as params}]
(let [claims (tokens/verify (::setup/props cfg) {:token token :iss :prepared-register})
[{:keys [::db/conn] :as cfg} {:keys [token fullname theme] :as params}]
(let [theme (when (= theme "light") theme)
claims (tokens/verify (::setup/props cfg) {:token token :iss :prepared-register})
params (-> claims
(into params)
(assoc :fullname fullname))
(assoc :fullname fullname)
(assoc :theme theme))
profile (if-let [profile-id (:profile-id claims)]
(profile/get-profile conn profile-id)
@ -456,7 +460,8 @@
(def schema:register-profile
[:map {:title "register-profile"}
[:token schema:token]
[:fullname [::sm/word-string {:max 100}]]])
[:fullname [::sm/word-string {:max 100}]]
[:theme {:optional true} [:string {:max 10}]]])
(sv/defmethod ::register-profile
{::rpc/auth false

View file

@ -19,6 +19,7 @@
[app.main.data.websocket :as ws]
[app.main.features :as features]
[app.main.repo :as rp]
[app.util.dom :as dom]
[app.util.i18n :as i18n :refer [tr]]
[app.util.router :as rt]
[app.util.storage :refer [storage]]
@ -135,7 +136,8 @@
(swap! storage assoc :profile profile)
(i18n/set-locale! (:lang profile))
(when (not= previous-email email)
(set-current-team! nil)))))))
(set-current-team! nil))
(dom/set-html-theme-color (or (:theme profile) "default")))))))
(defn fetch-profile
[]

View file

@ -49,11 +49,16 @@
(not= section :auth-register-success))
params (:query-params route)
error (:error params)
hide-image-auth? (cf/external-feature-flag "signup-01" "test")]
hide-image-auth? (cf/external-feature-flag "signup-01" "test")
default-light? (cf/external-feature-flag "onboarding-02" "test")]
(mf/with-effect []
(dom/set-html-title (tr "title.default")))
(mf/with-effect [default-light?]
(when default-light?
(dom/set-html-theme-color "light")))
(mf/with-effect [error]
(when error
(st/emit! (du/show-redirect-error error))))

View file

@ -227,6 +227,7 @@
:initial params)
submitted? (mf/use-state false)
theme (when (cf/external-feature-flag "onboarding-02" "test") "light")
on-success
(mf/use-fn
@ -245,7 +246,8 @@
(mf/use-fn
(fn [form _]
(reset! submitted? true)
(let [params (:clean-data @form)]
(let [params (cond-> (:clean-data @form)
(some? theme) (assoc :theme theme))]
(->> (rp/cmd! :register-profile params)
(rx/finalize #(reset! submitted? false))
(rx/subs! on-success on-error)))))]