mirror of
https://github.com/penpot/penpot.git
synced 2025-07-13 23:27:16 +02:00
Merge pull request #6696 from penpot/eva-add-export-metrics
🎉 Add token export event tag
This commit is contained in:
commit
acf0d02c5d
4 changed files with 30 additions and 24 deletions
|
@ -36,6 +36,7 @@
|
|||
|
||||
(defn- hide-popover
|
||||
[node]
|
||||
(dom/unset-css-property! node "block-size")
|
||||
(dom/unset-css-property! node "display")
|
||||
(.hidePopover ^js node))
|
||||
|
||||
|
|
|
@ -9,8 +9,10 @@
|
|||
(:require
|
||||
[app.common.json :as json]
|
||||
[app.common.types.tokens-lib :as ctob]
|
||||
[app.main.data.event :as ev]
|
||||
[app.main.data.modal :as modal]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.components.code-block :refer [code-block]]
|
||||
[app.main.ui.ds.buttons.button :refer [button*]]
|
||||
[app.main.ui.ds.buttons.icon-button :refer [icon-button*]]
|
||||
|
@ -22,6 +24,7 @@
|
|||
[app.util.i18n :refer [tr]]
|
||||
[app.util.webapi :as wapi]
|
||||
[app.util.zip :as zip]
|
||||
[potok.v2.core :as ptk]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
(mf/defc export-tab*
|
||||
|
@ -59,6 +62,7 @@
|
|||
(mf/deps tokens-json)
|
||||
(fn []
|
||||
(when tokens-json
|
||||
(st/emit! (ptk/data-event ::ev/event {::ev/name "export-tokens" :type "single"}))
|
||||
(->> (wapi/create-blob (or tokens-json "{}") "application/json")
|
||||
(dom/trigger-download "tokens.json")))))]
|
||||
[:> export-tab* {:is-disabled is-disabled
|
||||
|
@ -85,6 +89,7 @@
|
|||
(mf/use-fn
|
||||
(mf/deps files)
|
||||
(fn []
|
||||
(st/emit! (ptk/data-event ::ev/event {::ev/name "export-tokens" :type "multiple"}))
|
||||
(download-tokens-zip! files)))]
|
||||
[:> export-tab* {:on-export on-export
|
||||
:is-disabled is-disabled}
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
[app.common.data :as d]
|
||||
[app.common.types.tokens-lib :as ctob]
|
||||
[app.config :as cf]
|
||||
[app.main.data.event :as ev]
|
||||
[app.main.data.modal :as modal]
|
||||
[app.main.data.style-dictionary :as sd]
|
||||
[app.main.data.workspace.tokens.application :as dwta]
|
||||
|
@ -37,7 +36,6 @@
|
|||
[app.util.dom :as dom]
|
||||
[app.util.i18n :refer [tr]]
|
||||
[okulary.core :as l]
|
||||
[potok.v2.core :as ptk]
|
||||
[rumext.v2 :as mf]
|
||||
[shadow.resource]))
|
||||
|
||||
|
@ -384,7 +382,6 @@
|
|||
on-export
|
||||
(mf/use-fn
|
||||
(fn []
|
||||
(st/emit! (ptk/data-event ::ev/event {::ev/name "export-tokens"}))
|
||||
(modal/show! :tokens/export {})))
|
||||
|
||||
on-modal-show
|
||||
|
|
|
@ -47,29 +47,32 @@
|
|||
:class (stl/css-case :check-icon true
|
||||
:check-icon-visible selected?)}]])]))
|
||||
|
||||
(defn- open-tokens-theme-modal
|
||||
[]
|
||||
(modal/show! :tokens/themes {}))
|
||||
|
||||
(mf/defc theme-options
|
||||
[{:keys [active-theme-paths themes on-close]}]
|
||||
(let [on-edit-click #(modal/show! :tokens/themes {})]
|
||||
[:ul {:class (stl/css :theme-options :custom-select-dropdown)
|
||||
:role "listbox"}
|
||||
(for [[group themes] themes]
|
||||
[:li {:key group
|
||||
:aria-labelledby (dm/str group "-label")
|
||||
:role "group"}
|
||||
(when (seq group)
|
||||
[:> text* {:as "span" :typography "headline-small" :class (stl/css :group) :id (dm/str (str/kebab group) "-label") :title group} group])
|
||||
[:& themes-list {:themes themes
|
||||
:active-theme-paths active-theme-paths
|
||||
:on-close on-close
|
||||
:grouped? true}]])
|
||||
[:li {:class (stl/css :separator)
|
||||
:aria-hidden true}]
|
||||
[:li {:class (stl/css-case :checked-element true
|
||||
:checked-element-button true)
|
||||
:role "option"
|
||||
:on-click on-edit-click}
|
||||
[:> text* {:as "span" :typography "body-small"} (tr "workspace.tokens.edit-themes")]
|
||||
[:> icon* {:icon-id i/arrow-right :aria-hidden true}]]]))
|
||||
[:ul {:class (stl/css :theme-options :custom-select-dropdown)
|
||||
:role "listbox"}
|
||||
(for [[group themes] themes]
|
||||
[:li {:key group
|
||||
:aria-labelledby (dm/str group "-label")
|
||||
:role "group"}
|
||||
(when (seq group)
|
||||
[:> text* {:as "span" :typography "headline-small" :class (stl/css :group) :id (dm/str (str/kebab group) "-label") :title group} group])
|
||||
[:& themes-list {:themes themes
|
||||
:active-theme-paths active-theme-paths
|
||||
:on-close on-close
|
||||
:grouped? true}]])
|
||||
[:li {:class (stl/css :separator)
|
||||
:aria-hidden true}]
|
||||
[:li {:class (stl/css-case :checked-element true
|
||||
:checked-element-button true)
|
||||
:role "option"
|
||||
:on-click open-tokens-theme-modal}
|
||||
[:> text* {:as "span" :typography "body-small"} (tr "workspace.tokens.edit-themes")]
|
||||
[:> icon* {:icon-id i/arrow-right :aria-hidden true}]]])
|
||||
|
||||
(mf/defc theme-select
|
||||
[{:keys []}]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue