mirror of
https://github.com/penpot/penpot.git
synced 2025-06-01 13:51:45 +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
|
(rx/of
|
||||||
(dch/commit-changes changes))))))
|
(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/reify ::toggle-token-set
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [it state _]
|
(watch [it state _]
|
||||||
(js/console.log "token-set-id token-theme-id" token-set-id token-theme-id)
|
(let [target-theme-id (wtts/get-temp-theme-id state)
|
||||||
(let [theme (some-> (or token-theme-id (wtts/update-theme-id state))
|
active-set-ids (wtts/get-active-set-ids state)
|
||||||
(wtts/get-workspace-token-theme state))
|
theme (-> (wtts/get-workspace-token-theme target-theme-id state)
|
||||||
|
(assoc :sets active-set-ids))
|
||||||
changes (-> (pcb/empty-changes it)
|
changes (-> (pcb/empty-changes it)
|
||||||
(pcb/update-token-theme
|
(pcb/update-token-theme
|
||||||
(wtts/toggle-token-set-to-token-theme token-set-id theme)
|
(wtts/toggle-token-set-to-token-theme token-set-id theme)
|
||||||
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
|
(rx/of
|
||||||
(dch/commit-changes changes)
|
(dch/commit-changes changes)
|
||||||
(wtu/update-workspace-tokens))))))
|
(wtu/update-workspace-tokens))))))
|
||||||
|
|
|
@ -163,7 +163,7 @@
|
||||||
:token-set-selected? (constantly false)
|
:token-set-selected? (constantly false)
|
||||||
:token-set-active? token-set-active?
|
:token-set-active? token-set-active?
|
||||||
:on-select on-toggle-token-set
|
: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}]]
|
:context sets-context/static-context}]]
|
||||||
[:div {:class (stl/css :edit-theme-footer)}
|
[:div {:class (stl/css :edit-theme-footer)}
|
||||||
(if edit?
|
(if edit?
|
||||||
|
|
|
@ -128,6 +128,7 @@
|
||||||
token-set-selected?
|
token-set-selected?
|
||||||
token-set-active?
|
token-set-active?
|
||||||
on-create-token-set
|
on-create-token-set
|
||||||
|
on-toggle-token-set
|
||||||
on-select
|
on-select
|
||||||
context]
|
context]
|
||||||
:as _props}]
|
:as _props}]
|
||||||
|
@ -141,6 +142,7 @@
|
||||||
:editing? editing?
|
:editing? editing?
|
||||||
:on-select on-select
|
:on-select on-select
|
||||||
:on-edit on-edit
|
:on-edit on-edit
|
||||||
|
:on-toggle on-toggle-token-set
|
||||||
:on-submit #(do
|
:on-submit #(do
|
||||||
(on-update-token-set %)
|
(on-update-token-set %)
|
||||||
(on-reset))
|
(on-reset))
|
||||||
|
@ -175,6 +177,6 @@
|
||||||
:token-set-selected? token-set-selected?
|
:token-set-selected? token-set-selected?
|
||||||
:token-set-active? token-set-active?
|
:token-set-active? token-set-active?
|
||||||
:on-select on-select-token-set-click
|
: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-update-token-set on-update-token-set
|
||||||
:on-create-token-set on-create-token-set}]))
|
:on-create-token-set on-create-token-set}]))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue