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