mirror of
https://github.com/penpot/penpot.git
synced 2025-06-04 14:41:38 +02:00
Always switch to temporary theme when toggling sets in sidebar
This commit is contained in:
parent
3bb99e8f7c
commit
d6823e8583
3 changed files with 10 additions and 7 deletions
|
@ -179,18 +179,19 @@
|
|||
(rx/of
|
||||
(dch/commit-changes changes))))))
|
||||
|
||||
(defn toggle-token-set [{:keys [token-set-id token-theme-id]}]
|
||||
(defn toggle-token-set [{:keys [token-set-id]}]
|
||||
(ptk/reify ::toggle-token-set
|
||||
ptk/WatchEvent
|
||||
(watch [it state _]
|
||||
(js/console.log "token-set-id token-theme-id" token-set-id token-theme-id)
|
||||
(let [theme (some-> (or token-theme-id (wtts/update-theme-id state))
|
||||
(wtts/get-workspace-token-theme state))
|
||||
(let [target-theme-id (wtts/get-temp-theme-id state)
|
||||
active-set-ids (wtts/get-active-set-ids state)
|
||||
theme (-> (wtts/get-workspace-token-theme target-theme-id state)
|
||||
(assoc :sets active-set-ids))
|
||||
changes (-> (pcb/empty-changes it)
|
||||
(pcb/update-token-theme
|
||||
(wtts/toggle-token-set-to-token-theme token-set-id theme)
|
||||
theme)
|
||||
(pcb/update-active-token-themes #{(wtts/update-theme-id state)} (wtts/get-active-theme-ids state)))]
|
||||
(pcb/update-active-token-themes #{target-theme-id} (wtts/get-active-theme-ids state)))]
|
||||
(rx/of
|
||||
(dch/commit-changes changes)
|
||||
(wtu/update-workspace-tokens))))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue