mirror of
https://github.com/penpot/penpot.git
synced 2025-01-25 07:58:49 -05:00
🎉 Added 'go to main component' to components context menu
This commit is contained in:
parent
60d629a0c6
commit
1d026ab085
3 changed files with 27 additions and 3 deletions
|
@ -718,7 +718,21 @@
|
|||
(fn [component event]
|
||||
(dnd/set-data! event "penpot/component" {:file-id file-id
|
||||
:component component})
|
||||
(dnd/set-allowed-effect! event "move")))]
|
||||
(dnd/set-allowed-effect! event "move")))
|
||||
|
||||
on-show-main
|
||||
(mf/use-fn
|
||||
(mf/deps @state components)
|
||||
(fn [event]
|
||||
(dom/stop-propagation event)
|
||||
(let [component-id (:component-id @state)
|
||||
component (->> components
|
||||
(filter #(= (:id %) component-id))
|
||||
first)
|
||||
main-instance-id (:main-instance-id component)
|
||||
main-instance-page (:main-instance-page component)]
|
||||
(when (and main-instance-id main-instance-page) ;; Only when :components-v2 is enabled
|
||||
(st/emit! (dw/go-to-main-instance main-instance-page main-instance-id))))))]
|
||||
|
||||
[:& asset-section {:file-id file-id
|
||||
:title (tr "workspace.assets.components")
|
||||
|
@ -759,10 +773,14 @@
|
|||
:options [(when-not (or multi-components? multi-assets?)
|
||||
[(tr "workspace.assets.rename") on-rename])
|
||||
(when-not multi-assets?
|
||||
[(tr "workspace.assets.duplicate") on-duplicate])
|
||||
[(if components-v2
|
||||
(tr "workspace.assets.duplicate-main")
|
||||
(tr "workspace.assets.duplicate")) on-duplicate])
|
||||
[(tr "workspace.assets.delete") on-delete]
|
||||
(when-not multi-assets?
|
||||
[(tr "workspace.assets.group") on-group])]}])]]))
|
||||
[(tr "workspace.assets.group") on-group])
|
||||
(when (and components-v2 (not multi-assets?))
|
||||
[(tr "workspace.shape.menu.show-main") on-show-main])]}])]]))
|
||||
|
||||
|
||||
;; ---- Graphics box ----
|
||||
|
|
|
@ -2820,6 +2820,9 @@ msgstr "Delete"
|
|||
msgid "workspace.assets.duplicate"
|
||||
msgstr "Duplicate"
|
||||
|
||||
msgid "workspace.assets.duplicate-main"
|
||||
msgstr "Duplicate main"
|
||||
|
||||
#: src/app/main/ui/workspace/sidebar/assets.cljs, src/app/main/ui/workspace/sidebar/assets.cljs
|
||||
msgid "workspace.assets.edit"
|
||||
msgstr "Edit"
|
||||
|
|
|
@ -2974,6 +2974,9 @@ msgstr "Borrar"
|
|||
msgid "workspace.assets.duplicate"
|
||||
msgstr "Duplicar"
|
||||
|
||||
msgid "workspace.assets.duplicate-main"
|
||||
msgstr "Duplicar principal"
|
||||
|
||||
#: src/app/main/ui/workspace/sidebar/assets.cljs,
|
||||
#: src/app/main/ui/workspace/sidebar/assets.cljs
|
||||
msgid "workspace.assets.edit"
|
||||
|
|
Loading…
Add table
Reference in a new issue