0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-10 09:08:31 -05:00

🐛 Show onboarding just after logging.

This commit is contained in:
Andrey Antukh 2020-12-10 14:47:25 +01:00 committed by Alonso Torres
parent b80332b9b3
commit 99d3b80033
2 changed files with 10 additions and 12 deletions

View file

@ -16,6 +16,7 @@
[app.main.repo :as rp]
[app.main.store :refer [initial-state]]
[app.main.data.users :as du]
[app.main.data.modal :as modal]
[app.main.data.messages :as dm]
[app.util.router :as rt]
[app.util.i18n :as i18n :refer [tr]]
@ -28,13 +29,17 @@
;; --- Logged In
(defn logged-in
[data]
[profile]
(ptk/reify ::logged-in
ptk/WatchEvent
(watch [this state stream]
(let [team-id (:default-team-id data)]
(rx/of (du/profile-fetched data)
(rt/nav :dashboard-team {:team-id team-id}))))))
(let [team-id (:default-team-id profile)]
(rx/merge
(rx/of (du/profile-fetched profile)
(rt/nav :dashboard-projects {:team-id team-id}))
(when-not (get-in profile [:props :onboarding-viewed])
(->> (rx/of (modal/show {:type :onboarding}))
(rx/delay 1000))))))))
;; --- Login
@ -60,9 +65,7 @@
(->> (rx/timer 100)
(rx/mapcat #(rp/mutation :login params))
(rx/tap on-success)
(rx/catch (fn [err]
(on-error err)
(rx/empty)))
(rx/catch on-error)
(rx/map logged-in))))))
(defn login-from-token

View file

@ -103,11 +103,6 @@
projects (mf/deref projects-ref)
project (get projects project-id)]
(mf/use-effect
(fn []
(when (and profile (not (get-in profile [:props :onboarding-viewed])))
(st/emit! (modal/show {:type :onboarding})))))
(mf/use-effect
(mf/deps team-id)
(st/emitf (dd/fetch-bundle {:id team-id})))