mirror of
https://github.com/penpot/penpot.git
synced 2025-03-12 07:41:43 -05:00
✨ Make the subscription modal configurable
This commit is contained in:
parent
0afb47ade0
commit
1338491616
3 changed files with 34 additions and 28 deletions
|
@ -54,11 +54,14 @@
|
||||||
:browser
|
:browser
|
||||||
:webworker))
|
:webworker))
|
||||||
|
|
||||||
|
(def default-flags
|
||||||
|
[:enable-newsletter-subscription])
|
||||||
|
|
||||||
(defn- parse-flags
|
(defn- parse-flags
|
||||||
[global]
|
[global]
|
||||||
(let [flags (obj/get global "penpotFlags" "")
|
(let [flags (obj/get global "penpotFlags" "")
|
||||||
flags (sequence (map keyword) (str/words flags))]
|
flags (sequence (map keyword) (str/words flags))]
|
||||||
(flags/parse flags/default flags)))
|
(flags/parse flags/default default-flags flags)))
|
||||||
|
|
||||||
(defn- parse-version
|
(defn- parse-version
|
||||||
[global]
|
[global]
|
||||||
|
|
|
@ -135,8 +135,10 @@
|
||||||
[:p (tr "onboarding.slide.3.desc1")]
|
[:p (tr "onboarding.slide.3.desc1")]
|
||||||
[:p (tr "onboarding.slide.3.desc2")]]
|
[:p (tr "onboarding.slide.3.desc2")]]
|
||||||
[:div.modal-navigation
|
[:div.modal-navigation
|
||||||
[:button.btn-secondary {:on-click skip
|
[:button.btn-secondary
|
||||||
:data-test "slide-3-btn"} (tr "labels.start")]
|
{:on-click skip
|
||||||
|
:data-test "slide-3-btn"}
|
||||||
|
(tr "labels.start")]
|
||||||
[:& rc/navigation-bullets
|
[:& rc/navigation-bullets
|
||||||
{:slide slide
|
{:slide slide
|
||||||
:navigate navigate
|
:navigate navigate
|
||||||
|
@ -150,23 +152,23 @@
|
||||||
klass (mf/use-state "fadeInDown")
|
klass (mf/use-state "fadeInDown")
|
||||||
|
|
||||||
navigate
|
navigate
|
||||||
(mf/use-callback #(reset! slide %))
|
(mf/use-fn #(reset! slide %))
|
||||||
|
|
||||||
skip
|
skip
|
||||||
(mf/use-callback
|
(mf/use-fn
|
||||||
(st/emitf (modal/hide)
|
#(st/emit! (modal/hide)
|
||||||
|
(if (contains? @cf/flags :newsletter-subscription)
|
||||||
(modal/show {:type :onboarding-newsletter-modal})
|
(modal/show {:type :onboarding-newsletter-modal})
|
||||||
|
(modal/show {:type :onboarding-choice}))
|
||||||
(du/mark-onboarding-as-viewed)))]
|
(du/mark-onboarding-as-viewed)))]
|
||||||
|
|
||||||
(mf/use-layout-effect
|
(mf/with-effect [@slide]
|
||||||
(mf/deps @slide)
|
|
||||||
(fn []
|
|
||||||
(when (not= :start @slide)
|
(when (not= :start @slide)
|
||||||
(reset! klass "fadeIn"))
|
(reset! klass "fadeIn"))
|
||||||
(let [sem (tm/schedule 300 #(reset! klass nil))]
|
(let [sem (tm/schedule 300 #(reset! klass nil))]
|
||||||
(fn []
|
(fn []
|
||||||
(reset! klass nil)
|
(reset! klass nil)
|
||||||
(tm/dispose! sem)))))
|
(tm/dispose! sem))))
|
||||||
|
|
||||||
[:div.modal-overlay
|
[:div.modal-overlay
|
||||||
[:div.animated {:class @klass}
|
[:div.animated {:class @klass}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
(ns app.main.ui.settings.profile
|
(ns app.main.ui.settings.profile
|
||||||
(:require
|
(:require
|
||||||
[app.common.spec :as us]
|
[app.common.spec :as us]
|
||||||
[app.config :as cfg]
|
[app.config :as cf]
|
||||||
[app.main.data.messages :as dm]
|
[app.main.data.messages :as dm]
|
||||||
[app.main.data.modal :as modal]
|
[app.main.data.modal :as modal]
|
||||||
[app.main.data.users :as du]
|
[app.main.data.users :as du]
|
||||||
|
@ -69,6 +69,7 @@
|
||||||
[:a {:on-click #(modal/show! :change-email {})}
|
[:a {:on-click #(modal/show! :change-email {})}
|
||||||
(tr "dashboard.change-email")]]]]
|
(tr "dashboard.change-email")]]]]
|
||||||
|
|
||||||
|
(when (contains? @cf/flags :newsletter-subscription)
|
||||||
[:div.newsletter-subs
|
[:div.newsletter-subs
|
||||||
[:p.newsletter-title (tr "dashboard.newsletter-title")]
|
[:p.newsletter-title (tr "dashboard.newsletter-title")]
|
||||||
[:& fm/input {:name :newsletter-subscribed
|
[:& fm/input {:name :newsletter-subscribed
|
||||||
|
@ -77,7 +78,7 @@
|
||||||
:label (tr "dashboard.newsletter-msg")}]
|
:label (tr "dashboard.newsletter-msg")}]
|
||||||
[:p.info (tr "onboarding.newsletter.privacy1")
|
[:p.info (tr "onboarding.newsletter.privacy1")
|
||||||
[:a {:target "_blank" :href "https://penpot.app/privacy.html"} (tr "onboarding.newsletter.policy")]]
|
[:a {:target "_blank" :href "https://penpot.app/privacy.html"} (tr "onboarding.newsletter.policy")]]
|
||||||
[:p.info (tr "onboarding.newsletter.privacy2")]]
|
[:p.info (tr "onboarding.newsletter.privacy2")]])
|
||||||
|
|
||||||
[:& fm/submit-button
|
[:& fm/submit-button
|
||||||
{:label (tr "dashboard.save-settings")
|
{:label (tr "dashboard.save-settings")
|
||||||
|
@ -94,7 +95,7 @@
|
||||||
(mf/defc profile-photo-form []
|
(mf/defc profile-photo-form []
|
||||||
(let [file-input (mf/use-ref nil)
|
(let [file-input (mf/use-ref nil)
|
||||||
profile (mf/deref refs/profile)
|
profile (mf/deref refs/profile)
|
||||||
photo (cfg/resolve-profile-photo-url profile)
|
photo (cf/resolve-profile-photo-url profile)
|
||||||
on-image-click #(dom/click (mf/ref-val file-input))
|
on-image-click #(dom/click (mf/ref-val file-input))
|
||||||
|
|
||||||
on-file-selected
|
on-file-selected
|
||||||
|
|
Loading…
Add table
Reference in a new issue