🔥 Remove old code for theme support (#6597)

This commit is contained in:
Miguel de Benito Delgado 2025-05-30 16:54:23 +02:00 committed by GitHub
parent ad26efaa5d
commit c9ceceb7e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 1 additions and 39 deletions

View file

@ -93,7 +93,6 @@
[] []
(mw/init!) (mw/init!)
(i18n/init! cf/translations) (i18n/init! cf/translations)
(theme/init! cf/themes)
(cur/init-styles) (cur/init-styles)
(thr/init!) (thr/init!)
(init-ui) (init-ui)

View file

@ -3,53 +3,16 @@
;; file, You can obtain one at http://mozilla.org/MPL/2.0/. ;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;; ;;
;; Copyright (c) KALEIDOS INC ;; Copyright (c) KALEIDOS INC
;; Copyright (c) Mathieu BRUNOT <mathieu.brunot@monogramm.io>
(ns app.util.theme (ns app.util.theme
"A theme manager."
(:require (:require
[app.config :as cfg]
[app.util.dom :as dom]
[app.util.globals :as globals] [app.util.globals :as globals]
[app.util.storage :as storage]
[beicon.v2.core :as rx] [beicon.v2.core :as rx]
[potok.v2.core :as ptk] [potok.v2.core :as ptk]))
[rumext.v2 :as mf]))
(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. ;; 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 (defonce ^:private color-scheme-mq