mirror of
https://github.com/penpot/penpot.git
synced 2025-01-10 08:50:57 -05:00
✨ Add audit events for inspect tab usage
On workspace and viewer
This commit is contained in:
parent
f888a6db4c
commit
1cc65c69b7
5 changed files with 29 additions and 19 deletions
|
@ -16,6 +16,7 @@
|
|||
[app.common.types.shape-tree :as ctt]
|
||||
[app.common.types.shape.interactions :as ctsi]
|
||||
[app.main.data.comments :as dcm]
|
||||
[app.main.data.events :as ev]
|
||||
[app.main.data.fonts :as df]
|
||||
[app.main.features :as features]
|
||||
[app.main.repo :as rp]
|
||||
|
@ -546,6 +547,11 @@
|
|||
(defn go-to-section
|
||||
[section]
|
||||
(ptk/reify ::go-to-section
|
||||
ev/Event
|
||||
(-data [_]
|
||||
{::ev/origin "viewer"
|
||||
:section (name section)})
|
||||
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
(assoc state :viewer-overlays []))
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
"Workspace layout management events and helpers."
|
||||
(:require
|
||||
[app.common.data.macros :as dm]
|
||||
[app.main.data.events :as ev]
|
||||
[app.util.storage :refer [storage]]
|
||||
[clojure.set :as set]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
@ -114,8 +115,16 @@
|
|||
|
||||
(defn set-options-mode
|
||||
[mode]
|
||||
(dm/assert! (contains? valid-options-mode mode))
|
||||
(dm/assert!
|
||||
"expected valid options mode"
|
||||
(contains? valid-options-mode mode))
|
||||
|
||||
(ptk/reify ::set-options-mode
|
||||
ev/Event
|
||||
(-data [_]
|
||||
{::ev/origin "workspace:sidebar"
|
||||
:mode (name mode)})
|
||||
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
(assoc-in state [:workspace-global :options-mode] mode))))
|
||||
|
|
|
@ -269,7 +269,8 @@
|
|||
(mf/deps permissions)
|
||||
(fn []
|
||||
(if (:is-logged permissions)
|
||||
(st/emit! dv/close-thumbnails-panel (dv/go-to-section :inspect))
|
||||
(st/emit! dv/close-thumbnails-panel
|
||||
(dv/go-to-section :inspect))
|
||||
(open-login-dialog))))
|
||||
|
||||
navigate
|
||||
|
@ -279,11 +280,11 @@
|
|||
(let [section (-> (dom/get-current-target event)
|
||||
(dom/get-data "value")
|
||||
(keyword))]
|
||||
|
||||
(if (or (= section :interactions) (:is-logged permissions))
|
||||
(st/emit! (dv/go-to-section section))
|
||||
(open-login-dialog)))))]
|
||||
|
||||
|
||||
[:header {:class (stl/css-case :viewer-header true
|
||||
:fullscreen (mf/deref fullscreen-ref))}
|
||||
[:div {:class (stl/css :nav-zone)}
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
[app.main.ui.workspace.sidebar.sitemap :refer [sitemap]]
|
||||
[app.util.debug :as dbg]
|
||||
[app.util.i18n :refer [tr]]
|
||||
[app.util.object :as obj]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
;; --- Left Sidebar (Component)
|
||||
|
@ -157,10 +156,9 @@
|
|||
(set-size (if (> size 276) 276 768))))
|
||||
|
||||
props
|
||||
(-> props
|
||||
(obj/clone)
|
||||
(obj/set! "on-change-section" handle-change-section)
|
||||
(obj/set! "on-expand" handle-expand))]
|
||||
(mf/spread props
|
||||
:on-change-section handle-change-section
|
||||
:on-expand handle-expand)]
|
||||
|
||||
[:& (mf/provider muc/sidebar) {:value :right}
|
||||
[:aside {:class (stl/css-case :right-settings-bar true
|
||||
|
@ -186,7 +184,7 @@
|
|||
[:& comments-sidebar]
|
||||
|
||||
(true? is-history?)
|
||||
[:& history-toolbox]
|
||||
[:> history-toolbox {}]
|
||||
|
||||
:else
|
||||
[:> options-toolbox props])]]]))
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
[app.main.ui.workspace.sidebar.options.shapes.svg-raw :as svg-raw]
|
||||
[app.main.ui.workspace.sidebar.options.shapes.text :as text]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.object :as obj]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
;; --- Options
|
||||
|
@ -75,7 +74,8 @@
|
|||
|
||||
|
||||
(mf/defc options-content
|
||||
{::mf/wrap [mf/memo]}
|
||||
{::mf/memo true
|
||||
::mf/props :obj}
|
||||
[{:keys [selected section shapes shapes-with-children page-id file-id on-change-section on-expand]}]
|
||||
(let [drawing (mf/deref refs/workspace-drawing)
|
||||
objects (mf/deref refs/workspace-page-objects)
|
||||
|
@ -172,14 +172,10 @@
|
|||
;; need on multiple selection in majority of cases
|
||||
|
||||
(mf/defc options-toolbox
|
||||
{::mf/wrap [mf/memo]
|
||||
::mf/wrap-props false}
|
||||
[props]
|
||||
(let [section (obj/get props "section")
|
||||
selected (obj/get props "selected")
|
||||
on-change-section (obj/get props "on-change-section")
|
||||
on-expand (obj/get props "on-expand")
|
||||
page-id (mf/use-ctx ctx/current-page-id)
|
||||
{::mf/memo true
|
||||
::mf/props :obj}
|
||||
[{:keys [section selected on-change-section on-expand]}]
|
||||
(let [page-id (mf/use-ctx ctx/current-page-id)
|
||||
file-id (mf/use-ctx ctx/current-file-id)
|
||||
shapes (mf/deref refs/selected-objects)
|
||||
shapes-with-children (mf/deref refs/selected-shapes-with-children)]
|
||||
|
|
Loading…
Reference in a new issue