From b9ab00c549fc1325bac952f2a6c47c3b20bcd3f9 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Tue, 19 Apr 2022 07:33:55 +0200 Subject: [PATCH] :bug: Fix bullet colors from pasted shapes with library colors --- .../sidebar/options/rows/color_row.cljs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/rows/color_row.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/rows/color_row.cljs index 41ce9d1d1..a58b06467 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/rows/color_row.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/rows/color_row.cljs @@ -65,11 +65,11 @@ shared-libs (mf/deref refs/workspace-libraries) hover-detach (mf/use-state false) - get-color-name (fn [{:keys [id file-id]}] - (let [src-colors (if (= file-id current-file-id) - file-colors - (get-in shared-libs [file-id :data :colors]))] - (get-in src-colors [id :name]))) + src-colors (if (= (:file-id color) current-file-id) + file-colors + (get-in shared-libs [(:file-id color) :data :colors])) + + color-name (get-in src-colors [(:id color) :name]) parse-color (fn [color] (-> color @@ -141,15 +141,18 @@ :dnd-over-top (= (:over dprops) :top) :dnd-over-bot (= (:over dprops) :bot)) :ref dref} - [:& cb/color-bullet {:color color + [:& cb/color-bullet {:color (cond-> color + (nil? color-name) (assoc + :id nil + :file-id nil)) :on-click handle-click-color}] (cond ;; Rendering a color with ID - (and (:id color) (not (uc/multiple? color))) + (and (:id color) color-name (not (uc/multiple? color))) [:* [:div.color-info - [:div.color-name (str (get-color-name color))]] + [:div.color-name (str color-name)]] (when on-detach [:div.element-set-actions-button {:on-mouse-enter #(reset! hover-detach true)