0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-23 06:58:58 -05:00

Merge pull request #2133 from penpot/superalex-add-audit-log-for-new-onboarding

🎉 Add audit log for new onboarding
This commit is contained in:
Andrey Antukh 2022-08-03 09:05:51 +02:00 committed by GitHub
commit 8fe98b1f7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,6 +9,7 @@
[app.common.data :as d]
[app.common.spec :as us]
[app.main.data.dashboard :as dd]
[app.main.data.events :as ev]
[app.main.data.messages :as dm]
[app.main.data.modal :as modal]
[app.main.refs :as refs]
@ -19,6 +20,7 @@
[app.util.router :as rt]
[app.util.timers :as tm]
[cljs.spec.alpha :as s]
[potok.core :as ptk]
[rumext.alpha :as mf]))
(s/def ::name ::us/not-empty-string)
@ -57,10 +59,17 @@
(mf/use-callback
(fn [form _]
(let [tname (get-in @form [:clean-data :name])]
(st/emit! (modal/show {:type :onboarding-team-invitations :name tname})))))
(st/emit! (modal/show {:type :onboarding-team-invitations :name tname})
(ptk/event ::ev/event {::ev/name "choose-team-name"
::ev/origin "onboarding"
:name tname
:step 1})))))
on-skip
(fn []
(tm/schedule 400 #(st/emit! (modal/hide))))
(tm/schedule 400 #(st/emit! (modal/hide)
(ptk/event ::ev/event {::ev/name "create-team-later"
::ev/origin "onboarding"
:step 1}))))
teams (mf/deref refs/teams)]
(if (< (count teams) 2)
@ -138,7 +147,11 @@
(let [mdata {:on-success (partial on-success form)
:on-error (partial on-error form)}
params {:name name}]
(st/emit! (dd/create-team (with-meta params mdata))))))
(st/emit! (dd/create-team (with-meta params mdata))
(ptk/event ::ev/event {::ev/name "create-team-and-invite-later"
::ev/origin "onboarding"
:name name
:step 2})))))
;; The SUBMIT branch creates the team with the invitations
on-submit
@ -147,7 +160,13 @@
(let [mdata {:on-success (partial on-success form)
:on-error (partial on-error form)}
params (:clean-data @form)]
(st/emit! (dd/create-team-with-invitations (with-meta params mdata))))))]
(st/emit! (dd/create-team-with-invitations (with-meta params mdata))
(ptk/event ::ev/event {::ev/name "create-team-and-send-invitations"
::ev/origin "onboarding"
:invites (count (:emails params))
:role (:role params)
:name name
:step 2})))))]
[:div.modal-overlay
[:div.modal-container.onboarding-team-members
@ -171,7 +190,11 @@
[:div.buttons
[:button.btn-secondary.btn-large
{:on-click #(st/emit! (modal/show {:type :onboarding-team}))}
{:on-click #(st/emit! (modal/show {:type :onboarding-team})
(ptk/event ::ev/event {::ev/name "invite-members-back"
::ev/origin "onboarding"
:name name
:step 2}))}
(tr "labels.back")]
[:& fm/submit-button
{:label (tr "onboarding.choice.team-up.invite-members-submit")}]]