mirror of
https://github.com/penpot/penpot.git
synced 2025-04-12 23:11:23 -05: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))))))
|
||||
|
|
|
@ -163,7 +163,7 @@
|
|||
:token-set-selected? (constantly false)
|
||||
:token-set-active? token-set-active?
|
||||
:on-select on-toggle-token-set
|
||||
:on-toggle on-toggle-token-set
|
||||
:on-toggle-token-set on-toggle-token-set
|
||||
:context sets-context/static-context}]]
|
||||
[:div {:class (stl/css :edit-theme-footer)}
|
||||
(if edit?
|
||||
|
|
|
@ -128,6 +128,7 @@
|
|||
token-set-selected?
|
||||
token-set-active?
|
||||
on-create-token-set
|
||||
on-toggle-token-set
|
||||
on-select
|
||||
context]
|
||||
:as _props}]
|
||||
|
@ -141,6 +142,7 @@
|
|||
:editing? editing?
|
||||
:on-select on-select
|
||||
:on-edit on-edit
|
||||
:on-toggle on-toggle-token-set
|
||||
:on-submit #(do
|
||||
(on-update-token-set %)
|
||||
(on-reset))
|
||||
|
@ -175,6 +177,6 @@
|
|||
:token-set-selected? token-set-selected?
|
||||
:token-set-active? token-set-active?
|
||||
:on-select on-select-token-set-click
|
||||
:on-toggle on-toggle-token-set-click
|
||||
:on-toggle-token-set on-toggle-token-set-click
|
||||
:on-update-token-set on-update-token-set
|
||||
:on-create-token-set on-create-token-set}]))
|
||||
|
|
Loading…
Add table
Reference in a new issue