mirror of
https://github.com/penpot/penpot.git
synced 2025-02-02 04:19:08 -05:00
Merge pull request #5000 from penpot/palba-default-light
🎉 Test A/B for starting with light theme
This commit is contained in:
commit
0ccae600bc
4 changed files with 21 additions and 7 deletions
|
@ -282,6 +282,7 @@
|
||||||
is-demo (:is-demo params false)
|
is-demo (:is-demo params false)
|
||||||
is-muted (:is-muted params false)
|
is-muted (:is-muted params false)
|
||||||
is-active (:is-active params false)
|
is-active (:is-active params false)
|
||||||
|
theme (:theme params nil)
|
||||||
email (str/lower email)
|
email (str/lower email)
|
||||||
|
|
||||||
params {:id id
|
params {:id id
|
||||||
|
@ -292,6 +293,7 @@
|
||||||
:password password
|
:password password
|
||||||
:deleted-at (:deleted-at params)
|
:deleted-at (:deleted-at params)
|
||||||
:props props
|
:props props
|
||||||
|
:theme theme
|
||||||
:is-active is-active
|
:is-active is-active
|
||||||
:is-muted is-muted
|
:is-muted is-muted
|
||||||
:is-demo is-demo}]
|
:is-demo is-demo}]
|
||||||
|
@ -347,11 +349,13 @@
|
||||||
:extra-data ptoken})))
|
:extra-data ptoken})))
|
||||||
|
|
||||||
(defn register-profile
|
(defn register-profile
|
||||||
[{:keys [::db/conn] :as cfg} {:keys [token fullname] :as params}]
|
[{:keys [::db/conn] :as cfg} {:keys [token fullname theme] :as params}]
|
||||||
(let [claims (tokens/verify (::setup/props cfg) {:token token :iss :prepared-register})
|
(let [theme (when (= theme "light") theme)
|
||||||
|
claims (tokens/verify (::setup/props cfg) {:token token :iss :prepared-register})
|
||||||
params (-> claims
|
params (-> claims
|
||||||
(into params)
|
(into params)
|
||||||
(assoc :fullname fullname))
|
(assoc :fullname fullname)
|
||||||
|
(assoc :theme theme))
|
||||||
|
|
||||||
profile (if-let [profile-id (:profile-id claims)]
|
profile (if-let [profile-id (:profile-id claims)]
|
||||||
(profile/get-profile conn profile-id)
|
(profile/get-profile conn profile-id)
|
||||||
|
@ -456,7 +460,8 @@
|
||||||
(def schema:register-profile
|
(def schema:register-profile
|
||||||
[:map {:title "register-profile"}
|
[:map {:title "register-profile"}
|
||||||
[:token schema:token]
|
[: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
|
(sv/defmethod ::register-profile
|
||||||
{::rpc/auth false
|
{::rpc/auth false
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
[app.main.data.websocket :as ws]
|
[app.main.data.websocket :as ws]
|
||||||
[app.main.features :as features]
|
[app.main.features :as features]
|
||||||
[app.main.repo :as rp]
|
[app.main.repo :as rp]
|
||||||
|
[app.util.dom :as dom]
|
||||||
[app.util.i18n :as i18n :refer [tr]]
|
[app.util.i18n :as i18n :refer [tr]]
|
||||||
[app.util.router :as rt]
|
[app.util.router :as rt]
|
||||||
[app.util.storage :refer [storage]]
|
[app.util.storage :refer [storage]]
|
||||||
|
@ -135,7 +136,8 @@
|
||||||
(swap! storage assoc :profile profile)
|
(swap! storage assoc :profile profile)
|
||||||
(i18n/set-locale! (:lang profile))
|
(i18n/set-locale! (:lang profile))
|
||||||
(when (not= previous-email email)
|
(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
|
(defn fetch-profile
|
||||||
[]
|
[]
|
||||||
|
|
|
@ -49,11 +49,16 @@
|
||||||
(not= section :auth-register-success))
|
(not= section :auth-register-success))
|
||||||
params (:query-params route)
|
params (:query-params route)
|
||||||
error (:error params)
|
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 []
|
(mf/with-effect []
|
||||||
(dom/set-html-title (tr "title.default")))
|
(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]
|
(mf/with-effect [error]
|
||||||
(when error
|
(when error
|
||||||
(st/emit! (du/show-redirect-error error))))
|
(st/emit! (du/show-redirect-error error))))
|
||||||
|
|
|
@ -227,6 +227,7 @@
|
||||||
:initial params)
|
:initial params)
|
||||||
|
|
||||||
submitted? (mf/use-state false)
|
submitted? (mf/use-state false)
|
||||||
|
theme (when (cf/external-feature-flag "onboarding-02" "test") "light")
|
||||||
|
|
||||||
on-success
|
on-success
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
|
@ -245,7 +246,8 @@
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(fn [form _]
|
(fn [form _]
|
||||||
(reset! submitted? true)
|
(reset! submitted? true)
|
||||||
(let [params (:clean-data @form)]
|
(let [params (cond-> (:clean-data @form)
|
||||||
|
(some? theme) (assoc :theme theme))]
|
||||||
(->> (rp/cmd! :register-profile params)
|
(->> (rp/cmd! :register-profile params)
|
||||||
(rx/finalize #(reset! submitted? false))
|
(rx/finalize #(reset! submitted? false))
|
||||||
(rx/subs! on-success on-error)))))]
|
(rx/subs! on-success on-error)))))]
|
||||||
|
|
Loading…
Add table
Reference in a new issue