mirror of
https://github.com/penpot/penpot.git
synced 2025-03-11 07:11:32 -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
|
||||
:webworker))
|
||||
|
||||
(def default-flags
|
||||
[:enable-newsletter-subscription])
|
||||
|
||||
(defn- parse-flags
|
||||
[global]
|
||||
(let [flags (obj/get global "penpotFlags" "")
|
||||
flags (sequence (map keyword) (str/words flags))]
|
||||
(flags/parse flags/default flags)))
|
||||
(flags/parse flags/default default-flags flags)))
|
||||
|
||||
(defn- parse-version
|
||||
[global]
|
||||
|
|
|
@ -135,8 +135,10 @@
|
|||
[:p (tr "onboarding.slide.3.desc1")]
|
||||
[:p (tr "onboarding.slide.3.desc2")]]
|
||||
[:div.modal-navigation
|
||||
[:button.btn-secondary {:on-click skip
|
||||
:data-test "slide-3-btn"} (tr "labels.start")]
|
||||
[:button.btn-secondary
|
||||
{:on-click skip
|
||||
:data-test "slide-3-btn"}
|
||||
(tr "labels.start")]
|
||||
[:& rc/navigation-bullets
|
||||
{:slide slide
|
||||
:navigate navigate
|
||||
|
@ -150,23 +152,23 @@
|
|||
klass (mf/use-state "fadeInDown")
|
||||
|
||||
navigate
|
||||
(mf/use-callback #(reset! slide %))
|
||||
(mf/use-fn #(reset! slide %))
|
||||
|
||||
skip
|
||||
(mf/use-callback
|
||||
(st/emitf (modal/hide)
|
||||
(modal/show {:type :onboarding-newsletter-modal})
|
||||
(du/mark-onboarding-as-viewed)))]
|
||||
(mf/use-fn
|
||||
#(st/emit! (modal/hide)
|
||||
(if (contains? @cf/flags :newsletter-subscription)
|
||||
(modal/show {:type :onboarding-newsletter-modal})
|
||||
(modal/show {:type :onboarding-choice}))
|
||||
(du/mark-onboarding-as-viewed)))]
|
||||
|
||||
(mf/use-layout-effect
|
||||
(mf/deps @slide)
|
||||
(fn []
|
||||
(when (not= :start @slide)
|
||||
(reset! klass "fadeIn"))
|
||||
(let [sem (tm/schedule 300 #(reset! klass nil))]
|
||||
(fn []
|
||||
(reset! klass nil)
|
||||
(tm/dispose! sem)))))
|
||||
(mf/with-effect [@slide]
|
||||
(when (not= :start @slide)
|
||||
(reset! klass "fadeIn"))
|
||||
(let [sem (tm/schedule 300 #(reset! klass nil))]
|
||||
(fn []
|
||||
(reset! klass nil)
|
||||
(tm/dispose! sem))))
|
||||
|
||||
[:div.modal-overlay
|
||||
[:div.animated {:class @klass}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
(ns app.main.ui.settings.profile
|
||||
(:require
|
||||
[app.common.spec :as us]
|
||||
[app.config :as cfg]
|
||||
[app.config :as cf]
|
||||
[app.main.data.messages :as dm]
|
||||
[app.main.data.modal :as modal]
|
||||
[app.main.data.users :as du]
|
||||
|
@ -69,15 +69,16 @@
|
|||
[:a {:on-click #(modal/show! :change-email {})}
|
||||
(tr "dashboard.change-email")]]]]
|
||||
|
||||
[:div.newsletter-subs
|
||||
[:p.newsletter-title (tr "dashboard.newsletter-title")]
|
||||
[:& fm/input {:name :newsletter-subscribed
|
||||
:class "check-primary"
|
||||
:type "checkbox"
|
||||
:label (tr "dashboard.newsletter-msg")}]
|
||||
[:p.info (tr "onboarding.newsletter.privacy1")
|
||||
[:a {:target "_blank" :href "https://penpot.app/privacy.html"} (tr "onboarding.newsletter.policy")]]
|
||||
[:p.info (tr "onboarding.newsletter.privacy2")]]
|
||||
(when (contains? @cf/flags :newsletter-subscription)
|
||||
[:div.newsletter-subs
|
||||
[:p.newsletter-title (tr "dashboard.newsletter-title")]
|
||||
[:& fm/input {:name :newsletter-subscribed
|
||||
:class "check-primary"
|
||||
:type "checkbox"
|
||||
:label (tr "dashboard.newsletter-msg")}]
|
||||
[:p.info (tr "onboarding.newsletter.privacy1")
|
||||
[:a {:target "_blank" :href "https://penpot.app/privacy.html"} (tr "onboarding.newsletter.policy")]]
|
||||
[:p.info (tr "onboarding.newsletter.privacy2")]])
|
||||
|
||||
[:& fm/submit-button
|
||||
{:label (tr "dashboard.save-settings")
|
||||
|
@ -94,7 +95,7 @@
|
|||
(mf/defc profile-photo-form []
|
||||
(let [file-input (mf/use-ref nil)
|
||||
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-file-selected
|
||||
|
|
Loading…
Add table
Reference in a new issue