From c9ceceb7e9c5100d47d5385b2e3f052292cb1f41 Mon Sep 17 00:00:00 2001 From: Miguel de Benito Delgado Date: Fri, 30 May 2025 16:54:23 +0200 Subject: [PATCH] :fire: Remove old code for theme support (#6597) --- frontend/src/app/main.cljs | 1 - frontend/src/app/util/theme.cljs | 39 +------------------------------- 2 files changed, 1 insertion(+), 39 deletions(-) diff --git a/frontend/src/app/main.cljs b/frontend/src/app/main.cljs index 9de03be41f..809f1bce33 100644 --- a/frontend/src/app/main.cljs +++ b/frontend/src/app/main.cljs @@ -93,7 +93,6 @@ [] (mw/init!) (i18n/init! cf/translations) - (theme/init! cf/themes) (cur/init-styles) (thr/init!) (init-ui) diff --git a/frontend/src/app/util/theme.cljs b/frontend/src/app/util/theme.cljs index c6a4e1dec0..de3a25a813 100644 --- a/frontend/src/app/util/theme.cljs +++ b/frontend/src/app/util/theme.cljs @@ -3,53 +3,16 @@ ;; file, You can obtain one at http://mozilla.org/MPL/2.0/. ;; ;; Copyright (c) KALEIDOS INC -;; Copyright (c) Mathieu BRUNOT (ns app.util.theme - "A theme manager." (:require - [app.config :as cfg] - [app.util.dom :as dom] [app.util.globals :as globals] - [app.util.storage :as storage] [beicon.v2.core :as rx] - [potok.v2.core :as ptk] - [rumext.v2 :as mf])) + [potok.v2.core :as ptk])) -(defonce theme (get storage/global ::theme cfg/default-theme)) -(defonce theme-sub (rx/subject)) -(defonce themes #js {}) - -(defn init! - [data] - (set! themes data)) - -(defn set-current-theme! - [v] - (when (not= theme v) - (when-some [el (dom/get-element "theme")] - (set! (.-href el) (str "css/main-" v ".css"))) - (swap! storage/global assoc ::theme v) - (set! theme v) - (rx/push! theme-sub v))) - -(defn set-default-theme! - [] - (set-current-theme! cfg/default-theme)) - -(defn use-theme - [] - (let [[theme set-theme] (mf/useState theme)] - (mf/useEffect (fn [] - (let [sub (rx/sub! theme-sub #(set-theme %))] - #(rx/dispose! sub))) - #js []) - theme)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Set the preferred color scheme based on the user's system settings. -;; TODO: this is unrelated to the theme support above, which seems unused as -;; of v2.7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defonce ^:private color-scheme-mq