diff --git a/frontend/src/app/main/ui/workspace/tokens/core.cljs b/frontend/src/app/main/ui/workspace/tokens/core.cljs index 2fd5bfc1a..c237cae76 100644 --- a/frontend/src/app/main/ui/workspace/tokens/core.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/core.cljs @@ -43,6 +43,17 @@ (->> (vals tokens) (group-by :type))) +(defn tokens-name-map + "Convert tokens into a map with their `:name` as the key." + [tokens] + (->> (map (fn [{:keys [name] :as token}] [name token]) tokens) + (into {}))) + +(defn tokens-name-map-for-type [token-type tokens] + (-> (group-tokens-by-type tokens) + (get token-type []) + (tokens-name-map))) + ;; Update functions ------------------------------------------------------------ (defn on-apply-token [{:keys [token token-type-props selected-shapes] :as _props}]