mirror of
https://github.com/penpot/penpot.git
synced 2025-02-08 08:09:14 -05:00
Extract to function
This commit is contained in:
parent
97436531d0
commit
8e02dced2f
3 changed files with 15 additions and 7 deletions
|
@ -243,6 +243,9 @@
|
||||||
(def workspace-active-theme-ids
|
(def workspace-active-theme-ids
|
||||||
(l/derived wtts/get-active-theme-ids st/state))
|
(l/derived wtts/get-active-theme-ids st/state))
|
||||||
|
|
||||||
|
(def workspace-active-set-ids
|
||||||
|
(l/derived wtts/get-active-set-ids st/state))
|
||||||
|
|
||||||
(def workspace-token-themes
|
(def workspace-token-themes
|
||||||
(l/derived wtts/get-workspace-themes-index st/state))
|
(l/derived wtts/get-workspace-themes-index st/state))
|
||||||
|
|
||||||
|
|
|
@ -170,14 +170,8 @@
|
||||||
[_props]
|
[_props]
|
||||||
(let [active-theme-ids (mf/deref refs/workspace-active-theme-ids)
|
(let [active-theme-ids (mf/deref refs/workspace-active-theme-ids)
|
||||||
themes (mf/deref refs/workspace-ordered-token-themes)
|
themes (mf/deref refs/workspace-ordered-token-themes)
|
||||||
themes-index (mf/deref refs/workspace-token-themes)
|
|
||||||
active-set-ids (reduce
|
|
||||||
(fn [acc cur]
|
|
||||||
(if-let [sets (get-in themes-index [cur :sets])]
|
|
||||||
(set/union acc sets)
|
|
||||||
acc))
|
|
||||||
#{} active-theme-ids)
|
|
||||||
selected-token-set-id (mf/deref refs/workspace-selected-token-set-id)
|
selected-token-set-id (mf/deref refs/workspace-selected-token-set-id)
|
||||||
|
active-set-ids (mf/deref refs/workspace-active-set-ids)
|
||||||
token-sets (mf/deref refs/workspace-token-sets)]
|
token-sets (mf/deref refs/workspace-token-sets)]
|
||||||
[:div
|
[:div
|
||||||
[:style
|
[:style
|
||||||
|
|
|
@ -25,6 +25,17 @@
|
||||||
(defn get-temp-theme-id [state]
|
(defn get-temp-theme-id [state]
|
||||||
(get-in state [:workspace-data :token-theme-temporary-id]))
|
(get-in state [:workspace-data :token-theme-temporary-id]))
|
||||||
|
|
||||||
|
(defn get-active-set-ids [state]
|
||||||
|
(let [active-theme-ids (get-active-theme-ids state)
|
||||||
|
themes-index (get-workspace-themes-index state)
|
||||||
|
active-set-ids (reduce
|
||||||
|
(fn [acc cur]
|
||||||
|
(if-let [sets (get-in themes-index [cur :sets])]
|
||||||
|
(set/union acc sets)
|
||||||
|
acc))
|
||||||
|
#{} active-theme-ids)]
|
||||||
|
active-set-ids))
|
||||||
|
|
||||||
(defn theme-ids-with-group
|
(defn theme-ids-with-group
|
||||||
"Returns set of theme-ids that share the same `:group` property as the theme with `theme-id`.
|
"Returns set of theme-ids that share the same `:group` property as the theme with `theme-id`.
|
||||||
Will also return matching theme-ids without a `:group` property."
|
Will also return matching theme-ids without a `:group` property."
|
||||||
|
|
Loading…
Add table
Reference in a new issue