mirror of
https://github.com/penpot/penpot.git
synced 2025-08-03 00:19:15 +02:00
Hide temporary token theme from user
This commit is contained in:
parent
e216d84484
commit
895f92e7c2
4 changed files with 27 additions and 13 deletions
|
@ -48,12 +48,6 @@
|
|||
(defn get-tokens-lib [state]
|
||||
(get-in state [:workspace-data :tokens-lib]))
|
||||
|
||||
(def hidden-token-theme-group
|
||||
"")
|
||||
|
||||
(def hidden-token-theme-name
|
||||
"__PENPOT__HIDDEN__TOKEN__SET__")
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; TOKENS Actions
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
@ -222,14 +216,14 @@
|
|||
ptk/WatchEvent
|
||||
(watch [it state _]
|
||||
(let [tokens-lib (get-tokens-lib state)
|
||||
prev-theme (ctob/get-theme tokens-lib hidden-token-theme-group hidden-token-theme-name)
|
||||
prev-theme (ctob/get-theme tokens-lib ctob/hidden-token-theme-group ctob/hidden-token-theme-name)
|
||||
theme (-> (or prev-theme (ctob/make-token-theme
|
||||
:group hidden-token-theme-group
|
||||
:name hidden-token-theme-name))
|
||||
:group ctob/hidden-token-theme-group
|
||||
:name ctob/hidden-token-theme-name))
|
||||
(ctob/toggle-set token-set-name))
|
||||
prev-active-token-themes (ctob/get-active-theme-paths tokens-lib)
|
||||
changes (-> (pcb/empty-changes it)
|
||||
(pcb/update-active-token-themes #{(ctob/token-theme-path hidden-token-theme-group hidden-token-theme-name)} prev-active-token-themes))
|
||||
(pcb/update-active-token-themes #{(ctob/token-theme-path ctob/hidden-token-theme-group ctob/hidden-token-theme-name)} prev-active-token-themes))
|
||||
changes' (if prev-theme
|
||||
(pcb/update-token-theme changes theme prev-theme)
|
||||
(pcb/add-token-theme changes theme))]
|
||||
|
|
|
@ -465,6 +465,9 @@
|
|||
(def workspace-token-themes
|
||||
(l/derived #(or (some-> % ctob/get-themes) []) tokens-lib))
|
||||
|
||||
(def workspace-token-themes-no-hidden
|
||||
(l/derived #(remove ctob/hidden-temporary-theme? %) workspace-token-themes))
|
||||
|
||||
(def workspace-selected-token-set-id
|
||||
(l/derived wtts/get-selected-token-set-id st/state))
|
||||
|
||||
|
|
|
@ -241,7 +241,7 @@
|
|||
|
||||
(mf/defc themes
|
||||
[_]
|
||||
(let [themes (mf/deref refs/workspace-token-themes)
|
||||
(let [themes (mf/deref refs/workspace-token-themes-no-hidden)
|
||||
state (mf/use-state (if (empty? themes)
|
||||
{:type :create-theme}
|
||||
{:type :themes-overview}))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue