Allow nitrate onboarding to be handled by admin-console (#10936)

*  Allow nitrate onboarding to be handled by admin-console

* 📎 Code review
This commit is contained in:
María Valderrama 2026-07-31 12:24:30 +02:00 committed by GitHub
parent 94f51afb20
commit 1744d07731
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 18 additions and 16 deletions

View File

@ -54,6 +54,7 @@
[:newsletter-news {:optional true} ::sm/boolean]
[:onboarding-team-id {:optional true} ::sm/uuid]
[:onboarding-viewed {:optional true} ::sm/boolean]
[:nitrate-onboarding-viewed {:optional true} ::sm/boolean]
[:v2-info-shown {:optional true} ::sm/boolean]
[:welcome-file-id {:optional true} [:maybe ::sm/boolean]]
[:release-notes-viewed {:optional true}

View File

@ -21,7 +21,6 @@
[beicon.v2.core :as rx]
[potok.v2.core :as ptk]))
(def ^:private nitrate-entry-active-key ::nitrate-entry-active)
(def ^:private nitrate-entry-pending-popup-key ::nitrate-entry-pending-popup)
(defn account-age-days
[profile]
@ -31,13 +30,8 @@
[]
(binding [storage/*sync* true]
(swap! storage/storage assoc
nitrate-entry-active-key true
nitrate-entry-pending-popup-key true)))
(defn nitrate-entry-active?
[]
(true? (get storage/storage nitrate-entry-active-key)))
(defn nitrate-entry-popup-pending?
[]
(true? (get storage/storage nitrate-entry-pending-popup-key)))
@ -46,7 +40,6 @@
[]
(binding [storage/*sync* true]
(swap! storage/storage dissoc
nitrate-entry-active-key
nitrate-entry-pending-popup-key)))
(defn show-nitrate-popup

View File

@ -157,8 +157,7 @@
props (get profile :props)
section (get data :name)
team (mf/deref refs/team)
nitrate-entry-active? (dnt/nitrate-entry-active?)
nitrate-entry-active? (dnt/nitrate-entry-popup-pending?)
show-question-modal?
(and (contains? cf/flags :onboarding)

View File

@ -264,12 +264,20 @@
(swap! storage/session dissoc :template))))))
(defn- use-nitrate-entry-popup
[]
(mf/with-effect []
(when (dnt/nitrate-entry-popup-pending?)
(dnt/consume-nitrate-entry-popup!)
(st/emit! (dprof/update-profile-props {:onboarding-viewed true})
(dnt/show-nitrate-popup :nitrate-form)))))
[onboarding-viewed? nitrate-onboarding-viewed?]
(let [nitrate-popup-pending? (dnt/nitrate-entry-popup-pending?)]
(mf/with-effect [nitrate-popup-pending? onboarding-viewed? nitrate-onboarding-viewed?]
(when nitrate-popup-pending?
(dnt/consume-nitrate-entry-popup!)
(st/emit! (dprof/update-profile-props
(cond-> {}
(not (or nitrate-onboarding-viewed? onboarding-viewed?))
(assoc :nitrate-onboarding-viewed false)
(not onboarding-viewed?)
(assoc :onboarding-viewed true
:release-notes-viewed (:main cf/version))))
(dnt/show-nitrate-popup :nitrate-form))))))
(defn- use-pending-action
"Consumes a pending dashboard action from session storage and resumes it"
@ -290,6 +298,7 @@
[{:keys [profile project-id team-id search-term plugin-url template section pending-action-id]}]
(let [team (mf/deref refs/team)
projects (mf/deref refs/projects)
props (get profile :props)
project (get projects project-id)
projects (mf/with-memo [projects team-id]
@ -324,7 +333,7 @@
(use-plugin-register plugin-url team-id (:id default-project))
(use-templates-import can-edit? template default-project)
(use-nitrate-entry-popup)
(use-nitrate-entry-popup (:onboarding-viewed props) (:nitrate-onboarding-viewed props))
(use-pending-action pending-action-id)
[:& (mf/provider ctx/current-project-id) {:value project-id}