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