Merge pull request #2386 from penpot/palba-newsletter-subscription-st

 Newsletter suscription
This commit is contained in:
Andrey Antukh 2022-10-04 14:00:22 +02:00 committed by GitHub
commit 50af997f55
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 35 deletions

View file

@ -32,7 +32,7 @@
(fn []
(st/emit! (dm/success message)
(modal/show {:type :onboarding-team})
(du/update-profile-props {:newsletter-updates true :newsletter-news true}))))]
(du/update-profile-props {:newsletter-updates @newsletter-updates :newsletter-news @newsletter-news}))))]
[:div.modal-overlay
[:div.modal-container.onboarding.newsletter.animated.fadeInDown

View file

@ -42,13 +42,7 @@
(mf/defc profile-form
[]
(let [profile (mf/deref refs/profile)
initial (mf/with-memo [profile]
(let [subscribed? (-> profile
:props
:newsletter-subscribed
boolean)]
(assoc profile :newsletter-subscribed subscribed?)))
form (fm/use-form :spec ::profile-form :initial initial)]
form (fm/use-form :spec ::profile-form :initial profile)]
[:& fm/form {:on-submit on-submit
:form form
@ -72,17 +66,6 @@
[:a {:on-click #(modal/show! :change-email {})}
(tr "dashboard.change-email")]]]]
(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")
:disabled (empty? (:touched @form))}]