diff --git a/backend/src/app/rpc/commands/profile.clj b/backend/src/app/rpc/commands/profile.clj index eb2612bad7..e56752b1b8 100644 --- a/backend/src/app/rpc/commands/profile.clj +++ b/backend/src/app/rpc/commands/profile.clj @@ -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} diff --git a/frontend/src/app/main/data/nitrate.cljs b/frontend/src/app/main/data/nitrate.cljs index 780aa51d4e..08114451e3 100644 --- a/frontend/src/app/main/data/nitrate.cljs +++ b/frontend/src/app/main/data/nitrate.cljs @@ -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 diff --git a/frontend/src/app/main/ui.cljs b/frontend/src/app/main/ui.cljs index 0cb9f5b68c..58175de604 100644 --- a/frontend/src/app/main/ui.cljs +++ b/frontend/src/app/main/ui.cljs @@ -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) diff --git a/frontend/src/app/main/ui/dashboard.cljs b/frontend/src/app/main/ui/dashboard.cljs index 9a0d71cb84..20daf964a7 100644 --- a/frontend/src/app/main/ui/dashboard.cljs +++ b/frontend/src/app/main/ui/dashboard.cljs @@ -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}