mirror of
https://github.com/penpot/penpot.git
synced 2025-01-10 08:50:57 -05:00
✨ Move toggle-theme
to data.users ns.
This commit is contained in:
parent
caadc43d35
commit
1318a5c3c8
4 changed files with 24 additions and 24 deletions
|
@ -8,7 +8,7 @@
|
|||
(:require
|
||||
[app.main.data.dashboard :as dd]
|
||||
[app.main.data.shortcuts :as ds]
|
||||
[app.main.data.workspace :as dw]
|
||||
[app.main.data.users :as du]
|
||||
[app.main.store :as st]))
|
||||
|
||||
(def shortcuts
|
||||
|
@ -26,7 +26,7 @@
|
|||
:command "g l"
|
||||
:subsections [:navigation-dashboard]
|
||||
:fn #(st/emit! (dd/go-to-libs))}
|
||||
|
||||
|
||||
:create-new-project {:tooltip "+"
|
||||
:command "+"
|
||||
:subsections [:general-dashboard]
|
||||
|
@ -34,7 +34,7 @@
|
|||
|
||||
:toggle-light-dark {:tooltip (ds/meta (ds/alt "Q"))
|
||||
:command (ds/c-mod "alt+q")
|
||||
:fn #(st/emit! (dw/toggle-theme))}})
|
||||
:fn #(st/emit! (du/toggle-theme))}})
|
||||
|
||||
(defn get-tooltip [shortcut]
|
||||
(assert (contains? shortcuts shortcut) (str shortcut))
|
||||
|
|
|
@ -313,6 +313,25 @@
|
|||
(rx/of (profile-fetched data)))))
|
||||
(rx/catch on-error))))))
|
||||
|
||||
;; --- Toggle Theme
|
||||
|
||||
(defn toggle-theme
|
||||
[]
|
||||
(ptk/reify ::toggle-theme
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
(update-in state [:profile :theme]
|
||||
(fn [theme]
|
||||
(cond
|
||||
(= theme "default")
|
||||
"light"
|
||||
|
||||
:else
|
||||
"default"))))
|
||||
|
||||
ptk/WatchEvent
|
||||
(watch [_ state _]
|
||||
(rx/of (update-profile (:profile state))))))
|
||||
|
||||
|
||||
;; --- Request Email Change
|
||||
|
|
|
@ -633,26 +633,6 @@
|
|||
(let [nudge (get-in state [:profile :props :nudge])]
|
||||
(rx/of (du/update-profile-props {:nudge nudge}))))))
|
||||
|
||||
(defn toggle-theme
|
||||
[]
|
||||
(ptk/reify ::toggle-theme
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
(update-in
|
||||
state
|
||||
[:profile :theme]
|
||||
(fn [theme]
|
||||
(cond
|
||||
(= theme "default")
|
||||
"light"
|
||||
|
||||
:else
|
||||
"default"))))
|
||||
|
||||
ptk/WatchEvent
|
||||
(watch [_ state _]
|
||||
(rx/of (du/update-profile (:profile state))))))
|
||||
|
||||
;; --- Set element options mode
|
||||
|
||||
(dm/export layout/set-options-mode)
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
[app.main.data.exports :as de]
|
||||
[app.main.data.preview :as dp]
|
||||
[app.main.data.shortcuts :as ds]
|
||||
[app.main.data.users :as du]
|
||||
[app.main.data.workspace :as dw]
|
||||
[app.main.data.workspace.colors :as mdc]
|
||||
[app.main.data.workspace.common :as dwc]
|
||||
|
@ -552,7 +553,7 @@
|
|||
;; THEME
|
||||
:toggle-light-dark {:tooltip (ds/meta (ds/alt "Q"))
|
||||
:command (ds/c-mod "alt+q")
|
||||
:fn #(st/emit! (dw/toggle-theme))}})
|
||||
:fn #(st/emit! (du/toggle-theme))}})
|
||||
|
||||
(def opacity-shortcuts
|
||||
(into {} (->>
|
||||
|
|
Loading…
Reference in a new issue