mirror of
https://github.com/penpot/penpot.git
synced 2025-08-01 13:08:29 +02: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
|
(:require
|
||||||
[app.main.data.dashboard :as dd]
|
[app.main.data.dashboard :as dd]
|
||||||
[app.main.data.shortcuts :as ds]
|
[app.main.data.shortcuts :as ds]
|
||||||
[app.main.data.workspace :as dw]
|
[app.main.data.users :as du]
|
||||||
[app.main.store :as st]))
|
[app.main.store :as st]))
|
||||||
|
|
||||||
(def shortcuts
|
(def shortcuts
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
:command "g l"
|
:command "g l"
|
||||||
:subsections [:navigation-dashboard]
|
:subsections [:navigation-dashboard]
|
||||||
:fn #(st/emit! (dd/go-to-libs))}
|
:fn #(st/emit! (dd/go-to-libs))}
|
||||||
|
|
||||||
:create-new-project {:tooltip "+"
|
:create-new-project {:tooltip "+"
|
||||||
:command "+"
|
:command "+"
|
||||||
:subsections [:general-dashboard]
|
:subsections [:general-dashboard]
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
:toggle-light-dark {:tooltip (ds/meta (ds/alt "Q"))
|
:toggle-light-dark {:tooltip (ds/meta (ds/alt "Q"))
|
||||||
:command (ds/c-mod "alt+q")
|
:command (ds/c-mod "alt+q")
|
||||||
:fn #(st/emit! (dw/toggle-theme))}})
|
:fn #(st/emit! (du/toggle-theme))}})
|
||||||
|
|
||||||
(defn get-tooltip [shortcut]
|
(defn get-tooltip [shortcut]
|
||||||
(assert (contains? shortcuts shortcut) (str shortcut))
|
(assert (contains? shortcuts shortcut) (str shortcut))
|
||||||
|
|
|
@ -313,6 +313,25 @@
|
||||||
(rx/of (profile-fetched data)))))
|
(rx/of (profile-fetched data)))))
|
||||||
(rx/catch on-error))))))
|
(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
|
;; --- Request Email Change
|
||||||
|
|
|
@ -633,26 +633,6 @@
|
||||||
(let [nudge (get-in state [:profile :props :nudge])]
|
(let [nudge (get-in state [:profile :props :nudge])]
|
||||||
(rx/of (du/update-profile-props {:nudge 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
|
;; --- Set element options mode
|
||||||
|
|
||||||
(dm/export layout/set-options-mode)
|
(dm/export layout/set-options-mode)
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
[app.main.data.exports :as de]
|
[app.main.data.exports :as de]
|
||||||
[app.main.data.preview :as dp]
|
[app.main.data.preview :as dp]
|
||||||
[app.main.data.shortcuts :as ds]
|
[app.main.data.shortcuts :as ds]
|
||||||
|
[app.main.data.users :as du]
|
||||||
[app.main.data.workspace :as dw]
|
[app.main.data.workspace :as dw]
|
||||||
[app.main.data.workspace.colors :as mdc]
|
[app.main.data.workspace.colors :as mdc]
|
||||||
[app.main.data.workspace.common :as dwc]
|
[app.main.data.workspace.common :as dwc]
|
||||||
|
@ -552,7 +553,7 @@
|
||||||
;; THEME
|
;; THEME
|
||||||
:toggle-light-dark {:tooltip (ds/meta (ds/alt "Q"))
|
:toggle-light-dark {:tooltip (ds/meta (ds/alt "Q"))
|
||||||
:command (ds/c-mod "alt+q")
|
:command (ds/c-mod "alt+q")
|
||||||
:fn #(st/emit! (dw/toggle-theme))}})
|
:fn #(st/emit! (du/toggle-theme))}})
|
||||||
|
|
||||||
(def opacity-shortcuts
|
(def opacity-shortcuts
|
||||||
(into {} (->>
|
(into {} (->>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue