🐛 Persist promotional banner collapse (#13040)

This commit is contained in:
Marina López 2026-11-13 13:07:05 +01:00 committed by GitHub
parent 097ff41e03
commit bb4556b705
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 5 deletions

View File

@ -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}]]

View File

@ -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"))}]))