diff --git a/frontend/src/app/main/data/dashboard/shortcuts.cljs b/frontend/src/app/main/data/dashboard/shortcuts.cljs index 4baa33966a..2181e96def 100644 --- a/frontend/src/app/main/data/dashboard/shortcuts.cljs +++ b/frontend/src/app/main/data/dashboard/shortcuts.cljs @@ -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)) diff --git a/frontend/src/app/main/data/users.cljs b/frontend/src/app/main/data/users.cljs index f29223841c..4672ebbfd2 100644 --- a/frontend/src/app/main/data/users.cljs +++ b/frontend/src/app/main/data/users.cljs @@ -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 diff --git a/frontend/src/app/main/data/workspace.cljs b/frontend/src/app/main/data/workspace.cljs index edb21077c4..b711b1ead4 100644 --- a/frontend/src/app/main/data/workspace.cljs +++ b/frontend/src/app/main/data/workspace.cljs @@ -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) diff --git a/frontend/src/app/main/data/workspace/shortcuts.cljs b/frontend/src/app/main/data/workspace/shortcuts.cljs index abac1ae186..e2d5b6b90c 100644 --- a/frontend/src/app/main/data/workspace/shortcuts.cljs +++ b/frontend/src/app/main/data/workspace/shortcuts.cljs @@ -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 {} (->>