mirror of
https://github.com/penpot/penpot.git
synced 2025-01-21 06:02:32 -05:00
🐛 Fix menu for create annotation appears on components that already have annotation
This commit is contained in:
parent
9d06a34df4
commit
2648dc3d27
2 changed files with 8 additions and 7 deletions
|
@ -447,7 +447,6 @@
|
|||
|
||||
first-shape (first shapes)
|
||||
{:keys [id component-id component-file main-instance?]} first-shape
|
||||
lacks-annotation? (nil? (:annotation first-shape))
|
||||
component-shapes (filter #(contains? % :component-id) shapes)
|
||||
|
||||
|
||||
|
@ -458,9 +457,11 @@
|
|||
|
||||
workspace-data (deref refs/workspace-data)
|
||||
workspace-libraries (deref refs/workspace-libraries)
|
||||
is-dangling? (nil? (if local-component?
|
||||
(ctkl/get-component workspace-data component-id)
|
||||
(ctf/get-component workspace-libraries component-file component-id)))
|
||||
component (if local-component?
|
||||
(ctkl/get-component workspace-data component-id)
|
||||
(ctf/get-component workspace-libraries component-file component-id))
|
||||
is-dangling? (nil? component)
|
||||
lacks-annotation? (nil? (:annotation component))
|
||||
lib-exists? (and (not local-component?)
|
||||
(some? (get workspace-libraries component-file)))
|
||||
|
||||
|
@ -535,7 +536,7 @@
|
|||
[:*
|
||||
[:& menu-entry {:title (tr "workspace.shape.menu.show-in-assets")
|
||||
:on-click do-show-in-assets}]
|
||||
(when (and components-v2 lacks-annotation?)
|
||||
(when (and components-v2 local-component? lacks-annotation?)
|
||||
[:& menu-entry {:title (tr "workspace.shape.menu.create-annotation")
|
||||
:on-click create-annotation}])]
|
||||
(if local-component?
|
||||
|
|
|
@ -163,7 +163,6 @@
|
|||
(:main-instance? values)
|
||||
true)
|
||||
main-component? (:main-instance? values)
|
||||
lacks-annotation? (nil? (:annotation values))
|
||||
local-component? (= library-id current-file-id)
|
||||
workspace-data (deref refs/workspace-data)
|
||||
workspace-libraries (deref refs/workspace-libraries)
|
||||
|
@ -171,6 +170,7 @@
|
|||
(ctkl/get-component workspace-data component-id)
|
||||
(ctf/get-component workspace-libraries library-id component-id))
|
||||
is-dangling? (nil? component)
|
||||
lacks-annotation? (nil? (:annotation component))
|
||||
lib-exists? (and (not local-component?)
|
||||
(some? (get workspace-libraries library-id)))
|
||||
|
||||
|
@ -237,7 +237,7 @@
|
|||
:options
|
||||
(if main-component?
|
||||
[[(tr "workspace.shape.menu.show-in-assets") do-show-in-assets]
|
||||
(when (and components-v2 lacks-annotation?)
|
||||
(when (and components-v2 local-component? lacks-annotation?)
|
||||
[(tr "workspace.shape.menu.create-annotation") do-create-annotation])]
|
||||
(if local-component?
|
||||
(if is-dangling?
|
||||
|
|
Loading…
Add table
Reference in a new issue