🔥 Remove unused functions

This commit is contained in:
Andrés Moya 2025-04-14 16:31:22 +02:00 committed by Andrés Moya
parent 90b1895f19
commit 2f20ccf289
2 changed files with 12 additions and 55 deletions

View file

@ -1,45 +0,0 @@
(ns app.main.ui.workspace.tokens.token-set
(:require
[app.common.types.tokens-lib :as ctob]
[app.main.data.helpers :as dsh]))
(defn get-workspace-tokens-lib
[state]
(-> (dsh/lookup-file-data state)
(get :tokens-lib)))
;; Themes ----------------------------------------------------------------------
(defn get-active-theme-ids
[state]
(-> (dsh/lookup-file-data state)
(get :token-active-themes #{})))
(defn get-temp-theme-id
[state]
(-> (dsh/lookup-file-data state)
(get :token-theme-temporary-id)))
(defn update-theme-id
[state]
(let [active-themes (get-active-theme-ids state)
temporary-theme-id (get-temp-theme-id state)]
(cond
(empty? active-themes) temporary-theme-id
(= 1 (count active-themes)) (first active-themes)
:else temporary-theme-id)))
(defn get-workspace-token-theme
[id state]
(-> (dsh/lookup-file-data state)
(get :token-themes-index)
(get id)))
(defn add-token-set-to-token-theme [token-set-id token-theme]
(update token-theme :sets conj token-set-id))
;; Sets ------------------------------------------------------------------------
(defn get-active-theme-sets-tokens-names-map [state]
(when-let [lib (get-workspace-tokens-lib state)]
(ctob/get-active-themes-set-tokens lib)))

View file

@ -9,13 +9,13 @@
[app.common.files.helpers :as cfh]
[app.common.logging :as l]
[app.common.types.token :as ctt]
[app.common.types.tokens-lib :as ctob]
[app.main.data.helpers :as dsh]
[app.main.data.workspace.shapes :as dwsh]
[app.main.data.workspace.thumbnails :as dwt]
[app.main.data.workspace.undo :as dwu]
[app.main.ui.workspace.tokens.changes :as wtch]
[app.main.ui.workspace.tokens.style-dictionary :as wtsd]
[app.main.ui.workspace.tokens.token-set :as wtts]
[app.util.time :as dt]
[beicon.v2.core :as rx]
[clojure.data :as data]
@ -182,12 +182,14 @@
(ptk/reify ::update-workspace-tokens
ptk/WatchEvent
(watch [_ state _]
(let [tokens (-> (wtts/get-active-theme-sets-tokens-names-map state)
(wtsd/resolve-tokens+))]
(->> (rx/from tokens)
(rx/mapcat (fn [sd-tokens]
(let [undo-id (js/Symbol)]
(rx/concat
(rx/of (dwu/start-undo-transaction undo-id :timeout false))
(update-tokens state sd-tokens)
(rx/of (dwu/commit-undo-transaction undo-id)))))))))))
(when-let [tokens-lib (-> (dsh/lookup-file-data state)
(get :tokens-lib))]
(let [tokens (-> (ctob/get-active-themes-set-tokens tokens-lib)
(wtsd/resolve-tokens+))]
(->> (rx/from tokens)
(rx/mapcat (fn [sd-tokens]
(let [undo-id (js/Symbol)]
(rx/concat
(rx/of (dwu/start-undo-transaction undo-id :timeout false))
(update-tokens state sd-tokens)
(rx/of (dwu/commit-undo-transaction undo-id))))))))))))