0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-14 02:58:39 -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.repo :as rp]
[app.main.store :refer [initial-state]] [app.main.store :refer [initial-state]]
[app.main.data.users :as du] [app.main.data.users :as du]
[app.main.data.modal :as modal]
[app.main.data.messages :as dm] [app.main.data.messages :as dm]
[app.util.router :as rt] [app.util.router :as rt]
[app.util.i18n :as i18n :refer [tr]] [app.util.i18n :as i18n :refer [tr]]
@ -28,13 +29,17 @@
;; --- Logged In ;; --- Logged In
(defn logged-in (defn logged-in
[data] [profile]
(ptk/reify ::logged-in (ptk/reify ::logged-in
ptk/WatchEvent ptk/WatchEvent
(watch [this state stream] (watch [this state stream]
(let [team-id (:default-team-id data)] (let [team-id (:default-team-id profile)]
(rx/of (du/profile-fetched data) (rx/merge
(rt/nav :dashboard-team {:team-id team-id})))))) (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 ;; --- Login
@ -60,9 +65,7 @@
(->> (rx/timer 100) (->> (rx/timer 100)
(rx/mapcat #(rp/mutation :login params)) (rx/mapcat #(rp/mutation :login params))
(rx/tap on-success) (rx/tap on-success)
(rx/catch (fn [err] (rx/catch on-error)
(on-error err)
(rx/empty)))
(rx/map logged-in)))))) (rx/map logged-in))))))
(defn login-from-token (defn login-from-token

View file

@ -103,11 +103,6 @@
projects (mf/deref projects-ref) projects (mf/deref projects-ref)
project (get projects project-id)] 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/use-effect
(mf/deps team-id) (mf/deps team-id)
(st/emitf (dd/fetch-bundle {:id team-id}))) (st/emitf (dd/fetch-bundle {:id team-id})))