diff --git a/frontend/src/app/main/ui/workspace/tokens/sidebar.cljs b/frontend/src/app/main/ui/workspace/tokens/sidebar.cljs index 3f9b5a2071..f884bbe968 100644 --- a/frontend/src/app/main/ui/workspace/tokens/sidebar.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/sidebar.cljs @@ -133,13 +133,11 @@ [:& cmm/asset-section-block {:role :content} [:div {:class (stl/css :token-pills-wrapper)} (for [token (sort-by :name tokens)] - (let [theme-token (get active-theme-tokens (wtt/token-identifier token)) + (let [theme-token (get active-theme-tokens (:name token)) multiple-selection (< 1 (count selected-shapes)) full-applied (:all-selected? (attribute-actions token selected-shapes (or all-attributes attributes))) - applied (wtt/shapes-token-applied? token selected-shapes (or all-attributes attributes)) - on-token-click (fn [e] - (on-token-pill-click e token)) - on-context-menu (fn [e] (on-context-menu e token))] + applied (wtt/shapes-token-applied? token selected-shapes (or all-attributes attributes))] + [:> token-pill* {:key (:name token) :token-type-props token-type-props @@ -151,7 +149,7 @@ :full-applied (if multiple-selection false applied) - :on-click on-token-click + :on-click on-token-pill-click :on-context-menu on-context-menu}]))]])]])) (defn sorted-token-groups diff --git a/frontend/src/app/main/ui/workspace/tokens/token.cljs b/frontend/src/app/main/ui/workspace/tokens/token.cljs index dff5ebb107..441310006c 100644 --- a/frontend/src/app/main/ui/workspace/tokens/token.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/token.cljs @@ -21,7 +21,9 @@ {:value parsed-value :unit unit})))) -(defn token-identifier [{:keys [name] :as _token}] +;; FIXME: looks very redundant function +(defn token-identifier + [{:keys [name] :as _token}] name) (defn attributes-map diff --git a/frontend/src/app/main/ui/workspace/tokens/token_pill.cljs b/frontend/src/app/main/ui/workspace/tokens/token_pill.cljs index d84baba50d..24553bdfe5 100644 --- a/frontend/src/app/main/ui/workspace/tokens/token_pill.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/token_pill.cljs @@ -142,7 +142,6 @@ (contains? active-tokens match))) (mf/defc token-pill* - {::mf/wrap-props false} [{:keys [on-click token full-applied on-context-menu half-applied selected-shapes token-type-props active-theme-tokens]}] (let [{:keys [name value errors]} token @@ -167,11 +166,11 @@ on-click (mf/use-fn - (mf/deps errors? on-click) + (mf/deps errors? on-click token) (fn [event] (dom/stop-propagation event) (when (and (not (seq errors)) on-click) - (on-click event)))) + (on-click event token)))) token-status-id (cond @@ -184,11 +183,11 @@ on-context-menu (mf/use-fn - (mf/deps can-edit? on-context-menu) + (mf/deps can-edit? on-context-menu token) (fn [e] (dom/stop-propagation e) (when can-edit? - (on-context-menu e)))) + (on-context-menu e token)))) on-click (mf/use-fn