mirror of
https://github.com/penpot/penpot.git
synced 2026-11-16 15:11:17 +00:00
🐛 Persist promotional banner collapse (#13040)
This commit is contained in:
parent
097ff41e03
commit
bb4556b705
@ -70,6 +70,7 @@
|
||||
[:onboarding-questions {:optional true} [:map-of :keyword :string]]
|
||||
[:onboarding-questions-answered {:optional true} ::sm/boolean]
|
||||
[:nitrate-onboarding-viewed {:optional true} ::sm/boolean]
|
||||
[:promotional-banner-collapsed {:optional true} ::sm/boolean]
|
||||
[:v2-info-shown {:optional true} ::sm/boolean]
|
||||
[:release-notes-viewed {:optional true}
|
||||
[::sm/text {:max 100}]]
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
[app.main.data.event :as ev]
|
||||
[app.main.data.modal :as modal]
|
||||
[app.main.data.nitrate :as dnt]
|
||||
[app.main.data.profile :as dprof]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.router :as rt]
|
||||
[app.main.store :as st]
|
||||
@ -131,11 +132,13 @@
|
||||
:is-highlighted false}]))))
|
||||
|
||||
(mf/defc nitrate-enterprise-banner*
|
||||
[{:keys [on-click button-label]}]
|
||||
(let [collapsed* (mf/use-state false)
|
||||
collapsed? (deref collapsed*)
|
||||
[{:keys [on-click button-label profile]}]
|
||||
(let [collapsed? (true? (get-in profile [:props :promotional-banner-collapsed]))
|
||||
toggle-collapse
|
||||
(mf/use-fn #(swap! collapsed* not))]
|
||||
(mf/use-fn
|
||||
(mf/deps collapsed?)
|
||||
#(st/emit! (dprof/update-profile-props
|
||||
{:promotional-banner-collapsed (not collapsed?)})))]
|
||||
|
||||
[:div {:class (stl/css-case :nitrate-banner true
|
||||
:nitrate-enterprise-banner true
|
||||
@ -269,7 +272,8 @@
|
||||
;; Banner for Professional/Unlimited users outside an organization
|
||||
(when show-unlock-features?
|
||||
[:> nitrate-enterprise-banner*
|
||||
{:on-click handle-click
|
||||
{:profile profile
|
||||
:on-click handle-click
|
||||
:button-label (if (:subscription profile)
|
||||
(tr "subscription.dashboard.banner.upgrade-nitrate")
|
||||
(tr "nitrate.form.try-free"))}]))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user